Documentation ¶
Index ¶
- func AddToMap(key string, val interface{}, obj map[string]interface{})
- func CanonicalizeIntegerValue(val interface{}) (int64, error)
- func CanonicalizeNumberValue(val interface{}) (float64, error)
- func GetHierarchicalRefFromConfigForMultiParentResource(config map[string]interface{}, schema *openapi.Schema, ...) (interface{}, *corekccv1alpha1.TypeConfig, error)
- func GetHierarchicalReferenceConfigForMultiParentResource(schema *openapi.Schema, smLoader dclmetadata.ServiceMetadataLoader) ([]corekccv1alpha1.HierarchicalReference, error)
- func GetHierarchicalReferenceConfigFromDCLSchema(schema *openapi.Schema, smLoader dclmetadata.ServiceMetadataLoader) ([]corekccv1alpha1.HierarchicalReference, error)
- func GetHierarchicalReferencesForGVK(gvk schema.GroupVersionKind, smLoader dclmetadata.ServiceMetadataLoader, ...) ([]corekccv1alpha1.HierarchicalReference, error)
- func GetMutableButUnreadableFieldsFromAnnotations(r *Resource) (map[string]interface{}, error)
- func GetReferenceTypeConfigs(schema *openapi.Schema, smLoader dclmetadata.ServiceMetadataLoader) ([]corekccv1alpha1.TypeConfig, error)
- func IsContainerField(path []string) bool
- func IsMultiTypeParentReferenceField(path []string) bool
- func IsNil(v interface{}) bool
- func IsNoSuchMethodError(err error) bool
- func IsParentReferenceField(path []string) bool
- func IsSingleTypeParentReferenceField(path []string) bool
- func MutableButUnreadableFieldsAnnotationFor(r *Resource) (string, error)
- func ParentPrefixForKind(kind string) string
- func ParentReferenceFields() []string
- func SupportsMultipleParentTypes(schema *openapi.Schema) bool
- func ToTypeConfig(rawElem map[interface{}]interface{}, ...) (*corekccv1alpha1.TypeConfig, error)
- func TrimNilFields(m map[string]interface{})
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeIntegerValue ¶
CanonicalizeIntegerValue converts the numeric value for integer type to int64 because that's the integer type used by DCL. During json marshalling, all numeric values are converted to be of type float64; we canonicalize them to int64 before sending to DCL.
func CanonicalizeNumberValue ¶
CanonicalizeNumberValue converts the numeric value for number type to float64 because that's the double type used by DCL.
func GetHierarchicalRefFromConfigForMultiParentResource ¶
func GetHierarchicalRefFromConfigForMultiParentResource(config map[string]interface{}, schema *openapi.Schema, smLoader dclmetadata.ServiceMetadataLoader) (interface{}, *corekccv1alpha1.TypeConfig, error)
GetHierarchicalRefFromConfigForMultiParentResource gets the value and TypeConfig of the hierarchical reference in the KRM config, assuming that the config is for a multi-parent resource (i.e. supports more than one hierarchical reference). Returns nil if no hierarchical reference is found. Returns an error if multiple are found.
func GetHierarchicalReferenceConfigForMultiParentResource ¶
func GetHierarchicalReferenceConfigForMultiParentResource(schema *openapi.Schema, smLoader dclmetadata.ServiceMetadataLoader) ([]corekccv1alpha1.HierarchicalReference, error)
func GetHierarchicalReferenceConfigFromDCLSchema ¶
func GetHierarchicalReferenceConfigFromDCLSchema(schema *openapi.Schema, smLoader dclmetadata.ServiceMetadataLoader) ([]corekccv1alpha1.HierarchicalReference, error)
func GetHierarchicalReferencesForGVK ¶
func GetHierarchicalReferencesForGVK(gvk schema.GroupVersionKind, smLoader dclmetadata.ServiceMetadataLoader, schemaLoader dclschemaloader.DCLSchemaLoader) ([]corekccv1alpha1.HierarchicalReference, error)
func GetReferenceTypeConfigs ¶
func GetReferenceTypeConfigs(schema *openapi.Schema, smLoader dclmetadata.ServiceMetadataLoader) ([]corekccv1alpha1.TypeConfig, error)
func IsContainerField ¶
func IsNil ¶
func IsNil(v interface{}) bool
An interface value strictly equals to nil only if the V (actual value) and T (type) are both unset; we want to treat interface values like (T=[]interface{}, V=nil) as nil too since the actual value is nil.
func IsNoSuchMethodError ¶
func IsParentReferenceField ¶
func ParentPrefixForKind ¶
ParentPrefixForKind gets the parent prefix for the given kind (e.g. "Project" => "projects/"). This is used for setting/parsing values of multi-type parent reference fields in DCL which require a parent prefix to denote the parent type.
func ParentReferenceFields ¶
func ParentReferenceFields() []string
func SupportsMultipleParentTypes ¶
func SupportsMultipleParentTypes(schema *openapi.Schema) bool
func ToTypeConfig ¶
func ToTypeConfig(rawElem map[interface{}]interface{}, smLoader dclmetadata.ServiceMetadataLoader) (*corekccv1alpha1.TypeConfig, error)
ToTypeConfig converts a 'x-dcl-references' element to a TypeConfig.
func TrimNilFields ¶
func TrimNilFields(m map[string]interface{})
TrimNilFields removes all nil fields in the input object, including non-top-level nil fields (e.g. those found in nested objects and nested list of objects).
Types ¶
type Resource ¶
type Resource struct { k8s.Resource `json:",inline"` Original *k8s.Resource `json:"-"` // Fields related to DCL processing Schema *openapi.Schema `json:"-"` }
Resource is a wrapper around k8s.Resource and adds information regarding its corresponding DCL resource and maintains an original copy of the k8s.Resource.
func NewResource ¶
func NewResource(u *unstructured.Unstructured, schema *openapi.Schema) (*Resource, error)
func (*Resource) HasMutableButUnreadableFields ¶
func (*Resource) HasServerGeneratedIDAndConfigured ¶
func (*Resource) HasServerGeneratedIDButNotConfigured ¶
func (*Resource) ValidateResourceIDIfSupported ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package extension is used to interpret the dcl extensions.
|
Package extension is used to interpret the dcl extensions. |
Package metadata defines some KCC metadata around GCP services and DCL.
|
Package metadata defines some KCC metadata around GCP services and DCL. |
schema
|
|