Documentation ¶
Index ¶
- Constants
- Variables
- func CreatePackagesForDefinitions(definitions astmodel.TypeDefinitionSet) (map[astmodel.InternalPackageReference]*astmodel.PackageDefinition, error)
- func DoesPropertyLookLikeARMReference(prop *astmodel.PropertyDefinition) bool
- func GetStateData[I any](state *State, key StateDataKey) (I, error)
- func LookupARMTypeDefinition(name astmodel.InternalTypeName, defs astmodel.TypeDefinitionSet) (astmodel.TypeDefinition, bool)
- func MarkLatestResourceVersionsForStorage(definitions astmodel.TypeDefinitionSet) (astmodel.TypeDefinitionSet, error)
- func NewConditionerInterfaceImpl(idFactory astmodel.IdentifierFactory, resource *astmodel.ResourceType) (*astmodel.InterfaceImplementation, error)
- func NewValidateConfigMapDestinationsFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *functions.ResourceFunction
- func NewValidateSecretDestinationsFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *functions.ResourceFunction
- func StripUnusedDefinitions(roots astmodel.TypeNameSet, defs astmodel.TypeDefinitionSet) (astmodel.TypeDefinitionSet, error)
- type ARMIDPropertyClassification
- type ARMIDPropertyTypeVisitor
- type ARMIDToGenruntimeReferenceTypeVisitor
- type DebugSettings
- type DiagnosticAction
- type ExportedProperties
- type ExportedTypeNameProperties
- type PackagesMatrixReport
- func (report *PackagesMatrixReport) ServiceName(ref astmodel.InternalPackageReference) string
- func (report *PackagesMatrixReport) Summarize(definitions astmodel.TypeDefinitionSet)
- func (report *PackagesMatrixReport) WriteTableTo(table *reporting.SparseTable, pkg string, outputPath string) error
- func (report *PackagesMatrixReport) WriteTo(outputPath string) error
- type PipelineDiagram
- type ResourceRegistrationFile
- type ResourceStructureReport
- type ResourceVersionsReport
- func (report *ResourceVersionsReport) FindSampleLinks(group string) (map[string]string, error)
- func (report *ResourceVersionsReport) SaveAllResourcesReportTo(outputFile string) error
- func (report *ResourceVersionsReport) SaveGroupResourcesReportTo(group string, outputFile string) error
- func (report *ResourceVersionsReport) WriteAllResourcesReportToBuffer(frontMatter string, buffer *strings.Builder) error
- func (report *ResourceVersionsReport) WriteGroupResourcesReportToBuffer(group string, frontMatter string, buffer *strings.Builder) error
- type ResourceVersionsReportGroupInfo
- type ResourceVersionsReportResourceItem
- type Stage
- func AddAPIVersionEnums() *Stage
- func AddConfigMaps(config *config.Configuration) *Stage
- func AddCrossplaneAtProvider(idFactory astmodel.IdentifierFactory) *Stage
- func AddCrossplaneEmbeddedResourceSpec(idFactory astmodel.IdentifierFactory) *Stage
- func AddCrossplaneEmbeddedResourceStatus(idFactory astmodel.IdentifierFactory) *Stage
- func AddCrossplaneForProvider(idFactory astmodel.IdentifierFactory) *Stage
- func AddCrossplaneOwnerProperties(idFactory astmodel.IdentifierFactory) *Stage
- func AddKubernetesExporter(idFactory astmodel.IdentifierFactory) *Stage
- func AddLocatableInterface(idFactory astmodel.IdentifierFactory) *Stage
- func AddOperatorSpec(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
- func AddSecrets(config *config.Configuration) *Stage
- func AddSerializationTypeTag(configuration *config.Configuration) *Stage
- func AddStatusConditions(idFactory astmodel.IdentifierFactory) *Stage
- func ApplyARMConversionInterface(idFactory astmodel.IdentifierFactory, config *config.ObjectModelConfiguration) *Stage
- func ApplyCrossResourceReferencesFromConfig(configuration *config.Configuration, log logr.Logger) *Stage
- func ApplyDefaulterAndValidatorInterfaces(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
- func ApplyExportFilters(configuration *config.Configuration, log logr.Logger) *Stage
- func ApplyIsResourceOverrides(configuration *config.Configuration) *Stage
- func ApplyKubernetesResourceInterface(idFactory astmodel.IdentifierFactory, log logr.Logger) *Stage
- func ApplyTypeRewrites(config *config.Configuration, log logr.Logger) *Stage
- func AssembleOneOfTypes(idFactory astmodel.IdentifierFactory) *Stage
- func AssertTypesCollectionValid() *Stage
- func CatalogKnownResources() *Stage
- func CollapseCrossGroupReferences(idFactory astmodel.IdentifierFactory) *Stage
- func ConvertAllOfAndOneOfToObjects(idFactory astmodel.IdentifierFactory) *Stage
- func CreateARMTypes(configuration *config.ObjectModelConfiguration, ...) *Stage
- func CreateConversionGraph(configuration *config.Configuration, generatorPrefix string) *Stage
- func CreateResourceExtensions(localPath string, idFactory astmodel.IdentifierFactory) *Stage
- func CreateStorageTypes() *Stage
- func DeleteGeneratedCode(outputFolder string) *Stage
- func DetermineResourceOwnership(configuration *config.Configuration) *Stage
- func EnsureARMTypeExistsForEveryResource() *Stage
- func EnsureDefinitionsDoNotUseAnyTypes() *Stage
- func ExportControllerResourceRegistrations(idFactory astmodel.IdentifierFactory, outputPath string) *Stage
- func ExportPackages(outputPath string, emitDocFiles bool, log logr.Logger) *Stage
- func FilterOutDefinitionsUsingAnyType(packages []string) *Stage
- func FixIDFields() *Stage
- func FixOptionalCollectionAliases() *Stage
- func FlattenProperties(log logr.Logger) *Stage
- func FlattenResources() *Stage
- func HandleUserAssignedIdentities() *Stage
- func ImplementConvertibleInterface(idFactory astmodel.IdentifierFactory) *Stage
- func ImplementConvertibleSpecInterface(idFactory astmodel.IdentifierFactory) *Stage
- func ImplementConvertibleStatusInterface(idFactory astmodel.IdentifierFactory) *Stage
- func ImplementImportableResourceInterface(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
- func ImprovePropertyDescriptions() *Stage
- func InjectHubFunction(idFactory astmodel.IdentifierFactory) *Stage
- func InjectJsonSerializationTests(idFactory astmodel.IdentifierFactory) *Stage
- func InjectOriginalGVKFunction(idFactory astmodel.IdentifierFactory) *Stage
- func InjectOriginalVersionFunction(idFactory astmodel.IdentifierFactory) *Stage
- func InjectOriginalVersionProperty() *Stage
- func InjectPropertyAssignmentFunctions(configuration *config.Configuration, idFactory astmodel.IdentifierFactory, ...) *Stage
- func InjectPropertyAssignmentTests(idFactory astmodel.IdentifierFactory) *Stage
- func InjectResourceConversionTestCases(idFactory astmodel.IdentifierFactory) *Stage
- func InjectSpecInitializationFunctions(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
- func LoadTypes(idFactory astmodel.IdentifierFactory, config *config.Configuration, ...) *Stage
- func MakeOneOfDiscriminantRequired() *Stage
- func MakeStatusPropertiesOptional() *Stage
- func MarkLatestAPIVersionAsStorageVersion() *Stage
- func MarkLatestStorageVariantAsHubVersion() *Stage
- func NameTypesForCRD(idFactory astmodel.IdentifierFactory) *Stage
- func NewLegacyStage(id string, description string, ...) *Stage
- func NewStage(id string, description string, ...) *Stage
- func PruneResourcesWithLifecycleOwnedByParent(configuration *config.Configuration) *Stage
- func RemoveEmbeddedResources(configuration *config.Configuration, log logr.Logger) *Stage
- func RemoveEmptyObjects(log logr.Logger) *Stage
- func RemoveStatusValidations() *Stage
- func RemoveTypeAliases() *Stage
- func RenameProperties(cfg *config.ObjectModelConfiguration) *Stage
- func RepairSkippingProperties() *Stage
- func ReplaceAnyTypeWithJSON() *Stage
- func ReportOnTypesAndVersions(configuration *config.Configuration) *Stage
- func ReportResourceStructure(configuration *config.Configuration) *Stage
- func ReportResourceVersions(configuration *config.Configuration) *Stage
- func SimplifyDefinitions() *Stage
- func StripUnreferencedTypeDefinitions() *Stage
- func TransformCrossResourceReferences(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
- func TransformCrossResourceReferencesToString() *Stage
- func TransformValidatedFloats() *Stage
- func UnrollRecursiveTypes(log logr.Logger) *Stage
- func VerifyNoErroredTypes() *Stage
- func (stage *Stage) AddDiagnostic(diagnostic DiagnosticAction)
- func (stage *Stage) Description() string
- func (stage *Stage) HasId(id string) bool
- func (stage *Stage) Id() string
- func (stage *Stage) IsUsedFor(target Target) bool
- func (stage *Stage) Postrequisites() []string
- func (stage *Stage) RequiresPostrequisiteStages(postrequisites ...string)
- func (stage *Stage) RequiresPrerequisiteStages(prerequisites ...string)
- func (stage *Stage) Run(ctx context.Context, state *State) (*State, error)
- func (stage *Stage) RunDiagnostic(settings *DebugSettings, index int, state *State) error
- func (stage *Stage) Targets() []Target
- func (stage *Stage) UsedFor(targets ...Target) *Stage
- type State
- func (s *State) CheckFinalState() error
- func (s *State) Definitions() astmodel.TypeDefinitionSet
- func (s *State) WithDefinitions(definitions astmodel.TypeDefinitionSet) *State
- func (s *State) WithExpectation(earlierStage string, laterStage string) *State
- func (s *State) WithOverlaidDefinitions(definitions astmodel.TypeDefinitionSet) *State
- func (s *State) WithSeenStage(id string) *State
- type StateDataKey
- type Target
Constants ¶
const ( ARMIDPropertyClassificationUnset = ARMIDPropertyClassification("unset") ARMIDPropertyClassificationSet = ARMIDPropertyClassification("set") ARMIDPropertyClassificationUnspecified = ARMIDPropertyClassification("unspecified") )
const AddAPIVersionEnumsStageId = "add-api-version-enums"
const AddConfigMapsStageID = "addConfigMaps"
AddConfigMapsStageID is the unique identifier for this pipeline stage
const AddKubernetesExporterStageID = "addKubernetesExporter"
const AddLocatableInterfaceStageID = "addLocatableInterface"
const AddOperatorSpecStageID = "addOperatorSpec"
const AddSecretsStageID = "addSecrets"
AddSecretsStageID is the unique identifier for this pipeline stage
const AddSerializationTypeTagStageID = "addSerializationTypeTag"
const AddStatusConditionsStageID = "addStatusConditions"
const ApplyARMConversionInterfaceStageID = "applyArmConversionInterface"
ApplyARMConversionInterfaceStageID is the unique identifier of this pipeline stage
const ApplyCrossResourceReferencesFromConfigStageID = "applyCrossResourceReferencesFromConfig"
ApplyCrossResourceReferencesFromConfigStageID is the unique identifier for this pipeline stage
const ApplyDefaulterAndValidatorInterfaceStageID = "applyDefaulterAndValidatorInterfaces"
const ApplyExportFiltersStageID = "filterTypes"
const ApplyKubernetesResourceInterfaceStageID = "applyKubernetesResourceInterface"
const AssembleOneOfTypesID = "assembleOneOfTypes"
const CatalogKnownResourcesStageID = "catalogKnownResources"
CatalogKnownResourcesStageID is the unique identifier for this pipeline stage
const CheckForAnyTypeStageID = "rogueCheck"
CheckForAnyTypeStageID is the unique identifier for this stage
const CollapseCrossGroupReferencesStageID = "collapseCrossGroupReferences"
CollapseCrossGroupReferencesStageID is the unique identifier for this pipeline stage
const CreateARMTypesStageID = "createArmTypes"
CreateARMTypesStageID is the unique identifier for this pipeline stage
const CreateConversionGraphStageId = "createConversionGraph"
CreateConversionGraphStageId is the unique identifier for this stage
const (
CreateResourceExtensionsStageID = "createResourceExtensions"
)
CreateResourceExtensionsStageID is the unique identifier of this stage
const CreateStorageTypesStageID = "createStorageTypes"
const DeleteGeneratedCodeStageID = "deleteGenerated"
DeleteGeneratedCodeStageID is the unique identifier of this stage
const DetermineResourceOwnershipStageId = "determineResourceOwnership"
const ExportPackagesStageID = "exportPackages"
ExportPackagesStageID is the unique identifier for this pipeline stage
const FixOptionalCollectionAliasesStageId = "fixOptionalCollectionAliases"
const FlattenPropertiesStageId = "flattenProperties"
const HandleUserAssignedIdentitiesStageID = "handleUserAssignedIdentities"
const ImplementConvertibleInterfaceStageId = "implementConvertibleInterface"
ImplementConvertibleInterfaceStageId is the unique identifier for this pipeline stage
const ImplementConvertibleSpecInterfaceStageId = "implementConvertibleSpecInterface"
ImplementConvertibleSpecInterfaceStageId is the unique identifier for this pipeline stage
const ImplementConvertibleStatusInterfaceStageId = "implementConvertibleStatusInterface"
ImplementConvertibleStatusInterfaceStageId is the unique identifier for this pipeline stage
const ImplementImportableResourceInterfaceStageID = "implementImportableResourceInterface"
const ImprovePropertyDescriptionsStageId = "improvePropertyDescriptions"
ImprovePropertyDescriptionsStageId is the unique identifier for this pipeline stage
const InjectHubFunctionStageID = "injectHubFunction"
InjectHubFunctionStageID is the unique identifier for this pipeline stage
const InjectJsonSerializationTestsID = "injectJSONTestCases"
InjectJsonSerializationTestsID is the unique identifier for this pipeline stage
const InjectOriginalGVKFunctionStageID = "injectOriginalGVKFunction"
InjectOriginalGVKFunctionStageID is the unique identifier for this pipeline stage
const InjectOriginalVersionFunctionStageID = "injectOriginalVersionFunction"
InjectOriginalVersionFunctionStageID is the unique identifier for this pipeline stage
const InjectOriginalVersionPropertyStageID = "injectOriginalVersionProperty"
InjectOriginalVersionPropertyStageID is the unique identifier for this pipeline stage
const InjectPropertyAssignmentFunctionsStageID = "injectPropertyAssignmentFunctions"
InjectPropertyAssignmentFunctionsStageID is the unique identifier for this pipeline stage
const InjectPropertyAssignmentTestsID = "injectPropertyAssignmentTestCases"
InjectPropertyAssignmentTestsID is the unique identifier for this stage
const InjectResourceConversionTestsID = "injectResourceConversionTestCases"
InjectResourceConversionTestsID is the unique identifier for this stage
const InjectSpecInitializationFunctionsStageID = "injectSpecInitializationFunctions"
InjectSpecInitializationFunctionsStageID is the unique identifier for this pipeline stage
const LoadTypesStageID = "loadTypes"
const MakeOneOfDiscriminantRequiredStageId = "makeOneOfDiscriminantRequired"
MakeOneOfDiscriminantRequiredStageId is the unique identifier for this pipeline stage
const MakeStatusPropertiesOptionalStageID = "makeStatusPropertiesOptional"
const MarkLatestAPIVersionAsStorageVersionId = "markStorageVersion"
MarkLatestAPIVersionAsStorageVersionId is the unique identifier for this pipeline stage
const MarkLatestStorageVariantAsHubVersionID = "markLatestStorageVariantAsHubVersion"
MarkLatestStorageVariantAsHubVersionID is the unique identifier for this pipeline stage
const PruneResourcesWithLifecycleOwnedByParentStageID = "pruneResourcesWithLifecycleOwnedByParentStage"
PruneResourcesWithLifecycleOwnedByParentStageID is the unique identifier for this pipeline stage
const RemoveEmbeddedResourcesStageID = "removeEmbeddedResources"
RemoveEmbeddedResourcesStageID is the unique identifier for this pipeline stage
const RemoveEmptyObjectsStageId = "removeEmptyObjects"
const RemoveStatusPropertyValidationsStageID = "removeStatusPropertyValidation"
const RemoveTypeAliasesStageID = "removeAliases"
RemoveTypeAliasesStageID is the unique identifier for this pipeline stage
const RenamePropertiesStageID = "renameProperties"
RenamePropertiesStageID is the unique identifier for this pipeline stage
const RepairSkippingPropertiesStageID = "repairSkippingProperties"
const ReportOnTypesAndVersionsStageID = "reportTypesAndVersions"
ReportOnTypesAndVersionsStageID is the unique identifier of this stage
const ReportResourceStructureStageId = "reportResourceStructure"
ReportResourceStructureStageId is the unique identifier for this stage
const (
// ReportResourceVersionsStageID is the unique identifier of this stage
ReportResourceVersionsStageID = "reportResourceVersions"
)
const SimplifyDefinitionsStageId = "simplifyDefinitions"
const StripUnreferencedTypeDefinitionsStageID = "stripUnreferenced"
StripUnreferencedTypeDefinitionsStageID is the unique identifier for this pipeline stage
const TransformCrossResourceReferencesStageID = "transformCrossResourceReferences"
TransformCrossResourceReferencesStageID is the unique identifier for this pipeline stage
const TransformCrossResourceReferencesToStringStageID = "transformCrossResourceReferencesToString"
TransformCrossResourceReferencesToStringStageID is the unique identifier for this pipeline stage
const (
TransformValidatedFloatsStageID = "transformValidatedFloats"
)
TransformValidatedFloatsStageID is the unique identifier of this stage
const UnrollRecursiveTypesStageID = "unrollRecursiveTypes"
const UserAssignedIdentityTypeDescription = "Information about the user assigned identity for the resource"
const VerifyNoErroredTypesStageID = "verifyNoErroredTypes"
Variables ¶
var CrossplaneRuntimeV1Package = astmodel.MakeExternalPackageReference("github.com/crossplane/crossplane-runtime/apis/common/v1")
Functions ¶
func CreatePackagesForDefinitions ¶
func CreatePackagesForDefinitions( definitions astmodel.TypeDefinitionSet, ) (map[astmodel.InternalPackageReference]*astmodel.PackageDefinition, error)
CreatePackagesForDefinitions groups type definitions into packages
func DoesPropertyLookLikeARMReference ¶
func DoesPropertyLookLikeARMReference(prop *astmodel.PropertyDefinition) bool
DoesPropertyLookLikeARMReference uses a simple heuristic to determine if a property looks like it might be an ARM reference. This can be used for logging/reporting purposes to discover references which we missed.
func GetStateData ¶
func GetStateData[I any]( state *State, key StateDataKey, ) (I, error)
GetStateData returns the information stored in the state under the given key. If no information is stored under the key, or if it doesn't have the expected type, the second return value is false. Has to be written as a standalone function because methods can't introduce new generic variables.
func LookupARMTypeDefinition ¶
func LookupARMTypeDefinition( name astmodel.InternalTypeName, defs astmodel.TypeDefinitionSet, ) (astmodel.TypeDefinition, bool)
LookupARMTypeDefinition gets the ARM type definition for a given Kubernetes type name. Returns the definition and true if found; otherwise returns an empty definition and false.
func MarkLatestResourceVersionsForStorage ¶
func MarkLatestResourceVersionsForStorage(definitions astmodel.TypeDefinitionSet) (astmodel.TypeDefinitionSet, error)
MarkLatestResourceVersionsForStorage marks the latest version of each resource as the storage version
func NewConditionerInterfaceImpl ¶
func NewConditionerInterfaceImpl( idFactory astmodel.IdentifierFactory, resource *astmodel.ResourceType, ) (*astmodel.InterfaceImplementation, error)
NewConditionerInterfaceImpl creates an InterfaceImplementation with GetConditions() and SetConditions() methods, implementing the genruntime.Conditioner interface.
func NewValidateConfigMapDestinationsFunction ¶
func NewValidateConfigMapDestinationsFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *functions.ResourceFunction
func NewValidateSecretDestinationsFunction ¶
func NewValidateSecretDestinationsFunction(resource *astmodel.ResourceType, idFactory astmodel.IdentifierFactory) *functions.ResourceFunction
func StripUnusedDefinitions ¶
func StripUnusedDefinitions( roots astmodel.TypeNameSet, defs astmodel.TypeDefinitionSet, ) (astmodel.TypeDefinitionSet, error)
StripUnusedDefinitions removes all types that aren't in roots or referred to by the types in roots, for example types that are generated as a byproduct of an allOf element.
Types ¶
type ARMIDPropertyClassification ¶
type ARMIDPropertyClassification string
type ARMIDPropertyTypeVisitor ¶
type ARMIDPropertyTypeVisitor struct { astmodel.TypeVisitor[astmodel.InternalTypeName] // contains filtered or unexported fields }
func MakeARMIDPropertyTypeVisitor ¶
func MakeARMIDPropertyTypeVisitor( referenceChecker crossResourceReferenceChecker, log logr.Logger, ) ARMIDPropertyTypeVisitor
type ARMIDToGenruntimeReferenceTypeVisitor ¶
type ARMIDToGenruntimeReferenceTypeVisitor struct { astmodel.TypeVisitor[astmodel.InternalTypeName] // contains filtered or unexported fields }
func MakeARMIDToResourceReferenceTypeVisitor ¶
func MakeARMIDToResourceReferenceTypeVisitor(idFactory astmodel.IdentifierFactory) ARMIDToGenruntimeReferenceTypeVisitor
type DebugSettings ¶
type DebugSettings struct {
// contains filtered or unexported fields
}
func NewDebugSettings ¶
func NewDebugSettings(groupSelector string, outputFolder string) *DebugSettings
NewDebugSettings creates a new DebugSettings.
func (*DebugSettings) CreateFileName ¶
func (dr *DebugSettings) CreateFileName(name string) string
createFileName creates the filename for the debug report from the name of the stage, filtering out any characters that are unsafe in filenames
func (*DebugSettings) MatchesGroup ¶
func (ds *DebugSettings) MatchesGroup(ref astmodel.InternalPackageReference) bool
MatchesGroup returns true if the InternalPackageReference matches the groupSelector.
type DiagnosticAction ¶
type DiagnosticAction func(settings *DebugSettings, index int, state *State) error
type ExportedProperties ¶
type ExportedProperties = map[string][]*astmodel.PropertyDefinition
ExportedProperties is a map of string property name to a chain of properties. For allowing the export of a property "foo" that writes the status.a.b.c property to a config map would be "foo" -> []{status, a, b, c}
type ExportedTypeNameProperties ¶
type ExportedTypeNameProperties struct {
// contains filtered or unexported fields
}
func NewExportedTypeNameProperties ¶
func NewExportedTypeNameProperties() *ExportedTypeNameProperties
func (*ExportedTypeNameProperties) Add ¶
func (e *ExportedTypeNameProperties) Add(name astmodel.TypeName, exported ExportedProperties)
func (*ExportedTypeNameProperties) Copy ¶
func (e *ExportedTypeNameProperties) Copy() *ExportedTypeNameProperties
func (*ExportedTypeNameProperties) Get ¶
func (e *ExportedTypeNameProperties) Get(name astmodel.TypeName) (ExportedProperties, bool)
type PackagesMatrixReport ¶
type PackagesMatrixReport struct {
// contains filtered or unexported fields
}
func NewPackagesMatrixReport ¶
func NewPackagesMatrixReport() *PackagesMatrixReport
func (*PackagesMatrixReport) ServiceName ¶
func (report *PackagesMatrixReport) ServiceName(ref astmodel.InternalPackageReference) string
func (*PackagesMatrixReport) Summarize ¶
func (report *PackagesMatrixReport) Summarize(definitions astmodel.TypeDefinitionSet)
func (*PackagesMatrixReport) WriteTableTo ¶
func (report *PackagesMatrixReport) WriteTableTo(table *reporting.SparseTable, pkg string, outputPath string) error
func (*PackagesMatrixReport) WriteTo ¶
func (report *PackagesMatrixReport) WriteTo(outputPath string) error
type PipelineDiagram ¶
type PipelineDiagram struct {
// contains filtered or unexported fields
}
func NewPipelineDiagram ¶
func NewPipelineDiagram(settings *DebugSettings) *PipelineDiagram
NewPipelineDiagram creates a new PipelineDiagram to write into the specified directory.
func (*PipelineDiagram) WriteDiagram ¶
func (diagram *PipelineDiagram) WriteDiagram(stages []*Stage) error
WriteDiagram writes a diagram of the pipeline to pipeline.dot
type ResourceRegistrationFile ¶
type ResourceRegistrationFile struct {
// contains filtered or unexported fields
}
ResourceRegistrationFile is a file containing functions that assist in registering resources with a Kubernetes scheme.
func NewResourceRegistrationFile ¶
func NewResourceRegistrationFile( resources []astmodel.InternalTypeName, storageVersionResources []astmodel.InternalTypeName, indexFunctions map[astmodel.InternalTypeName][]*functions.IndexRegistrationFunction, secretPropertyKeys map[astmodel.InternalTypeName][]string, configMapPropertyKeys map[astmodel.InternalTypeName][]string, resourceExtensions []astmodel.InternalTypeName, ) *ResourceRegistrationFile
NewResourceRegistrationFile returns a ResourceRegistrationFile for registering the specified resources with a controller
type ResourceStructureReport ¶
type ResourceStructureReport struct {
// contains filtered or unexported fields
}
func NewResourceStructureReport ¶
func NewResourceStructureReport(defs astmodel.TypeDefinitionSet) *ResourceStructureReport
func (*ResourceStructureReport) SaveReports ¶
func (report *ResourceStructureReport) SaveReports(baseFolder string) error
SaveReports writes the reports to the specified files
type ResourceVersionsReport ¶
type ResourceVersionsReport struct {
// contains filtered or unexported fields
}
func NewResourceVersionsReport ¶
func NewResourceVersionsReport( definitions astmodel.TypeDefinitionSet, cfg *config.Configuration, ) (*ResourceVersionsReport, error)
func (*ResourceVersionsReport) FindSampleLinks ¶
func (report *ResourceVersionsReport) FindSampleLinks(group string) (map[string]string, error)
func (*ResourceVersionsReport) SaveAllResourcesReportTo ¶
func (report *ResourceVersionsReport) SaveAllResourcesReportTo(outputFile string) error
SaveAllResourcesReportTo creates a file containing a report listing all supported resources outputFile is the path to the file to create
func (*ResourceVersionsReport) SaveGroupResourcesReportTo ¶
func (report *ResourceVersionsReport) SaveGroupResourcesReportTo(group string, outputFile string) error
SaveGroupResourcesReportTo creates a file containing a report listing supported resources in the specified group. group identifies the set of resources to include. outputFile is the path to the file to create.
func (*ResourceVersionsReport) WriteAllResourcesReportToBuffer ¶
func (report *ResourceVersionsReport) WriteAllResourcesReportToBuffer( frontMatter string, buffer *strings.Builder, ) error
WriteAllResourcesReportToBuffer creates the report in the provided buffer
func (*ResourceVersionsReport) WriteGroupResourcesReportToBuffer ¶
func (report *ResourceVersionsReport) WriteGroupResourcesReportToBuffer( group string, frontMatter string, buffer *strings.Builder, ) error
WriteGroupResourcesReportToBuffer creates the report in the provided buffer
type ResourceVersionsReportResourceItem ¶
type ResourceVersionsReportResourceItem struct {
// contains filtered or unexported fields
}
type Stage ¶
type Stage struct {
// contains filtered or unexported fields
}
Stage represents a composable stage of processing that can transform or process the set of generated types
func AddAPIVersionEnums ¶
func AddAPIVersionEnums() *Stage
func AddConfigMaps ¶
func AddConfigMaps(config *config.Configuration) *Stage
AddConfigMaps replaces properties flagged as a config map with genruntime.ConfigMapReference or genruntime.OptionalConfigMapReference
func AddCrossplaneAtProvider ¶
func AddCrossplaneAtProvider(idFactory astmodel.IdentifierFactory) *Stage
AddCrossplaneAtProvider adds an "AtProvider" property as the sole property in every resource status
func AddCrossplaneEmbeddedResourceSpec ¶
func AddCrossplaneEmbeddedResourceSpec(idFactory astmodel.IdentifierFactory) *Stage
AddCrossplaneEmbeddedResourceSpec puts an embedded runtimev1alpha1.ResourceSpec on every spec type
func AddCrossplaneEmbeddedResourceStatus ¶
func AddCrossplaneEmbeddedResourceStatus(idFactory astmodel.IdentifierFactory) *Stage
AddCrossplaneEmbeddedResourceStatus puts an embedded runtimev1alpha1.ResourceStatus on every spec type
func AddCrossplaneForProvider ¶
func AddCrossplaneForProvider(idFactory astmodel.IdentifierFactory) *Stage
AddCrossplaneForProvider adds a "ForProvider" property as the sole property in every resource spec and moves everything that was at the spec level down a level into the ForProvider type
func AddCrossplaneOwnerProperties ¶
func AddCrossplaneOwnerProperties(idFactory astmodel.IdentifierFactory) *Stage
AddCrossplaneOwnerProperties adds the 3-tuple of (xName, xNameRef, xNameSelector) for each owning resource
func AddKubernetesExporter ¶
func AddKubernetesExporter(idFactory astmodel.IdentifierFactory) *Stage
func AddLocatableInterface ¶
func AddLocatableInterface(idFactory astmodel.IdentifierFactory) *Stage
func AddOperatorSpec ¶
func AddOperatorSpec(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
func AddSecrets ¶
func AddSecrets(config *config.Configuration) *Stage
AddSecrets replaces properties flagged as secret with genruntime.SecretReference
func AddSerializationTypeTag ¶
func AddSerializationTypeTag(configuration *config.Configuration) *Stage
AddSerializationTypeTag adds a property tag to properties with special serialization instructions to initialize empty collections when serializing the payload to Azure. This uses a property tag for a few reasons:
- Some types are flattened and other approaches are easily lost when flattening occurs. Putting the tag onto the property preserves it even through flattening.
- In many ways this behavior is like an augmented `json:omitempty`, so it (IMO) makes sense to have a tag just like for JSON. It makes it clearer when looking at the Go object that the serialization behavior of these fields is special.
func AddStatusConditions ¶
func AddStatusConditions(idFactory astmodel.IdentifierFactory) *Stage
func ApplyARMConversionInterface ¶
func ApplyARMConversionInterface(idFactory astmodel.IdentifierFactory, config *config.ObjectModelConfiguration) *Stage
ApplyARMConversionInterface adds the genruntime.ARMTransformer interface and the Owner property to all Kubernetes types. The genruntime.ARMTransformer interface is used to convert from the Kubernetes type to the corresponding ARM type and back.
func ApplyCrossResourceReferencesFromConfig ¶
func ApplyCrossResourceReferencesFromConfig( configuration *config.Configuration, log logr.Logger, ) *Stage
ApplyCrossResourceReferencesFromConfig replaces cross resource references from the configuration with astmodel.ARMID.
func ApplyDefaulterAndValidatorInterfaces ¶
func ApplyDefaulterAndValidatorInterfaces(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
ApplyDefaulterAndValidatorInterfaces add the admission.Defaulter and admission.Validator interfaces to each resource that requires them
func ApplyExportFilters ¶
func ApplyExportFilters( configuration *config.Configuration, log logr.Logger, ) *Stage
ApplyExportFilters creates a Stage to reduce our set of types for export
func ApplyIsResourceOverrides ¶
func ApplyIsResourceOverrides(configuration *config.Configuration) *Stage
func ApplyKubernetesResourceInterface ¶
func ApplyKubernetesResourceInterface( idFactory astmodel.IdentifierFactory, log logr.Logger, ) *Stage
ApplyKubernetesResourceInterface ensures that every Resource implements the KubernetesResource interface
func ApplyTypeRewrites ¶
func ApplyTypeRewrites( config *config.Configuration, log logr.Logger, ) *Stage
ApplyTypeRewrites applies any typeTransformers.
func AssembleOneOfTypes ¶
func AssembleOneOfTypes(idFactory astmodel.IdentifierFactory) *Stage
func AssertTypesCollectionValid ¶
func AssertTypesCollectionValid() *Stage
AssertTypesCollectionValid creates a Stage that ensures that each reachable type in the types collection has TypeName's that are all reachable as well. This check fails if there is any TypeName that refers to a type that doesn't exist.
func CatalogKnownResources ¶
func CatalogKnownResources() *Stage
func CollapseCrossGroupReferences ¶
func CollapseCrossGroupReferences(idFactory astmodel.IdentifierFactory) *Stage
CollapseCrossGroupReferences finds and removes references between API groups. This isn't particularly common but does occur in a few instances, for example from Microsoft.Compute -> Microsoft.Compute.Extensions.
func ConvertAllOfAndOneOfToObjects ¶
func ConvertAllOfAndOneOfToObjects(idFactory astmodel.IdentifierFactory) *Stage
ConvertAllOfAndOneOfToObjects reduces the AllOfType and OneOfType to ObjectType
func CreateARMTypes ¶
func CreateARMTypes( configuration *config.ObjectModelConfiguration, idFactory astmodel.IdentifierFactory, log logr.Logger, ) *Stage
CreateARMTypes walks the type graph and builds new types for communicating with ARM
func CreateConversionGraph ¶
func CreateConversionGraph( configuration *config.Configuration, generatorPrefix string, ) *Stage
CreateConversionGraph walks the set of available types and creates a graph of conversions that will be used to convert resources to/from the designated storage (or hub) version
func CreateResourceExtensions ¶
func CreateResourceExtensions(localPath string, idFactory astmodel.IdentifierFactory) *Stage
func CreateStorageTypes ¶
func CreateStorageTypes() *Stage
CreateStorageTypes returns a pipeline stage that creates dedicated storage types for each resource and nested object. Storage versions are created for *all* API versions to allow users of older versions of the operator to easily upgrade. This is of course a bit odd for the first release, but defining the approach from day one is useful.
func DeleteGeneratedCode ¶
DeleteGeneratedCode creates a pipeline stage for cleanup of our output folder prior to generating files
func DetermineResourceOwnership ¶
func DetermineResourceOwnership( configuration *config.Configuration, ) *Stage
func EnsureARMTypeExistsForEveryResource ¶
func EnsureARMTypeExistsForEveryResource() *Stage
TODO: Wondering if we should have an even stronger version of this that asserts it for all types rather than just the top level? EnsureARMTypeExistsForEveryResource performs a check ensuring that every Kubernetes resource spec/status has a corresponding ARM type
func EnsureDefinitionsDoNotUseAnyTypes ¶
func EnsureDefinitionsDoNotUseAnyTypes() *Stage
EnsureDefinitionsDoNotUseAnyTypes returns a stage that will check for any definitions containing AnyTypes. The stage will return errors for each type found that uses an AnyType.
func ExportControllerResourceRegistrations ¶
func ExportControllerResourceRegistrations(idFactory astmodel.IdentifierFactory, outputPath string) *Stage
ExportControllerResourceRegistrations creates a Stage to generate type registrations for resources.
func ExportPackages ¶
ExportPackages creates a Stage to export our generated code as a set of packages
func FilterOutDefinitionsUsingAnyType ¶
FilterOutDefinitionsUsingAnyType returns a stage that will check for any definitions containing AnyTypes. It accepts a set of packages that we expect to contain types with AnyTypes. Those packages will be quietly filtered out of the output of the stage, but if there are more AnyTypes in other packages they'll be reported as an error. The stage will also return an error if there are packages that we expect to have AnyTypes but turn out not to, ensuring that we clean up our configuration as the schemas are fixed and our handling improves.
func FixIDFields ¶
func FixIDFields() *Stage
func FixOptionalCollectionAliases ¶
func FixOptionalCollectionAliases() *Stage
func FlattenProperties ¶
func FlattenResources ¶
func FlattenResources() *Stage
FlattenResources flattens any resources directly inside other resources
func HandleUserAssignedIdentities ¶
func HandleUserAssignedIdentities() *Stage
func ImplementConvertibleInterface ¶
func ImplementConvertibleInterface(idFactory astmodel.IdentifierFactory) *Stage
ImplementConvertibleInterface injects the functions ConvertTo() and ConvertFrom() into each non-hub Resource Type, providing the required implementation of the Convertible interface needed by the controller
func ImplementConvertibleSpecInterface ¶
func ImplementConvertibleSpecInterface(idFactory astmodel.IdentifierFactory) *Stage
func ImplementConvertibleStatusInterface ¶
func ImplementConvertibleStatusInterface(idFactory astmodel.IdentifierFactory) *Stage
func ImplementImportableResourceInterface ¶
func ImplementImportableResourceInterface( configuration *config.Configuration, idFactory astmodel.IdentifierFactory, ) *Stage
func ImprovePropertyDescriptions ¶
func ImprovePropertyDescriptions() *Stage
ImprovePropertyDescriptions adds documentation to any properties missing it by copying the description from the corresponding type
func InjectHubFunction ¶
func InjectHubFunction(idFactory astmodel.IdentifierFactory) *Stage
InjectHubFunction modifies the nominates storage version (aka hub version) of each resource by injecting a Hub() function so that it satisfies the required interface.
func InjectJsonSerializationTests ¶
func InjectJsonSerializationTests(idFactory astmodel.IdentifierFactory) *Stage
func InjectOriginalGVKFunction ¶
func InjectOriginalGVKFunction(idFactory astmodel.IdentifierFactory) *Stage
InjectOriginalGVKFunction injects the function OriginalGVK() into each Resource type This function allows us to recover the original version used to create each custom resource, giving the operator the information needed to interact with ARM using the correct API version.
func InjectOriginalVersionFunction ¶
func InjectOriginalVersionFunction(idFactory astmodel.IdentifierFactory) *Stage
InjectOriginalVersionFunction injects the function OriginalVersion() into each Spec type This function allows us to recover the original version used to create each custom resource, giving the operator the information needed to interact with ARM using the correct API version. We run this stage before we create any storage types, ensuring only API versions get the function.
func InjectOriginalVersionProperty ¶
func InjectOriginalVersionProperty() *Stage
InjectOriginalVersionProperty injects the property OriginalVersion into each Storage Spec type This property gets populated by reading from the OriginalVersion() function previously injected into the API Spec types, allowing us to recover the original version used to create each custom resource, and giving the operator the information needed to interact with ARM using the correct API version.
func InjectPropertyAssignmentFunctions ¶
func InjectPropertyAssignmentFunctions( configuration *config.Configuration, idFactory astmodel.IdentifierFactory, log logr.Logger, ) *Stage
InjectPropertyAssignmentFunctions injects property assignment functions AssignTo*() and AssignFrom*() into both resources and object types. These functions do the heavy lifting of the conversions between versions of each type and are the building blocks of the main CovertTo*() and ConvertFrom*() methods.
func InjectPropertyAssignmentTests ¶
func InjectPropertyAssignmentTests(idFactory astmodel.IdentifierFactory) *Stage
func InjectResourceConversionTestCases ¶
func InjectResourceConversionTestCases(idFactory astmodel.IdentifierFactory) *Stage
InjectResourceConversionTestCases is a pipeline stage to inject test cases
func InjectSpecInitializationFunctions ¶
func InjectSpecInitializationFunctions( configuration *config.Configuration, idFactory astmodel.IdentifierFactory, ) *Stage
InjectSpecInitializationFunctions injects the Spec initialization functions Initialize_From_*() into resources and object types. These functions are called from InitializeSpec() to initialize the spec from the status when the resource is imported.
func LoadTypes ¶
func LoadTypes( idFactory astmodel.IdentifierFactory, config *config.Configuration, log logr.Logger, ) *Stage
LoadTypes creates a PipelineStage to load Swagger data.
This information is derived from the Azure Swagger specifications. We parse the Swagger specs and look for any actions that appear to be ARM resources (have PUT methods with types we can use and appropriate names in the action path). Then for each resource, we use the existing JSON AST parser to extract the status type (the type-definition part of swagger is the same as JSON Schema).
func MakeOneOfDiscriminantRequired ¶
func MakeOneOfDiscriminantRequired() *Stage
MakeOneOfDiscriminantRequired walks the type graph and builds new types for communicating with ARM
func MakeStatusPropertiesOptional ¶
func MakeStatusPropertiesOptional() *Stage
MakeStatusPropertiesOptional makes all top level Status properties optional. This is required because Status itself is actually optional (it's not set initially) and if any top level properties are not optional they end up always being returned, which makes for an awkward GET response initially (before the Status has been set). It also has implications for updating or patching the CRD resource as patching something in the spec or changing an annotation will deserialize the response from apiserver into the object passed in. If there are any spurious empty properties in Status included they will end up getting overwritten (possibly before the client.Status().Update() call can be made).
func MarkLatestAPIVersionAsStorageVersion ¶
func MarkLatestAPIVersionAsStorageVersion() *Stage
MarkLatestAPIVersionAsStorageVersion creates a Stage to mark a particular version as a storage version
func MarkLatestStorageVariantAsHubVersion ¶
func MarkLatestStorageVariantAsHubVersion() *Stage
MarkLatestStorageVariantAsHubVersion creates a Stage to mark the latest non-preview storage variant of a resource as the hub version of that resource for persistence
func NameTypesForCRD ¶
func NameTypesForCRD(idFactory astmodel.IdentifierFactory) *Stage
NameTypesForCRD - for CRDs all inner enums and objects and validated types must be named, so we do it here
func NewLegacyStage ¶
func NewLegacyStage( id string, description string, action func(context.Context, astmodel.TypeDefinitionSet) (astmodel.TypeDefinitionSet, error), ) *Stage
NewLegacyStage is a legacy constructor for creating a new pipeline stage that's ready for execution DO NOT USE THIS FOR ANY NEW STAGES - it's kept for compatibility with an older style of pipeline stages that will be migrated to the new style over time.
func NewStage ¶
func NewStage( id string, description string, action func(context.Context, *State) (*State, error), ) *Stage
NewStage creates a new pipeline stage that's ready for execution
func PruneResourcesWithLifecycleOwnedByParent ¶
func PruneResourcesWithLifecycleOwnedByParent(configuration *config.Configuration) *Stage
PruneResourcesWithLifecycleOwnedByParent prunes networking embedded types
func RemoveEmbeddedResources ¶
func RemoveEmbeddedResources( configuration *config.Configuration, log logr.Logger, ) *Stage
func RemoveEmptyObjects ¶
RemoveEmptyObjects removes Definitions which are empty (an object type with no properties)
func RemoveStatusValidations ¶
func RemoveStatusValidations() *Stage
RemoveStatusValidations removes property validations from all Status types. This is required because Status is retrieved directly from the ARM API, and there are cases where ARM might return something that isn't actually "valid" according to the validation, but makes sense in context. Some examples:
- Status has a modelAsString enum with 2 values, but in a future API version, a 3rd value is added. The fact that the enum is modelAsString allows the service to return the new 3rd value even in old API versions.
- Status has an int that must be between 10 and 20. In a future API version, that restriction is relaxed and the same int can now be between 0 and 50.
- A bug in the services Swagger specification causes the service to accept enums with any case, but always return the enum all uppercase
In the above cases, if we left validation on the Status types, we would be unable to persist the content returned by the service (apiserver will reject it as not matching the OpenAPI schema). This could be a problem in cases where the resource was created via some other means and then imported into
func RemoveTypeAliases ¶
func RemoveTypeAliases() *Stage
RemoveTypeAliases creates a pipeline stage removing type aliases
func RenameProperties ¶
func RenameProperties(cfg *config.ObjectModelConfiguration) *Stage
func RepairSkippingProperties ¶
func RepairSkippingProperties() *Stage
RepairSkippingProperties repairs any properties that skip one or more versions of an object and are reintroduced. As described in issue #1776, such properties are a problem because they might create incompatibilities between different versions of ASO, or between different versions of a given resource.
To repair these, we need to ensure that objects stored in property bags are always serialized with the same shape. For more details, see https://azure.github.io/azure-service-operator/design/adr-2023-09-skipping-properties/
Repair works by scanning for properties that are dropped between versions of a resource. We keep track of all these properties, and if a specific property appears more than once (implying there are two or more sequence versions of that property) we know a repair is required.
To illustrate, assume we have the following set of objects across versions of our mythical CRM service:
v1: Person(GivenName, FamilyName, Address) v2: Person(KnownAs, FullName, FamilyName) v3: Person(KnownAs, FullName, FamilyName, Address)
Scanning these types, we find:
FamilyName: present in (v1, v2, v3); no issue FullName: present in (v2, v3); no issue KnownAs: also present in (v2, v3); no issue GivenName: present in (v1); no issue
Address: present in (v1, v3); (skipping v2), repair required.
func ReplaceAnyTypeWithJSON ¶
func ReplaceAnyTypeWithJSON() *Stage
func ReportOnTypesAndVersions ¶
func ReportOnTypesAndVersions(configuration *config.Configuration) *Stage
ReportOnTypesAndVersions creates a pipeline stage that generates a report for each group showing a matrix of all types and versions
func ReportResourceStructure ¶
func ReportResourceStructure(configuration *config.Configuration) *Stage
ReportResourceStructure creates a pipeline stage that reports the structure of resources in each package
func ReportResourceVersions ¶
func ReportResourceVersions(configuration *config.Configuration) *Stage
ReportResourceVersions creates a pipeline stage that generates a report listing all generated resources.
func SimplifyDefinitions ¶
func SimplifyDefinitions() *Stage
SimplifyDefinitions creates a pipeline stage that removes any wrapper types prior to actual code generation
func StripUnreferencedTypeDefinitions ¶
func StripUnreferencedTypeDefinitions() *Stage
func TransformCrossResourceReferences ¶
func TransformCrossResourceReferences(configuration *config.Configuration, idFactory astmodel.IdentifierFactory) *Stage
TransformCrossResourceReferences replaces cross resource references with genruntime.ResourceReference.
func TransformCrossResourceReferencesToString ¶
func TransformCrossResourceReferencesToString() *Stage
TransformCrossResourceReferencesToString replaces cross resource references with string.
func TransformValidatedFloats ¶
func TransformValidatedFloats() *Stage
func UnrollRecursiveTypes ¶
UnrollRecursiveTypes finds types that reference themselves and "unrolls" the reference. So a type that looks like:
type Error struct { code string message string errors []Error }
gets unrolled to look like:
type Error struct { code string message string errors []Error_Unrolled }
where Error_Unrolled looks like:
type Error_Unrolled struct { code string message string }
The recursive references must be removed because controller-tools doesn't support generating "references" (JSON $ref) so it can't support recursive types today. See https://github.com/kubernetes-sigs/controller-tools/issues/489 for more information. Unrolling these types, while required for controller-tools to function, means THAT THE TYPES WE GENERATE DON'T EXACTLY CONFORM TO THE PUBLISHED API! In practice, we think this is ok for Error types because our observation is that Errors that reference themselves only return a depth of 1 in practice. If we were to unroll all loops (rather than just types that directly reference themselves like we're doing here) that "in practice" observation may no longer hold, so we avoid doing it here (it's also more complicated to do that).
func VerifyNoErroredTypes ¶
func VerifyNoErroredTypes() *Stage
VerifyNoErroredTypes creates a Stage that verifies that no types contain an ErroredType with errors
func (*Stage) AddDiagnostic ¶
func (stage *Stage) AddDiagnostic(diagnostic DiagnosticAction)
AddDiagnostic specifies a diagnostic generator for this stage. The generator will be used if the generator is run with a --debug flag`
func (*Stage) Description ¶
Description returns a human-readable description of this stage
func (*Stage) IsUsedFor ¶
IsUsedFor returns true if this stage should be used for the specified target
func (*Stage) Postrequisites ¶
Postrequisites returns the unique ids of stages that must run after this stage
func (*Stage) RequiresPostrequisiteStages ¶
RequiresPostrequisiteStages declares which stages must be executed after this one has completed Use postrequisites when it is necessary for that later stage to act on the results of this one.
For example, InjectJsonSerializationTests creates round trip serialization tests for any object types that have properties. It's not correct to give InjectJsonSerializationTests a prerequisite on every earlier stage that creates new object types becauses it isn't concerned with where those object came from. However, those earlier stages DO want their new object types to be tested, so they declare a post-requisite on InjectJsonSerializationTests to ensure this happens.
Post-requisites are thus not completely isomorphic with RequiresPrerequisiteStages as there may be supporting stages that are sometimes omitted from execution when targeting different outcomes. Having both pre- and post-requisites allows the dependencies to drop out cleanly when different stages are present.
func (*Stage) RequiresPrerequisiteStages ¶
RequiresPrerequisiteStages declares which stages must have completed before this one is executed. Use prerequisites to specify stages that must be present for this stage to work - typically this means that the earlier stage is responsible for creating the preconditions required for this stage to operate correctly.
func (*Stage) RunDiagnostic ¶
func (stage *Stage) RunDiagnostic(settings *DebugSettings, index int, state *State) error
RunDiagnostic triggers our attached diagnostic generator, if any
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is an immutable instance that captures the information being passed along the pipeline
func NewState ¶
func NewState(definitions ...astmodel.TypeDefinitionSet) *State
NewState returns a new empty state definitions is a (possibly empty) sequence of types to combine for the initial state
func StateWithData ¶
func StateWithData[I any]( state *State, key StateDataKey, info I, ) *State
StateWithData returns a new state with the given information included. Any existing information with the same key is replaced. Has to be written as a standalone function because methods can't introduce new generic variation.
func (*State) CheckFinalState ¶
CheckFinalState checks that our final state is valid, returning an error if not
func (*State) Definitions ¶
func (s *State) Definitions() astmodel.TypeDefinitionSet
Definitions returns the set of type definitions contained by the state
func (*State) WithDefinitions ¶
func (s *State) WithDefinitions(definitions astmodel.TypeDefinitionSet) *State
WithDefinitions returns a new independentState with the given type definitions instead
func (*State) WithExpectation ¶
WithExpectation records our expectation that the later stage is coming
func (*State) WithOverlaidDefinitions ¶
func (s *State) WithOverlaidDefinitions(definitions astmodel.TypeDefinitionSet) *State
WithOverlaidDefinitions returns a new independent State with the given type definitions overlaid on the existing ones. Any new definitions are added, and any existing definitions are replaced.
func (*State) WithSeenStage ¶
WithSeenStage records that the passed stage has been seen
type StateDataKey ¶
type StateDataKey string
StateDataKey defines a unique key used to store/recall information in the pipeline state. This allows one stage to store information for consumption by another later stage.
const ( AllKnownResources StateDataKey = "AllKnownResources" ConversionGraphInfo StateDataKey = "ConversionGraph" ExportedConfigMaps StateDataKey = "ExportedConfigMaps" )
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target is used to classify what kind of pipeline we have Deliberately wraps a string because we *do* *not* want type compatibility with literal strings
var ( // ARMTarget is used to tag stages that are required when generating types for working directly with Azure ARMTarget Target = MakePipelineTarget("azure") // CrossplaneTarget is used to tag stages that are required when generating types for working with Crossplane CrossplaneTarget Target = MakePipelineTarget("crossplane") )
func MakePipelineTarget ¶
func TranslatePipelineToTarget ¶
func TranslatePipelineToTarget(pipeline config.GenerationPipeline) (Target, error)
Source Files ¶
- add_api_version_enums.go
- add_arm_conversion_interface.go
- add_configmaps.go
- add_cross_resource_references.go
- add_kubernetes_exporter.go
- add_locatable_interface.go
- add_operator_spec.go
- add_secrets.go
- add_serialization_type_tag.go
- add_simple_cross_resource_references.go
- add_status_conditions.go
- apply_cross_resource_references_from_config.go
- apply_defaulter_and_validator_interfaces.go
- apply_export_filters.go
- apply_is_resource_overrides.go
- apply_kubernetes_resource_interface.go
- apply_type_rewrites.go
- assemble_oneof.go
- assert_types_collection_valid.go
- catalog_known_resources.go
- check_for_anytype.go
- collapse_cross_group_refs.go
- convert_allof_and_oneof_to_objects.go
- create_arm_types.go
- create_conversion_graph.go
- create_resource_extension_types.go
- create_storage_types.go
- crossplane_add_at_provider.go
- crossplane_add_embedded_resource_spec.go
- crossplane_add_embedded_resource_status.go
- crossplane_add_for_provider.go
- crossplane_add_owner_properties.go
- debug_settings.go
- delete_generated_code.go
- determine_resource_ownership.go
- ensure_type_has_arm_type.go
- export_controller_type_registrations.go
- export_generated_code.go
- exported_properties.go
- fix_optional_collection_aliases.go
- flatten_properties.go
- flatten_resources.go
- handle_user_assigned_identities.go
- implement_convertible_interface.go
- implement_convertible_spec_interface.go
- implement_convertible_status_interface.go
- implement_importable_resource_interface.go
- improve-property-descriptions.go
- inject_hub_function.go
- inject_original_gvk_function.go
- inject_original_version_function.go
- inject_original_version_property.go
- inject_property_assignment_functions.go
- inject_spec_initialization_functions.go
- json_serialization_test_cases.go
- load_types.go
- make_one_of_discriminant_required.go
- make_status_properties_optional.go
- mark_latest_api_version_as_storage_version.go
- mark_latest_storage_variant_as_hub_version.go
- name_types_for_crd.go
- pipeline_diagram.go
- property_assignment_test_cases.go
- prune_resources_with_lifecycle_owned_by_parent.go
- remove_armid_from_status.go
- remove_embedded_resources.go
- remove_empty_objects.go
- remove_status_property_validations.go
- remove_type_aliases.go
- rename_properties.go
- repair_skipping_properties.go
- replace_anytype_with_json.go
- report_resource_structure.go
- report_resource_versions.go
- report_type_versions.go
- resource_conversion_test_cases.go
- resource_registration_file.go
- simplify_definitions.go
- stage.go
- state.go
- strip_unused_types.go
- target.go
- transform_validated_floats.go
- unroll_recursive_types.go
- verify_no_errored_types.go