Documentation ¶
Overview ¶
Package resource implements representations of k8s API resources as "unstructured" objects.
Index ¶
- type GenerationBehavior
- type ResId
- type Resource
- func (r *Resource) Behavior() GenerationBehavior
- func (r *Resource) GetFieldValue(fieldPath string) (string, error)
- func (r *Resource) Id() ResId
- func (r *Resource) IsGenerated() bool
- func (r *Resource) Merge(other *Resource)
- func (r *Resource) Replace(other *Resource)
- func (r *Resource) SetBehavior(b GenerationBehavior) *Resource
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.
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
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
GetFieldValue returns value at the given fieldpath.
func (*Resource) IsGenerated ¶ added in v1.0.5
IsGenerated checks if the resource is generated from a generator
func (*Resource) SetBehavior ¶ added in v1.0.2
func (r *Resource) SetBehavior(b GenerationBehavior) *Resource
SetBehavior changes the resource to the new behavior