Documentation
¶
Overview ¶
Package composed contains an unstructured composed resource.
Example ¶
// Create a new, empty composed resource.
cd := New()
// Set our composed resource's type metadata.
cd.SetAPIVersion("example.org/v1")
cd.SetKind("CoolComposedResource")
// Set our composed resource's object metadata.
cd.SetLabels(map[string]string{"coolness": "high"})
// Set an arbitrary spec field.
cd.SetInteger("spec.coolness", 9001)
// Marshal our composed resource to YAML. We just do this for illustration
// purposes. Normally you'd add it to the map of desired resources you send
// in your RunFunctionResponse.
y, _ := yaml.Marshal(cd)
fmt.Println(string(y))
Output: apiVersion: example.org/v1 kind: CoolComposedResource metadata: labels: coolness: high spec: coolness: 9001
Index ¶
- Variables
- type Unstructured
- func (cd *Unstructured) DeepCopy() *Unstructured
- func (cd *Unstructured) DeepCopyInto(out *Unstructured)
- func (cd *Unstructured) DeepCopyObject() runtime.Object
- func (cd *Unstructured) GetBool(path string) (bool, error)
- func (cd *Unstructured) GetCondition(ct xpv1.ConditionType) xpv1.Condition
- func (cd *Unstructured) GetInteger(path string) (int64, error)
- func (cd *Unstructured) GetObservedGeneration() int64
- func (cd *Unstructured) GetString(path string) (string, error)
- func (cd *Unstructured) GetStringArray(path string) ([]string, error)
- func (cd *Unstructured) GetStringObject(path string) (map[string]string, error)
- func (cd *Unstructured) GetValue(path string) (any, error)
- func (cd *Unstructured) GetValueInto(path string, out any) error
- func (cd *Unstructured) GetWriteConnectionSecretToReference() *xpv1.SecretReference
- func (cd *Unstructured) MarshalJSON() ([]byte, error)
- func (cd *Unstructured) SetBool(path string, value bool) error
- func (cd *Unstructured) SetConditions(c ...xpv1.Condition)
- func (cd *Unstructured) SetInteger(path string, value int64) error
- func (cd *Unstructured) SetObservedGeneration(generation int64)
- func (cd *Unstructured) SetString(path, value string) error
- func (cd *Unstructured) SetValue(path string, value any) error
- func (cd *Unstructured) SetWriteConnectionSecretToReference(r *xpv1.SecretReference)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Scheme *runtime.Scheme //nolint:gochecknoglobals // See comment above.
Scheme used to determine the type of any runtime.Object passed to From.
Functions ¶
This section is empty.
Types ¶
type Unstructured ¶
type Unstructured struct {
unstructured.Unstructured
}
An Unstructured composed resource.
func From ¶
func From(o runtime.Object) (*Unstructured, error)
From creates a new unstructured composed resource from the supplied object.
Example ¶
// Add test resource types to the scheme so that From can automatically
// determine their apiVersion and kind.
AddTestResourceToScheme(Scheme)
// Create a strongly typed runtime.Object using our test resource.
tr := &TestResource{
TypeMeta: metav1.TypeMeta{
APIVersion: TestResourceAPIVersion,
Kind: TestResourceKind,
},
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"coolness": "high",
},
},
Spec: TestResourceSpec{
ForProvider: TestResourceParameters{
Region: ptr.To[string]("us-east-2"),
},
},
}
// Create a composed resource from the runtime.Object.
cd, err := From(tr)
if err != nil {
panic(err)
}
// Marshal our composed resource to YAML. We just do this for illustration
// purposes. Normally you'd add it to the map of desired resources you send
// in your RunFunctionResponse.
y, _ := yaml.Marshal(cd)
fmt.Println(string(y))
Output: apiVersion: example.org/v1alpha1 kind: TestResource metadata: labels: coolness: high spec: forProvider: region: us-east-2 status: observedGeneration: 0
func (*Unstructured) DeepCopy ¶
func (cd *Unstructured) DeepCopy() *Unstructured
DeepCopy this composed resource.
func (*Unstructured) DeepCopyInto ¶
func (cd *Unstructured) DeepCopyInto(out *Unstructured)
DeepCopyInto the supplied composed resource.
func (*Unstructured) DeepCopyObject ¶
func (cd *Unstructured) DeepCopyObject() runtime.Object
DeepCopyObject of this composed resource.
func (*Unstructured) GetBool ¶
func (cd *Unstructured) GetBool(path string) (bool, error)
GetBool value of the supplied field path.
func (*Unstructured) GetCondition ¶
func (cd *Unstructured) GetCondition(ct xpv1.ConditionType) xpv1.Condition
GetCondition of this Composed resource.
func (*Unstructured) GetInteger ¶
func (cd *Unstructured) GetInteger(path string) (int64, error)
GetInteger value of the supplied field path.
func (*Unstructured) GetObservedGeneration ¶ added in v0.3.0
func (cd *Unstructured) GetObservedGeneration() int64
GetObservedGeneration of this Composed resource.
func (*Unstructured) GetString ¶
func (cd *Unstructured) GetString(path string) (string, error)
GetString value of the supplied field path.
func (*Unstructured) GetStringArray ¶
func (cd *Unstructured) GetStringArray(path string) ([]string, error)
GetStringArray value of the supplied field path.
func (*Unstructured) GetStringObject ¶
func (cd *Unstructured) GetStringObject(path string) (map[string]string, error)
GetStringObject value of the supplied field path.
func (*Unstructured) GetValue ¶
func (cd *Unstructured) GetValue(path string) (any, error)
GetValue of the supplied field path.
func (*Unstructured) GetValueInto ¶
func (cd *Unstructured) GetValueInto(path string, out any) error
GetValueInto the supplied type.
func (*Unstructured) GetWriteConnectionSecretToReference ¶
func (cd *Unstructured) GetWriteConnectionSecretToReference() *xpv1.SecretReference
GetWriteConnectionSecretToReference of this Composed resource.
func (*Unstructured) MarshalJSON ¶
func (cd *Unstructured) MarshalJSON() ([]byte, error)
MarshalJSON for this composed resource.
func (*Unstructured) SetBool ¶
func (cd *Unstructured) SetBool(path string, value bool) error
SetBool value at the supplied field path.
func (*Unstructured) SetConditions ¶
func (cd *Unstructured) SetConditions(c ...xpv1.Condition)
SetConditions of this Composed resource.
func (*Unstructured) SetInteger ¶
func (cd *Unstructured) SetInteger(path string, value int64) error
SetInteger value at the supplied field path.
func (*Unstructured) SetObservedGeneration ¶ added in v0.3.0
func (cd *Unstructured) SetObservedGeneration(generation int64)
SetObservedGeneration of this Composed resource.
func (*Unstructured) SetString ¶
func (cd *Unstructured) SetString(path, value string) error
SetString value at the supplied field path.
func (*Unstructured) SetValue ¶
func (cd *Unstructured) SetValue(path string, value any) error
SetValue at the supplied field path.
func (*Unstructured) SetWriteConnectionSecretToReference ¶
func (cd *Unstructured) SetWriteConnectionSecretToReference(r *xpv1.SecretReference)
SetWriteConnectionSecretToReference of this Composed resource.