resource

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package resource implements representations of k8s API resources as "unstructured" objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerationBehavior added in v1.0.2

type GenerationBehavior int

GenerationBehavior specifies generation behavior of configmaps, secrets and maybe other resources.

const (
	// BehaviorUnspecified is an Unspecified behavior; typically treated as a Create.
	BehaviorUnspecified GenerationBehavior = iota
	// BehaviorCreate makes a new resource.
	BehaviorCreate
	// BehaviorReplace replaces a resource.
	BehaviorReplace
	// BehaviorMerge attempts to merge a new resource with an existing resource.
	BehaviorMerge
)

func NewGenerationBehavior added in v1.0.2

func NewGenerationBehavior(s string) GenerationBehavior

NewGenerationBehavior converts a string to a GenerationBehavior.

func (GenerationBehavior) String added in v1.0.2

func (b GenerationBehavior) String() string

String converts a GenerationBehavior to a string.

type ResId added in v1.0.2

type ResId struct {
	// contains filtered or unexported fields
}

ResId conflates GroupVersionKind with a textual name to uniquely identify a kubernetes resource (object).

func NewResId added in v1.0.2

func NewResId(g schema.GroupVersionKind, n string) ResId

NewResId creates new resource identifier

func (ResId) Gvk added in v1.0.2

func (n ResId) Gvk() schema.GroupVersionKind

Gvk returns Group/Version/Kind of the resource.

func (ResId) Name added in v1.0.2

func (n ResId) Name() string

Name returns resource name.

func (ResId) String added in v1.0.2

func (n ResId) String() string

type Resource

type Resource struct {
	unstructured.Unstructured
	// contains filtered or unexported fields
}

Resource is an "Unstructured" (json/map form) Kubernetes API resource object paired with a GenerationBehavior.

func NewResourceFromMap added in v1.0.2

func NewResourceFromMap(m map[string]interface{}) *Resource

NewResourceFromMap returns a new instance of Resource.

func NewResourceFromUnstruct added in v1.0.2

func NewResourceFromUnstruct(u unstructured.Unstructured) *Resource

NewResourceFromUnstruct returns a new instance of Resource.

func NewResourceWithBehavior added in v1.0.2

func NewResourceWithBehavior(obj runtime.Object, b GenerationBehavior) (*Resource, error)

NewResourceWithBehavior returns a new instance of Resource.

func (*Resource) Behavior

func (r *Resource) Behavior() GenerationBehavior

Behavior returns the behavior for the resource.

func (*Resource) GetFieldValue added in v1.0.2

func (r *Resource) GetFieldValue(fieldPath string) (string, error)

GetFieldValue returns value at the given fieldpath.

func (*Resource) Id added in v1.0.2

func (r *Resource) Id() ResId

Id returns the ResId for the resource.

func (*Resource) IsGenerated added in v1.0.5

func (r *Resource) IsGenerated() bool

IsGenerated checks if the resource is generated from a generator

func (*Resource) Merge added in v1.0.2

func (r *Resource) Merge(other *Resource)

Merge performs merge with other resource.

func (*Resource) Replace added in v1.0.2

func (r *Resource) Replace(other *Resource)

Replace performs replace with other resource.

func (*Resource) SetBehavior added in v1.0.2

func (r *Resource) SetBehavior(b GenerationBehavior) *Resource

SetBehavior changes the resource to the new behavior

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL