generate

package
v0.0.0-...-aacb26d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLicenseHeader

func AddLicenseHeader(f *jen.File)

AddLicenseHeader adds the standard license header to generated files

func FromConfig

func FromConfig(resultPath, crdKind, controllerOutDir, indexerOutDir, typesPath string, override bool) error

FromConfig generates controllers and handlers based on the parsed CRD result file

func GenerateIndexers

func GenerateIndexers(resultPath, crdKind, indexerOutDir string) error

func GenerateServiceLayers

func GenerateServiceLayers(resourceName string, mappings []MappingWithConfig, translationOutDir string) error

GenerateServiceLayers generates service layers for all mappings

func GetAtlasAPIForCRD

func GetAtlasAPIForCRD(crdKind string) (string, error)

GetAtlasAPIForCRD maps CRD kinds to their corresponding Atlas API types

func PrintCRDs

func PrintCRDs(resultPath string) error

PrintCRDs displays available CRDs from the result file

Types

type APIMapping

type APIMapping struct {
	Properties map[string]SpecProperty `yaml:"properties"`
}

type CRDDocument

type CRDDocument struct {
	APIVersion string                          `yaml:"apiVersion"`
	Kind       string                          `yaml:"kind"`
	Metadata   CRDMetadata                     `yaml:"metadata"`
	Spec       v1.CustomResourceDefinitionSpec `yaml:"spec"`
}

type CRDInfo

type CRDInfo struct {
	Kind       string
	Group      string
	Version    string
	Plural     string
	ShortNames []string
	Categories []string
	Versions   []CRDVersionInfo
}

func ListCRDs

func ListCRDs(resultPath string) ([]CRDInfo, error)

func ParseCRDResult

func ParseCRDResult(resultPath, crdKind string) (*CRDInfo, error)

type CRDMetadata

type CRDMetadata struct {
	Name        string            `yaml:"name"`
	Annotations map[string]string `yaml:"annotations"`
}

type CRDVersionInfo

type CRDVersionInfo struct {
	Version         string
	AtlasSDKVersion string
	SDKPackage      string
}

type IndexerInfo

type IndexerInfo struct {
	ResourceName    string
	IndexerName     string
	TargetKind      string
	ConstantName    string
	FunctionName    string
	ReferenceFields []ReferenceField // All fields that reference this kind
}

type KubernetesMapping

type KubernetesMapping struct {
	NameSelector string            `yaml:"nameSelector"`
	Properties   []string          `yaml:"properties"`
	Type         KubernetesRefType `yaml:"type"`
}

type KubernetesRefType

type KubernetesRefType struct {
	Group    string `yaml:"group"`
	Kind     string `yaml:"kind"`
	Resource string `yaml:"resource"`
	Version  string `yaml:"version"`
}

type MappingWithConfig

type MappingWithConfig struct {
	Version       string
	OpenAPIConfig OpenAPIConfig
}

type OpenAPIConfig

type OpenAPIConfig struct {
	Name    string `yaml:"name"`
	Package string `yaml:"package"`
}

type OpenAPIMapping

type OpenAPIMapping struct {
	Property string `yaml:"property"`
	Type     string `yaml:"type,omitempty"`
}

type ParsedConfig

type ParsedConfig struct {
	SelectedCRD    CRDInfo
	Mappings       []MappingWithConfig
	ResourceName   string
	APIVersion     string // API version package (e.g., "v1", "v3")
	StorageVersion string
	PluralName     string
	CRDGroup       string
}

func ParseCRDConfig

func ParseCRDConfig(resultPath, crdKind string) (*ParsedConfig, error)

type PropertyMapping

type PropertyMapping struct {
	KubernetesMapping *KubernetesMapping `yaml:"x-kubernetes-mapping,omitempty"`
	OpenAPIMapping    *OpenAPIMapping    `yaml:"x-openapi-mapping,omitempty"`
}

type ReferenceField

type ReferenceField struct {
	FieldName         string
	FieldPath         string
	ReferencedKind    string
	ReferencedGroup   string
	ReferencedVersion string
	IndexerType       string
}

func ParseReferenceFields

func ParseReferenceFields(resultPath, crdKind string) ([]ReferenceField, error)

type SpecProperty

type SpecProperty struct {
	Properties map[string]VersionProperty `yaml:"properties"`
}

type VersionProperties

type VersionProperties struct {
	Properties map[string]PropertyMapping `yaml:"properties"`
}

type VersionProperty

type VersionProperty struct {
	AtlasSDKVersion string `yaml:"x-atlas-sdk-version"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL