Documentation ¶
Index ¶
- Constants
- Variables
- func GetConditionsFunction(k *ResourceFunction, codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func NewGetAPIVersionFunction(apiVersionTypeName astmodel.TypeName, apiVersionEnumValue astmodel.EnumValue, ...) astmodel.Function
- func NewGetTypeFunction(armType string, idFactory astmodel.IdentifierFactory, ...) astmodel.Function
- func NewHubFunction(idFactory astmodel.IdentifierFactory) astmodel.Function
- func NewInitializeSpecFunction(def astmodel.TypeDefinition, specInitializeFunction string, ...) (astmodel.Function, error)
- func NewLocatableResource(idFactory astmodel.IdentifierFactory, resourceType *astmodel.ResourceType) *astmodel.InterfaceImplementation
- func NewNewEmptyARMValueFunc(armType astmodel.TypeName, idFactory astmodel.IdentifierFactory) astmodel.Function
- func SetConditionsFunction(k *ResourceFunction, codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- type ChainedConversionFunction
- func (fn *ChainedConversionFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn *ChainedConversionFunction) Equals(otherFn astmodel.Function, override astmodel.EqualityOverrides) bool
- func (fn *ChainedConversionFunction) Name() string
- func (fn *ChainedConversionFunction) References() astmodel.TypeNameSet
- func (fn *ChainedConversionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type DefaulterBuilder
- type GetExtendedResourcesFunction
- func (ext *GetExtendedResourcesFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (ext *GetExtendedResourcesFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (ext *GetExtendedResourcesFunction) Name() string
- func (ext *GetExtendedResourcesFunction) References() astmodel.TypeNameSet
- func (ext *GetExtendedResourcesFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type IndexRegistrationFunction
- func (f *IndexRegistrationFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (f *IndexRegistrationFunction) Equals(other astmodel.Function, overrides astmodel.EqualityOverrides) bool
- func (f *IndexRegistrationFunction) IndexKey() string
- func (f *IndexRegistrationFunction) Name() string
- func (f *IndexRegistrationFunction) References() astmodel.TypeNameSet
- func (f *IndexRegistrationFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type KubernetesExporterBuilder
- type ObjectFunction
- func NewEmptyStatusFunction(status astmodel.TypeName, idFactory astmodel.IdentifierFactory) *ObjectFunction
- func NewGetSpecFunction(idFactory astmodel.IdentifierFactory) *ObjectFunction
- func NewGetStatusFunction(idFactory astmodel.IdentifierFactory) *ObjectFunction
- func NewObjectFunction(name string, idFactory astmodel.IdentifierFactory, ...) *ObjectFunction
- func (fn *ObjectFunction) AddPackageReference(refs ...astmodel.PackageReference)
- func (fn *ObjectFunction) AddReferencedTypes(types ...astmodel.TypeName)
- func (fn *ObjectFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn *ObjectFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (fn *ObjectFunction) IdFactory() astmodel.IdentifierFactory
- func (fn *ObjectFunction) Name() string
- func (fn *ObjectFunction) References() astmodel.TypeNameSet
- func (fn *ObjectFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type ObjectFunctionHandler
- type OneOfJSONMarshalFunction
- func (f *OneOfJSONMarshalFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (f *OneOfJSONMarshalFunction) Equals(other astmodel.Function, overrides astmodel.EqualityOverrides) bool
- func (f *OneOfJSONMarshalFunction) Name() string
- func (f *OneOfJSONMarshalFunction) References() astmodel.TypeNameSet
- func (f *OneOfJSONMarshalFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type OneOfJSONUnmarshalFunction
- func (f *OneOfJSONUnmarshalFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (f *OneOfJSONUnmarshalFunction) Equals(other astmodel.Function, overrides astmodel.EqualityOverrides) bool
- func (f *OneOfJSONUnmarshalFunction) Name() string
- func (f *OneOfJSONUnmarshalFunction) References() astmodel.TypeNameSet
- func (f *OneOfJSONUnmarshalFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type OriginalGVKFunction
- func (o *OriginalGVKFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (o *OriginalGVKFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (o *OriginalGVKFunction) Name() string
- func (o *OriginalGVKFunction) References() astmodel.TypeNameSet
- func (o *OriginalGVKFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type OriginalVersionFunction
- func (o *OriginalVersionFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (o *OriginalVersionFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (o *OriginalVersionFunction) Name() string
- func (o *OriginalVersionFunction) References() astmodel.TypeNameSet
- func (o *OriginalVersionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- func (o *OriginalVersionFunction) ReturnType() astmodel.Type
- type OriginalVersionKind
- type PivotConversionFunction
- func (fn *PivotConversionFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn *PivotConversionFunction) Equals(otherFn astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (fn *PivotConversionFunction) Name() string
- func (fn *PivotConversionFunction) References() astmodel.TypeNameSet
- func (fn *PivotConversionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type PropertyAssignmentFunction
- func (fn *PropertyAssignmentFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn *PropertyAssignmentFunction) Direction() conversions.Direction
- func (fn *PropertyAssignmentFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (fn *PropertyAssignmentFunction) Name() string
- func (fn *PropertyAssignmentFunction) ParameterType() astmodel.TypeName
- func (fn *PropertyAssignmentFunction) References() astmodel.TypeNameSet
- func (fn *PropertyAssignmentFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type PropertyAssignmentFunctionBuilder
- func (builder *PropertyAssignmentFunctionBuilder) AddAssignmentSelector(selector PropertyAssignmentSelector)
- func (builder *PropertyAssignmentFunctionBuilder) AddSuffixMatchingAssignmentSelector(sourceSuffix string, destinationSuffix string)
- func (builder *PropertyAssignmentFunctionBuilder) Build(conversionContext *conversions.PropertyConversionContext) (*PropertyAssignmentFunction, error)
- func (builder *PropertyAssignmentFunctionBuilder) UseAugmentationInterface(augmentation astmodel.TypeName)
- type PropertyAssignmentSelector
- type PureFunction
- func (fn *PureFunction) AddPackageReference(refs ...astmodel.PackageReference)
- func (fn *PureFunction) AddReferencedTypes(types ...astmodel.TypeName)
- func (fn *PureFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn *PureFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (fn *PureFunction) IdFactory() astmodel.IdentifierFactory
- func (fn *PureFunction) Name() string
- func (fn *PureFunction) References() astmodel.TypeNameSet
- func (fn *PureFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type PureFunctionHandler
- type ReceiverType
- type ResourceConversionFunction
- func (fn *ResourceConversionFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn *ResourceConversionFunction) Direction() conversions.Direction
- func (fn *ResourceConversionFunction) Equals(otherFn astmodel.Function, override astmodel.EqualityOverrides) bool
- func (fn *ResourceConversionFunction) Hub() astmodel.TypeName
- func (fn *ResourceConversionFunction) Name() string
- func (fn *ResourceConversionFunction) References() astmodel.TypeNameSet
- func (fn *ResourceConversionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type ResourceFunction
- func NewDefaultAzureNameFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
- func NewResourceFunction(name string, resource *astmodel.ResourceType, ...) *ResourceFunction
- func NewValidateOptionalConfigMapReferenceFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
- func NewValidateOwnerReferenceFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
- func NewValidateResourceReferencesFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
- func NewValidateWriteOncePropertiesFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
- func (fn *ResourceFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn *ResourceFunction) Equals(f astmodel.Function, overrides astmodel.EqualityOverrides) bool
- func (fn *ResourceFunction) IdFactory() astmodel.IdentifierFactory
- func (fn *ResourceFunction) Name() string
- func (fn *ResourceFunction) References() astmodel.TypeNameSet
- func (fn *ResourceFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- func (fn *ResourceFunction) Resource() *astmodel.ResourceType
- type ResourceFunctionHandler
- type ResourceStatusSetterFunction
- func (fn ResourceStatusSetterFunction) AsFunc(codeGenerationContext *astmodel.CodeGenerationContext, ...) (*dst.FuncDecl, error)
- func (fn ResourceStatusSetterFunction) Equals(other astmodel.Function, _ astmodel.EqualityOverrides) bool
- func (fn ResourceStatusSetterFunction) Name() string
- func (fn ResourceStatusSetterFunction) References() astmodel.TypeNameSet
- func (fn ResourceStatusSetterFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
- type StoragePropertyConversion
- type ValidationKind
- type ValidatorBuilder
Constants ¶
const ( ReceiverTypePtr = ReceiverType("ptr") ReceiverTypeStruct = ReceiverType("struct") )
const ( ValidationKindCreate = ValidationKind("Create") ValidationKindUpdate = ValidationKind("Update") ValidationKindDelete = ValidationKind("Delete") )
const ( ReadProperty = OriginalVersionKind("property") ReadFunction = OriginalVersionKind("function") )
const (
ExtendedResourcesFunctionName = "GetExtendedResources"
)
const JSONMarshalFunctionName string = "MarshalJSON"
const JSONUnmarshalFunctionName string = "UnmarshalJSON"
Variables ¶
var GetAPIVersionFunctionName = "Get" + astmodel.APIVersionProperty
Functions ¶
func GetConditionsFunction ¶
func GetConditionsFunction( k *ResourceFunction, codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.TypeName, methodName string, ) (*dst.FuncDecl, error)
GetConditionsFunction returns a function declaration containing the implementation of the GetConditions() function.
func (r *<receiver>) GetConditions() genruntime.Conditions { return r.Status.Conditions }
func NewGetAPIVersionFunction ¶
func NewGetAPIVersionFunction( apiVersionTypeName astmodel.TypeName, apiVersionEnumValue astmodel.EnumValue, idFactory astmodel.IdentifierFactory, ) astmodel.Function
NewGetAPIVersionFunction returns a function that returns a static API Version enum value ('APIVersion_Value')
func NewGetTypeFunction ¶
func NewGetTypeFunction( armType string, idFactory astmodel.IdentifierFactory, receiverType ReceiverType, ) astmodel.Function
NewGetTypeFunction returns a function "GetType" that returns a static string value for the ResourceType of a resource
func NewHubFunction ¶
func NewHubFunction(idFactory astmodel.IdentifierFactory) astmodel.Function
NewHubFunction creates an empty Hub() function that satisfies the Hub interface required by the controller See https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/conversion#Hub
func NewInitializeSpecFunction ¶
func NewInitializeSpecFunction( def astmodel.TypeDefinition, specInitializeFunction string, idFactory astmodel.IdentifierFactory, ) (astmodel.Function, error)
NewInitializeSpecFunction creates a function that initializes a resource's spec from its status. Used as a part of implementing the ImportableResource interface. def is the resource definition that we're generating the function for. specInitializeFunction is the name of the function on the spec that initializes it from the status. idFactory is used to create identifiers for the function.
func NewLocatableResource ¶
func NewLocatableResource( idFactory astmodel.IdentifierFactory, resourceType *astmodel.ResourceType, ) *astmodel.InterfaceImplementation
func NewNewEmptyARMValueFunc ¶
func NewNewEmptyARMValueFunc( armType astmodel.TypeName, idFactory astmodel.IdentifierFactory, ) astmodel.Function
NewNewEmptyARMValueFunc returns a function that creates an empty value suitable for using with PopulateFromARM. It should be equivalent to ConvertToARM("") on a default struct value.
func SetConditionsFunction ¶
func SetConditionsFunction( k *ResourceFunction, codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.TypeName, methodName string, ) (*dst.FuncDecl, error)
SetConditionsFunction returns a function declaration containing the implementation of the SetConditions() function.
func (r *<receiver>) SetConditions(conditions genruntime.Conditions) { r.Status.Conditions = conditions }
Types ¶
type ChainedConversionFunction ¶
type ChainedConversionFunction struct {
// contains filtered or unexported fields
}
ChainedConversionFunction implements conversions to/from another type that implements a conversion function
We use this for Spec types, implementing genruntime.ConvertibleSpec, and for Status types, implementing genruntime.ConvertibleStatus
Existing PropertyAssignment functions are used to implement stepwise conversion.
For most types, we check to see if the type we're passed is one we can convert directly. If it is, we use the preexisting AssignProperties*() method. Otherwise, we chain to that type to do the conversion to an intermediate instance and then convert using that.
func (r <receiver>) ConvertFrom(instance <interfaceType>) error { source, ok := instance.(*<otherType>) if !ok { // Need indirect conversion source = &<otherType>{} source.ConvertFrom(instance) } return r.AssignPropertiesFrom(source) }
func NewSpecChainedConversionFunction ¶
func NewSpecChainedConversionFunction( propertyFunction *PropertyAssignmentFunction, idFactory astmodel.IdentifierFactory, ) *ChainedConversionFunction
NewSpecChainedConversionFunction creates a chained conversion function that converts between two Spec types implementing the interface genruntime.ConvertibleSpec, using the provided property assignment function as a basis. hubType is the TypeName of our hub type propertyFunction is the function we will call to copy properties across between specs idFactory is an identifier factory to use for generating local identifiers
func NewStatusChainedConversionFunction ¶
func NewStatusChainedConversionFunction( propertyFunction *PropertyAssignmentFunction, idFactory astmodel.IdentifierFactory, ) *ChainedConversionFunction
NewStatusChainedConversionFunction creates a chained conversion function that converts between two Status types implementing the interface genruntime.ConvertibleStatus, using the provided property assignment function as a basis. hubType is the TypeName of our hub type propertyFunction is the function we will call to copy properties across between specs idFactory is an identifier factory to use for generating local identifiers
func (*ChainedConversionFunction) AsFunc ¶
func (fn *ChainedConversionFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
func (*ChainedConversionFunction) Equals ¶
func (fn *ChainedConversionFunction) Equals(otherFn astmodel.Function, override astmodel.EqualityOverrides) bool
func (*ChainedConversionFunction) Name ¶
func (fn *ChainedConversionFunction) Name() string
func (*ChainedConversionFunction) References ¶
func (fn *ChainedConversionFunction) References() astmodel.TypeNameSet
func (*ChainedConversionFunction) RequiredPackageReferences ¶
func (fn *ChainedConversionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
type DefaulterBuilder ¶
type DefaulterBuilder struct {
// contains filtered or unexported fields
}
DefaulterBuilder helps in building an interface implementation for admissions.Defaulter.
func NewDefaulterBuilder ¶
func NewDefaulterBuilder( resourceName astmodel.InternalTypeName, resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory, ) *DefaulterBuilder
NewDefaulterBuilder creates a new DefaulterBuilder for the given object type.
func (*DefaulterBuilder) AddDefault ¶
func (d *DefaulterBuilder) AddDefault(f *ResourceFunction)
AddDefault adds a default function to the set of default functions to be applied to the given object
func (*DefaulterBuilder) ToInterfaceImplementation ¶
func (d *DefaulterBuilder) ToInterfaceImplementation() *astmodel.InterfaceImplementation
ToInterfaceImplementation creates an InterfaceImplementation that implements the admissions.Defaulter interface. This implementation includes calls to all defaults registered with this DefaulterBuilder via the AddDefault function, as well as helper functions that allow additional handcrafted defaults to be injected by implementing the genruntime.Defaulter interface.
type GetExtendedResourcesFunction ¶
type GetExtendedResourcesFunction struct {
// contains filtered or unexported fields
}
func NewGetExtendedResourcesFunction ¶
func NewGetExtendedResourcesFunction( idFactory astmodel.IdentifierFactory, resources []astmodel.InternalTypeName, ) *GetExtendedResourcesFunction
NewGetExtendedResourcesFunction creates a new GetExtendedResources
func (*GetExtendedResourcesFunction) AsFunc ¶
func (ext *GetExtendedResourcesFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc returns the generated code for the GetExtendedResources() function
func (*GetExtendedResourcesFunction) Equals ¶
func (ext *GetExtendedResourcesFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
Equals returns true if the passed function is equal to us, or false otherwise
func (*GetExtendedResourcesFunction) Name ¶
func (ext *GetExtendedResourcesFunction) Name() string
Name returns the name of this function, which is always GetExtendedResources()
func (*GetExtendedResourcesFunction) References ¶
func (ext *GetExtendedResourcesFunction) References() astmodel.TypeNameSet
References shows that GetExtendedResources() references other generated types
func (*GetExtendedResourcesFunction) RequiredPackageReferences ¶
func (ext *GetExtendedResourcesFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of packages required by GetExtendedResources()
type IndexRegistrationFunction ¶
type IndexRegistrationFunction struct {
// contains filtered or unexported fields
}
IndexRegistrationFunction is a function for registering an index for a given property chain. The leaf of the property chain is expected to implement the genruntime.Indexer interface
func NewIndexRegistrationFunction ¶
func NewIndexRegistrationFunction( idFactory astmodel.IdentifierFactory, name string, resourceTypeName astmodel.InternalTypeName, indexKey string, propertyChain []*astmodel.PropertyDefinition, ) *IndexRegistrationFunction
NewIndexRegistrationFunction returns a new index registration function
func (*IndexRegistrationFunction) AsFunc ¶
func (f *IndexRegistrationFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, _ astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc returns the function as a go dst
func (*IndexRegistrationFunction) Equals ¶
func (f *IndexRegistrationFunction) Equals(other astmodel.Function, overrides astmodel.EqualityOverrides) bool
Equals determines if this function is equal to the passed in function
func (*IndexRegistrationFunction) IndexKey ¶
func (f *IndexRegistrationFunction) IndexKey() string
IndexKey returns the index key used in the index function
func (*IndexRegistrationFunction) Name ¶
func (f *IndexRegistrationFunction) Name() string
func (*IndexRegistrationFunction) References ¶
func (f *IndexRegistrationFunction) References() astmodel.TypeNameSet
References returns the set of types to which this function refers. SHOULD include any types which this function references but its receiver doesn't. SHOULD NOT include the receiver of this function.
func (*IndexRegistrationFunction) RequiredPackageReferences ¶
func (f *IndexRegistrationFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns a set of references to packages required by this
type KubernetesExporterBuilder ¶
type KubernetesExporterBuilder struct {
// contains filtered or unexported fields
}
KubernetesExporterBuilder is a builder for creating genruntime.KubernetesExporter interface implementations.
func NewKubernetesExporterBuilder ¶
func NewKubernetesExporterBuilder( resourceName astmodel.TypeName, resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory, mappings map[string][]*astmodel.PropertyDefinition, ) *KubernetesExporterBuilder
NewKubernetesExporterBuilder creates a new KubernetesExporterBuilder for the specified resource
func (*KubernetesExporterBuilder) ToInterfaceImplementation ¶
func (d *KubernetesExporterBuilder) ToInterfaceImplementation() *astmodel.InterfaceImplementation
ToInterfaceImplementation creates an InterfaceImplementation from the KubernetesExporterBuilder
type ObjectFunction ¶
type ObjectFunction struct {
// contains filtered or unexported fields
}
ObjectFunction is a simple helper that implements the Function interface. It is intended for use for functions that only need information about the object they are operating on
func NewEmptyStatusFunction ¶
func NewEmptyStatusFunction( status astmodel.TypeName, idFactory astmodel.IdentifierFactory, ) *ObjectFunction
NewEmptyStatusFunction creates a new function to generate NewEmptyStatus() on resource types
func NewGetSpecFunction ¶
func NewGetSpecFunction(idFactory astmodel.IdentifierFactory) *ObjectFunction
NewGetSpecFunction returns a new function to GetSpec() on resource types
func NewGetStatusFunction ¶
func NewGetStatusFunction(idFactory astmodel.IdentifierFactory) *ObjectFunction
NewGetStatusFunction returns a function to generate GetStatus() on resource types
func NewObjectFunction ¶
func NewObjectFunction( name string, idFactory astmodel.IdentifierFactory, asFunc ObjectFunctionHandler, ) *ObjectFunction
NewObjectFunction creates a new object function
func (*ObjectFunction) AddPackageReference ¶
func (fn *ObjectFunction) AddPackageReference(refs ...astmodel.PackageReference)
AddPackageReference adds one or more required package references
func (*ObjectFunction) AddReferencedTypes ¶
func (fn *ObjectFunction) AddReferencedTypes(types ...astmodel.TypeName)
AddReferencedTypes adds one or more types that are required Their packages are automatically included as well.
func (*ObjectFunction) AsFunc ¶
func (fn *ObjectFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc renders the current instance as a Go abstract syntax tree
func (*ObjectFunction) Equals ¶
func (fn *ObjectFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
Equals checks if this function is equal to the passed in function
func (*ObjectFunction) IdFactory ¶
func (fn *ObjectFunction) IdFactory() astmodel.IdentifierFactory
func (*ObjectFunction) Name ¶
func (fn *ObjectFunction) Name() string
Name returns the unique name of this function (You can't have two functions with the same name on the same object or resource)
func (*ObjectFunction) References ¶
func (fn *ObjectFunction) References() astmodel.TypeNameSet
References returns the set of types to which this function refers. SHOULD include any types which this function references but its receiver doesn't. SHOULD NOT include the receiver of this function.
func (*ObjectFunction) RequiredPackageReferences ¶
func (fn *ObjectFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of required packages for this function
type ObjectFunctionHandler ¶
type ObjectFunctionHandler func( f *ObjectFunction, codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.TypeName, methodName string, ) (*dst.FuncDecl, error)
type OneOfJSONMarshalFunction ¶
type OneOfJSONMarshalFunction struct {
// contains filtered or unexported fields
}
OneOfJSONMarshalFunction is a function for marshalling discriminated unions (types with only mutually exclusive properties) to JSON
func NewOneOfJSONMarshalFunction ¶
func NewOneOfJSONMarshalFunction(oneOfObject *astmodel.ObjectType, idFactory astmodel.IdentifierFactory) *OneOfJSONMarshalFunction
NewOneOfJSONMarshalFunction creates a new OneOfJSONMarshalFunction struct
func (*OneOfJSONMarshalFunction) AsFunc ¶
func (f *OneOfJSONMarshalFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc returns the function as a go dst
func (*OneOfJSONMarshalFunction) Equals ¶
func (f *OneOfJSONMarshalFunction) Equals(other astmodel.Function, overrides astmodel.EqualityOverrides) bool
Equals determines if this function is equal to the passed in function
func (*OneOfJSONMarshalFunction) Name ¶
func (f *OneOfJSONMarshalFunction) Name() string
func (*OneOfJSONMarshalFunction) References ¶
func (f *OneOfJSONMarshalFunction) References() astmodel.TypeNameSet
References returns the set of types to which this function refers. SHOULD include any types which this function references but its receiver doesn't. SHOULD NOT include the receiver of this function.
func (*OneOfJSONMarshalFunction) RequiredPackageReferences ¶
func (f *OneOfJSONMarshalFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns a set of references to packages required by this
type OneOfJSONUnmarshalFunction ¶
type OneOfJSONUnmarshalFunction struct {
// contains filtered or unexported fields
}
OneOfJSONUnmarshalFunction is a function for unmarshalling discriminated unions (types with only mutually exclusive properties) from JSON
func NewOneOfJSONUnmarshalFunction ¶
func NewOneOfJSONUnmarshalFunction(oneOfObject *astmodel.ObjectType, idFactory astmodel.IdentifierFactory) *OneOfJSONUnmarshalFunction
NewOneOfJSONUnmarshalFunction creates a new OneOfJSONUnmarshalFunction struct
func (*OneOfJSONUnmarshalFunction) AsFunc ¶
func (f *OneOfJSONUnmarshalFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc returns the function as a go dst
func (*OneOfJSONUnmarshalFunction) Equals ¶
func (f *OneOfJSONUnmarshalFunction) Equals(other astmodel.Function, overrides astmodel.EqualityOverrides) bool
Equals determines if this function is equal to the passed in function
func (*OneOfJSONUnmarshalFunction) Name ¶
func (f *OneOfJSONUnmarshalFunction) Name() string
func (*OneOfJSONUnmarshalFunction) References ¶
func (f *OneOfJSONUnmarshalFunction) References() astmodel.TypeNameSet
References returns the set of types to which this function refers. SHOULD include any types which this function references but its receiver doesn't. SHOULD NOT include the receiver of this function.
func (*OneOfJSONUnmarshalFunction) RequiredPackageReferences ¶
func (f *OneOfJSONUnmarshalFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns a set of references to packages required by this
type OriginalGVKFunction ¶
type OriginalGVKFunction struct {
// contains filtered or unexported fields
}
OriginalGVKFunction implements a function to return the GVK for the type on which it is called We put these on our resource types, giving us a way to obtain the right type of instance when the reconciler is working with ARM. The code differs slightly depending on whether we're injecting into an API or storage variant.
func (resource *SomeResource) OriginalGVK() scheme.GroupVersionKind { return scheme.GroupVersionKind{ Group: GroupVersion.Group, Version: resource.Spec.OriginalVersion, Kind: "SomeResource", } }
func NewOriginalGVKFunction ¶
func NewOriginalGVKFunction(originalVersion OriginalVersionKind, idFactory astmodel.IdentifierFactory) *OriginalGVKFunction
NewOriginalGVKFunction creates a new OriginalGVKFunction
func (*OriginalGVKFunction) AsFunc ¶
func (o *OriginalGVKFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc returns the generated code for the OriginalGVK() function
func (*OriginalGVKFunction) Equals ¶
func (o *OriginalGVKFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
Equals returns true if the passed function is equal to us, or false otherwise
func (*OriginalGVKFunction) Name ¶
func (o *OriginalGVKFunction) Name() string
Name returns the name of this function, which is always OriginalGVK()
func (*OriginalGVKFunction) References ¶
func (o *OriginalGVKFunction) References() astmodel.TypeNameSet
References shows that OriginalGVK() references no other generated types
func (*OriginalGVKFunction) RequiredPackageReferences ¶
func (o *OriginalGVKFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of packages required by OriginalGVK()
type OriginalVersionFunction ¶
type OriginalVersionFunction struct {
// contains filtered or unexported fields
}
OriginalVersionFunction implements a function to return the version for the type on which it is called We put these on the *API* versions of our spec types, giving us a way to obtain the right type of instance when the reconciler is working with ARM.
func (spec *SomeSpec) OriginalVersion() string { return GroupVersion.Version }
func NewOriginalVersionFunction ¶
func NewOriginalVersionFunction(idFactory astmodel.IdentifierFactory) *OriginalVersionFunction
NewOriginalVersionFunction creates a new OriginalVersionFunction
func (*OriginalVersionFunction) AsFunc ¶
func (o *OriginalVersionFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc returns the generated code for the OriginalVersion() function
func (*OriginalVersionFunction) Equals ¶
func (o *OriginalVersionFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
Equals returns true if the passed function is equal to us, or false otherwise
func (*OriginalVersionFunction) Name ¶
func (o *OriginalVersionFunction) Name() string
Name returns the name of this function, which is always OriginalVersion()
func (*OriginalVersionFunction) References ¶
func (o *OriginalVersionFunction) References() astmodel.TypeNameSet
References shows that OriginalVersion() references no other generated types
func (*OriginalVersionFunction) RequiredPackageReferences ¶
func (o *OriginalVersionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of packages required by OriginalVersion()
func (*OriginalVersionFunction) ReturnType ¶
func (o *OriginalVersionFunction) ReturnType() astmodel.Type
ReturnType indicates that this function returns a string
type OriginalVersionKind ¶
type OriginalVersionKind string
type PivotConversionFunction ¶
type PivotConversionFunction struct {
// contains filtered or unexported fields
}
PivotConversionFunction implements a pivot that's used when a conversion reaches a hub type but hasn't yet found the innermost required conversion needed.
We use this for Spec types, implementing genruntime.ConvertibleSpec, and for Status types, implementing genruntime.ConvertibleStatus.
If the two instances involved in conversion are not in the same "spoke" leading to this "hub" version, we'll pivot to the reverse conversion, starting at the far end of that "spoke":
func (s <hubtype>) ConvertFrom(instance <interfaceType>>) error { return instance.ConvertTo(s) }
The pivot is needed when following the package references from resource version to resource version won't lead us to encounter the other type that's involved in the conversion, as we can see if we're trying to convert between v1 and v2:
################## ################# +---------------+ # v1 # # v2 # | v3 | # Person # # Person # | Person | ################## ################# +---------------+ | | | v v v +----------------+ +---------------+ +---------------+ | v1storage | | v2storage | | v3storage | | Person |----------------->| Person |----------------->| Person | +----------------+ +---------------+ +---------------+
Following package references from v1 leads us, in turn, to v1storage, v2storage, and finally v3storage (our hub version), none of is the version we need to terminate the conversion path.
By having a pivot conversion on v3, we can restart the conversion path with v2.
The entire conversion works as follows:
v1.Person.ConvertTo(v2.Person) --> v1storage.Person.ConvertTo(v2.Person)
--> v2storage.Person.ConvertTo(v2.Person) --> v3storage.Person.ConvertTo(v2.Person) // Pivot! --> v2.Person.ConvertFrom(v3storage.Person) // Change of direction --> v2storage.Person.ConvertFrom(v3storage.Person)
Note that conversions like this always pivot through the hub version.
func NewSpecPivotConversionFunction ¶
func NewSpecPivotConversionFunction( direction conversions.Direction, idFactory astmodel.IdentifierFactory, ) *PivotConversionFunction
NewSpecPivotConversionFunction creates a pivot conversion function that works to convert between two Spec types implementing the interface genruntime.ConvertibleSpec. direction is the direction of our conversion idFactory is an identifier factory to use for generating local identifiers
func NewStatusPivotConversionFunction ¶
func NewStatusPivotConversionFunction( direction conversions.Direction, idFactory astmodel.IdentifierFactory, ) *PivotConversionFunction
NewStatusPivotConversionFunction creates a pivot conversion function that works to convert between two Status types implementing the interface genruntime.ConvertibleStatus. direction is the direction of our conversion idFactory is an identifier factory to use for generating local identifiers
func (*PivotConversionFunction) AsFunc ¶
func (fn *PivotConversionFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
func (*PivotConversionFunction) Equals ¶
func (fn *PivotConversionFunction) Equals(otherFn astmodel.Function, _ astmodel.EqualityOverrides) bool
func (*PivotConversionFunction) Name ¶
func (fn *PivotConversionFunction) Name() string
func (*PivotConversionFunction) References ¶
func (fn *PivotConversionFunction) References() astmodel.TypeNameSet
func (*PivotConversionFunction) RequiredPackageReferences ¶
func (fn *PivotConversionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
type PropertyAssignmentFunction ¶
type PropertyAssignmentFunction struct {
// contains filtered or unexported fields
}
PropertyAssignmentFunction represents a function that assigns all the properties from one resource or object to another. Used to perform a single step of the conversions required to/from the hub version, or to convert from status to spec.
func (*PropertyAssignmentFunction) AsFunc ¶
func (fn *PropertyAssignmentFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc renders this function as an AST for serialization to a Go source file
func (*PropertyAssignmentFunction) Direction ¶
func (fn *PropertyAssignmentFunction) Direction() conversions.Direction
Direction returns this functions direction of conversion
func (*PropertyAssignmentFunction) Equals ¶
func (fn *PropertyAssignmentFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
Equals checks to see if the supplied function is the same as this one
func (*PropertyAssignmentFunction) Name ¶
func (fn *PropertyAssignmentFunction) Name() string
Name returns the name of this function
func (*PropertyAssignmentFunction) ParameterType ¶
func (fn *PropertyAssignmentFunction) ParameterType() astmodel.TypeName
func (*PropertyAssignmentFunction) References ¶
func (fn *PropertyAssignmentFunction) References() astmodel.TypeNameSet
References returns the set of types referenced by this function
func (*PropertyAssignmentFunction) RequiredPackageReferences ¶
func (fn *PropertyAssignmentFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of package references required by this function
type PropertyAssignmentFunctionBuilder ¶
type PropertyAssignmentFunctionBuilder struct {
// contains filtered or unexported fields
}
PropertyAssignmentFunctionBuilder is a factory used to construct a PropertyAssignmentFunction.
func NewPropertyAssignmentFunctionBuilder ¶
func NewPropertyAssignmentFunctionBuilder( receiver astmodel.TypeDefinition, otherDefinition astmodel.TypeDefinition, direction conversions.Direction, ) *PropertyAssignmentFunctionBuilder
NewPropertyAssignmentFunctionBuilder creates a new factory for construction of a PropertyAssignmentFunction. receiver is the type definition that will be the receiver for this function otherDefinition is the type definition to convert TO or FROM direction specifies whether we are converting TO or FROM the other definition
func (*PropertyAssignmentFunctionBuilder) AddAssignmentSelector ¶
func (builder *PropertyAssignmentFunctionBuilder) AddAssignmentSelector(selector PropertyAssignmentSelector)
AddAssignmentSelector adds a new assignment selector to the list of assignment selectors. Assignment selectors are executed in the order they are added.
func (*PropertyAssignmentFunctionBuilder) AddSuffixMatchingAssignmentSelector ¶
func (builder *PropertyAssignmentFunctionBuilder) AddSuffixMatchingAssignmentSelector( sourceSuffix string, destinationSuffix string, )
AddSuffixMatchingAssignmentSelector adds a new assignment selector that will match a property with the specified sourceSuffix to a property with the specified destinationSuffix.
func (*PropertyAssignmentFunctionBuilder) Build ¶
func (builder *PropertyAssignmentFunctionBuilder) Build( conversionContext *conversions.PropertyConversionContext, ) (*PropertyAssignmentFunction, error)
func (*PropertyAssignmentFunctionBuilder) UseAugmentationInterface ¶
func (builder *PropertyAssignmentFunctionBuilder) UseAugmentationInterface(augmentation astmodel.TypeName)
UseAugmentationInterface returns the property assignment function with a conversion augmentation interface set
type PropertyAssignmentSelector ¶
type PropertyAssignmentSelector func( sourceProperties conversions.ReadableConversionEndpointSet, destinationProperties conversions.WritableConversionEndpointSet, assign func(reader *conversions.ReadableConversionEndpoint, writer *conversions.WritableConversionEndpoint) error, conversionContext *conversions.PropertyConversionContext, ) error
PropertyAssignmentSelector is a function that selects pairs of endpoints to create property assignments sourceProperties is the set of readable property endpoints. destinationProperties is the set of writable property endpoints. assign is a callback function used to assign a value from the source to the destination returns an error if there was a problem selecting a property, nil otherwise
type PureFunction ¶
type PureFunction struct {
// contains filtered or unexported fields
}
StandaloneFunction is a simple helper that implements the Function interface. It is intended for use for pure functions
func NewPureFunction ¶
func NewPureFunction( name string, idFactory astmodel.IdentifierFactory, asFunc PureFunctionHandler, ) *PureFunction
NewPureFunction creates a new pure function
func (*PureFunction) AddPackageReference ¶
func (fn *PureFunction) AddPackageReference(refs ...astmodel.PackageReference)
AddPackageReference adds one or more required package references
func (*PureFunction) AddReferencedTypes ¶
func (fn *PureFunction) AddReferencedTypes(types ...astmodel.TypeName)
AddReferencedTypes adds one or more types that are required Their packages are automatically included as well.
func (*PureFunction) AsFunc ¶
func (fn *PureFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, _ astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc renders the current instance as a Go abstract syntax tree
func (*PureFunction) Equals ¶
func (fn *PureFunction) Equals(f astmodel.Function, _ astmodel.EqualityOverrides) bool
Equals checks if this function is equal to the passed in function
func (*PureFunction) IdFactory ¶
func (fn *PureFunction) IdFactory() astmodel.IdentifierFactory
func (*PureFunction) Name ¶
func (fn *PureFunction) Name() string
Name returns the unique name of this function
func (*PureFunction) References ¶
func (fn *PureFunction) References() astmodel.TypeNameSet
References returns the set of types to which this function refers. SHOULD include any types which this function references but its receiver doesn't. SHOULD NOT include the receiver of this function.
func (*PureFunction) RequiredPackageReferences ¶
func (fn *PureFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of required packages for this function
type PureFunctionHandler ¶
type PureFunctionHandler func(f *PureFunction, codeGenerationContext *astmodel.CodeGenerationContext, methodName string) *dst.FuncDecl
type ReceiverType ¶
type ReceiverType string
type ResourceConversionFunction ¶
type ResourceConversionFunction struct {
// contains filtered or unexported fields
}
ResourceConversionFunction implements conversions to/from our hub type Existing PropertyAssignment functions are used to implement stepwise conversion
Direct conversion from the hub type:
func (<receiver> <receiverType>) Convert<From|To>(hub conversion.Hub) error { source, ok := hub.(*<hub.Type>) if !ok { return fmt.Errorf("expected <hub.Type> but received %T instead", hub) } return <receiver>.AssignProperties<From|To><Type>(source) }
Indirect conversion, multiple steps via an intermediate instance
func (r <receiver>) Convert<From|To>(hub conversion.Hub) error { var source <vNext> err := source.Convert<From|To>(hub) if err != nil { return errors.Wrap(err, "converting from hub to source") } err = <receiver>.AssignProperties<From|To><Type>(&source) if err != nil { return errors.Wrap(err, "converting from source to <type>") } return nil }
func NewResourceConversionFunction ¶
func NewResourceConversionFunction( hub astmodel.InternalTypeName, propertyFunction *PropertyAssignmentFunction, idFactory astmodel.IdentifierFactory, ) *ResourceConversionFunction
NewResourceConversionFunction creates a conversion function that populates our hub type from the current instance hub is the TypeName of our hub type propertyFunction is the function we use to copy properties across
func (*ResourceConversionFunction) AsFunc ¶
func (fn *ResourceConversionFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
func (*ResourceConversionFunction) Direction ¶
func (fn *ResourceConversionFunction) Direction() conversions.Direction
Direction returns this functions direction of conversion
func (*ResourceConversionFunction) Equals ¶
func (fn *ResourceConversionFunction) Equals(otherFn astmodel.Function, override astmodel.EqualityOverrides) bool
func (*ResourceConversionFunction) Hub ¶
func (fn *ResourceConversionFunction) Hub() astmodel.TypeName
Hub returns the hub type we convert with
func (*ResourceConversionFunction) Name ¶
func (fn *ResourceConversionFunction) Name() string
func (*ResourceConversionFunction) References ¶
func (fn *ResourceConversionFunction) References() astmodel.TypeNameSet
func (*ResourceConversionFunction) RequiredPackageReferences ¶
func (fn *ResourceConversionFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
type ResourceFunction ¶
type ResourceFunction struct {
// contains filtered or unexported fields
}
ResourceFunction is a simple helper that implements the Function interface. It is intended for use for functions that only need information about the resource they are operating on
func NewDefaultAzureNameFunction ¶
func NewDefaultAzureNameFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
func NewResourceFunction ¶
func NewResourceFunction( name string, resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory, asFunc ResourceFunctionHandler, requiredPackages *astmodel.PackageReferenceSet, ) *ResourceFunction
NewResourceFunction creates a new resource function
func NewValidateOptionalConfigMapReferenceFunction ¶
func NewValidateOptionalConfigMapReferenceFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
func NewValidateOwnerReferenceFunction ¶
func NewValidateOwnerReferenceFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
func NewValidateResourceReferencesFunction ¶
func NewValidateResourceReferencesFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
func NewValidateWriteOncePropertiesFunction ¶
func NewValidateWriteOncePropertiesFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *ResourceFunction
func (*ResourceFunction) AsFunc ¶
func (fn *ResourceFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc renders the current instance as a Go abstract syntax tree
func (*ResourceFunction) Equals ¶
func (fn *ResourceFunction) Equals(f astmodel.Function, overrides astmodel.EqualityOverrides) bool
Equals determines if this Function is equal to another one
func (*ResourceFunction) IdFactory ¶
func (fn *ResourceFunction) IdFactory() astmodel.IdentifierFactory
func (*ResourceFunction) Name ¶
func (fn *ResourceFunction) Name() string
Name returns the unique name of this function (You can't have two functions with the same name on the same object or resource)
func (*ResourceFunction) References ¶
func (fn *ResourceFunction) References() astmodel.TypeNameSet
References returns the set of types to which this function refers. SHOULD include any types which this function references but its receiver doesn't. SHOULD NOT include the receiver of this function.
func (*ResourceFunction) RequiredPackageReferences ¶
func (fn *ResourceFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of required packages for this function
func (*ResourceFunction) Resource ¶
func (fn *ResourceFunction) Resource() *astmodel.ResourceType
Resource returns the resource this function applies to
type ResourceFunctionHandler ¶
type ResourceFunctionHandler func( f *ResourceFunction, codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.TypeName, methodName string, ) (*dst.FuncDecl, error)
type ResourceStatusSetterFunction ¶
type ResourceStatusSetterFunction struct {
// contains filtered or unexported fields
}
ResourceStatusSetterFunction is a function that sets the status on a resource
func NewResourceStatusSetterFunction ¶
func NewResourceStatusSetterFunction( resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory, ) *ResourceStatusSetterFunction
NewResourceStatusSetterFunction creates a new ResourceStatusSetterFunction resource is the resource type that will host the function idFactory is an IdentifierFactory for creating local variable names
func (ResourceStatusSetterFunction) AsFunc ¶
func (fn ResourceStatusSetterFunction) AsFunc( codeGenerationContext *astmodel.CodeGenerationContext, receiver astmodel.InternalTypeName, ) (*dst.FuncDecl, error)
AsFunc generates the required function declaration
func (ResourceStatusSetterFunction) Equals ¶
func (fn ResourceStatusSetterFunction) Equals(other astmodel.Function, _ astmodel.EqualityOverrides) bool
Equals returns true if the passed function is equal
func (ResourceStatusSetterFunction) Name ¶
func (fn ResourceStatusSetterFunction) Name() string
Name returns the unique name of this function
func (ResourceStatusSetterFunction) References ¶
func (fn ResourceStatusSetterFunction) References() astmodel.TypeNameSet
References returns the set of other types required by this function
func (ResourceStatusSetterFunction) RequiredPackageReferences ¶
func (fn ResourceStatusSetterFunction) RequiredPackageReferences() *astmodel.PackageReferenceSet
RequiredPackageReferences returns the set of package references required by this function
type StoragePropertyConversion ¶
type StoragePropertyConversion func( source dst.Expr, destination dst.Expr, knownLocals *astmodel.KnownLocalsSet, generationContext *astmodel.CodeGenerationContext) ([]dst.Stmt, error)
StoragePropertyConversion represents a function that generates the correct AST to convert a single property value Different functions will be used, depending on the types of the properties to be converted. source is an expression that returns the source we are converting from (a Resource or other Object) destination is an expression that returns the destination we are converting to (again, a Resource or other Object) The function returns a sequence of statements to carry out the stated conversion/copy
type ValidationKind ¶
type ValidationKind string
ValidationKind determines when a particular validation should be run
type ValidatorBuilder ¶
type ValidatorBuilder struct {
// contains filtered or unexported fields
}
ValidatorBuilder helps in building an interface implementation for admissions.Validator.
func NewValidatorBuilder ¶
func NewValidatorBuilder( resourceName astmodel.InternalTypeName, resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory, ) *ValidatorBuilder
NewValidatorBuilder creates a new ValidatorBuilder for the given object type.
func (*ValidatorBuilder) AddValidation ¶
func (v *ValidatorBuilder) AddValidation(kind ValidationKind, f *ResourceFunction)
AddValidation adds a validation function to the set of validation functions to be applied to the given object.
func (*ValidatorBuilder) ToInterfaceImplementation ¶
func (v *ValidatorBuilder) ToInterfaceImplementation() *astmodel.InterfaceImplementation
ToInterfaceImplementation creates an InterfaceImplementation that implements the admissions.Validator interface. This implementation includes calls to all validations registered with this ValidatorBuilder via the AddValidation function, as well as helper functions that allow additional handcrafted validations to be injected by implementing the genruntime.Validator interface.
Source Files ¶
- chained_conversion_function.go
- common.go
- conditions_functions.go
- empty_status_function.go
- get_extended_resources_function.go
- get_resource_apiversion_function.go
- get_resource_type_function.go
- get_spec_function.go
- get_status_function.go
- hub_function.go
- index_registration_function.go
- initialize_spec_function.go
- kubernetes_admissions_defaulter.go
- kubernetes_admissions_defaults.go
- kubernetes_admissions_validations.go
- kubernetes_admissions_validator.go
- kubernetes_exporter_function.go
- locatable_resource_function.go
- new_empty_arm_value_function.go
- object_function.go
- one_of_json_marshal_function.go
- one_of_json_unmarshal_function.go
- original_gvk_function.go
- original_version_function.go
- pivot_conversion_function.go
- property_assignment_function.go
- property_assignment_function_builder.go
- pure_function.go
- resource_conversion_function.go
- resource_function.go
- resource_status_setter_function.go