Documentation ¶
Index ¶
- Constants
- Variables
- func FileNameForCRD(crd *apiextensions.CustomResourceDefinition) (string, error)
- func GenerateResourceIDFieldDescription(targetField string, isServerGeneratedResourceID bool) string
- func GenerateShortNames(kind string) []string
- func GenerateTF2CRD(sm *corekccv1alpha1.ServiceMapping, ...) (*apiextensions.CustomResourceDefinition, error)
- func GetCustomResourceDefinition(kind, group, version string, openAPIV3Schema *apiextensions.JSONSchemaProps, ...) *apiextensions.CustomResourceDefinition
- func GetResourceReferenceSchemaFromTypeConfig(typeConfig corekccv1alpha1.TypeConfig) *apiextensions.JSONSchemaProps
- func MarkHierarchicalReferencesOptionalButMutuallyExclusive(spec *apiextensions.JSONSchemaProps, ...) *apiextensions.JSONSchemaProps
- func MarkHierarchicalReferencesRequiredButMutuallyExclusive(spec *apiextensions.JSONSchemaProps, ...) *apiextensions.JSONSchemaProps
- func MarkReferencedKindsNotSupported(refSchema *apiextensions.JSONSchemaProps, kinds []string)
- type DCL2CRDGenerator
Constants ¶
const ( ApiDomain = "cnrm.cloud.google.com" ManagedByKCCLabel = "cnrm.cloud.google.com/managed-by-kcc" GCPCategory = "gcp" )
const (
Dcl2CRDLabel = "cnrm.cloud.google.com/dcl2crd"
)
const (
TF2CRDLabel = "cnrm.cloud.google.com/tf2crd"
)
Variables ¶
var (
UnsupportedReferencedResource = fmt.Errorf("referenced resource is unsupported by KCC")
)
Functions ¶
func FileNameForCRD ¶
func FileNameForCRD(crd *apiextensions.CustomResourceDefinition) (string, error)
FileNameForCRD determines the file name for the given CRD. File names take the form of "$group_$version_$kind.yaml" Example: "pubsub_v1alpha1_pubsubtopic.yaml"
func GenerateShortNames ¶
func GenerateTF2CRD ¶
func GenerateTF2CRD(sm *corekccv1alpha1.ServiceMapping, resourceConfig *corekccv1alpha1.ResourceConfig) (*apiextensions.CustomResourceDefinition, error)
func GetCustomResourceDefinition ¶
func GetCustomResourceDefinition(kind, group, version string, openAPIV3Schema *apiextensions.JSONSchemaProps, engineLabel string) *apiextensions.CustomResourceDefinition
func GetResourceReferenceSchemaFromTypeConfig ¶
func GetResourceReferenceSchemaFromTypeConfig(typeConfig corekccv1alpha1.TypeConfig) *apiextensions.JSONSchemaProps
func MarkHierarchicalReferencesOptionalButMutuallyExclusive ¶
func MarkHierarchicalReferencesOptionalButMutuallyExclusive(spec *apiextensions.JSONSchemaProps, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) *apiextensions.JSONSchemaProps
MarkHierarchicalReferencesOptionalButMutuallyExclusive returns a modified copy of the given JSON schema so that keys for hierarchical references are marked optional but mutually exclusive (i.e. at most one may be specified).
func MarkHierarchicalReferencesRequiredButMutuallyExclusive ¶
func MarkHierarchicalReferencesRequiredButMutuallyExclusive(spec *apiextensions.JSONSchemaProps, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) *apiextensions.JSONSchemaProps
MarkHierarchicalReferencesRequiredButMutuallyExclusive returns a modified copy of the given JSON schema so that keys for hierarchical references are marked required but mutually exclusive (i.e. one and only one must be specified).
func MarkReferencedKindsNotSupported ¶
func MarkReferencedKindsNotSupported(refSchema *apiextensions.JSONSchemaProps, kinds []string)
MarkReferencedKindsNotSupported changes the description of the direct reference field 'name' to reflect that some of the referenced resource types are not yet supported in KCC.
Types ¶
type DCL2CRDGenerator ¶
type DCL2CRDGenerator struct {
// contains filtered or unexported fields
}
func New ¶
func New(metadataLoader dclmetatda.ServiceMetadataLoader, schemaLoader dclschemaloader.DCLSchemaLoader, allSupportedGVKs []schema.GroupVersionKind) *DCL2CRDGenerator
func (*DCL2CRDGenerator) GenerateCRDFromOpenAPISchema ¶
func (a *DCL2CRDGenerator) GenerateCRDFromOpenAPISchema(schema *openapi.Schema, gvk schema.GroupVersionKind) (*apiextensions.CustomResourceDefinition, error)
GenerateCRDFromOpenAPISchema returns a CustomResourceDefinition given the DCL OpenAPI schema