generator

package
v0.0.0-...-d9b856a Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: 0BSD Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateExamples

func GenerateExamples(templatePath string, outputPath string, data []*TemplateData)

func GenerateGitHubWorkflows

func GenerateGitHubWorkflows(templatePath string, outputPath string, data []*TemplateData)

func GenerateMakefiles

func GenerateMakefiles(templatePath string, outputPath string, data []*TemplateData)

func GenerateProvider

func GenerateProvider(templatePath string, outputPath string, data []*TemplateData)

func GenerateResources

func GenerateResources(templatePath string, outputPath string, data []*TemplateData)

func GenerateReuseFiles

func GenerateReuseFiles(templatePath string, outputPath string, openapi []fetcher.UpstreamSource)

func GenerateTemplates

func GenerateTemplates(templatePath string, outputPath string, data []*TemplateData)

func GenerateTerratestTests

func GenerateTerratestTests(templatePath string, outputPath string, data []*TemplateData)

func GenerateTests

func GenerateTests(templatePath string, outputPath string, data []*TemplateData)

func ParseCRDv1Files

func ParseCRDv1Files(basePath string) []*apiextensionsv1.CustomResourceDefinition

func ParseOpenAPIv2Files

func ParseOpenAPIv2Files(basePath string) []map[string]*openapi3.SchemaRef

func ParseTemplates

func ParseTemplates(filenames ...string) *template.Template

Types

type AdditionalImports

type AdditionalImports struct {
	Float64Validator bool
	Int64Validator   bool
	ListValidator    bool
	MapValidator     bool
	ObjectValidator  bool
	StringValidator  bool
	BoolValidator    bool
	Regexp           bool
	Path             bool
	MathBig          bool
}

type Property

type Property struct {
	BT                     string
	Name                   string
	GoName                 string
	GoType                 string
	TerraformAttributeName string
	TerraformAttributeType string
	TerraformElementType   string
	TerraformValueType     string
	Description            string
	Required               bool
	Optional               bool
	Computed               bool
	Properties             []*Property
	ValidatorsType         string
	ValidatorsPackage      string
	Validators             []string
}

type TemplateData

type TemplateData struct {
	BT      string
	Package string

	// ResourceFile is the file name of the resource
	ResourceFile string

	// ResourceTestFile is the file name of the test for the resource
	ResourceTestFile string

	// ResourceWorkflowFile is the file name of the GitHub Actions workflow for the resource
	ResourceWorkflowFile string

	// ManifestFile is the file name of the data source
	DataSourceFile string

	// DataSourceTestFile is the file name of the test for the data source
	DataSourceTestFile string

	// DataSourceWorkflowFile is the file name of the GitHub Actions workflow for the data source
	DataSourceWorkflowFile string

	// ManifestFile is the file name of the manifest data source
	ManifestFile string

	// ManifestTestFile is the file name of the test for the manifest data source
	ManifestTestFile string

	// ManifestWorkflowFile is the file name of the GitHub Actions workflow for the manifest data source
	ManifestWorkflowFile string

	// Group is API group of a Kubernetes resource
	Group string

	// Version is the API version of a Kubernetes resource
	Version string

	// Kind is the API kind of a Kubernetes resource
	Kind string

	// PluralKind is the plural form of the API kind
	PluralKind string

	// Description is the human-readable description of a Kubernetes resource
	Description string

	// Namespaced is true if a Kubernetes resource is namespaced or false otherwise
	Namespaced bool

	// ResourceTypeStruct is the CamelCase version of the name used by resources for the Terraform type
	ResourceTypeStruct string

	// ResourceDataStruct is the CamelCase version of the name used by resources for the data struct
	ResourceDataStruct string

	// ResourceTypeStruct is the CamelCase version of the name used by tests for a resource
	ResourceTypeTest string

	// DataSourceTypeStruct is the CamelCase version of the name used by data sources for the Terraform type
	DataSourceTypeStruct string

	// DataSourceDataStruct is the CamelCase version of the name used by data sources for the data struct
	DataSourceDataStruct string

	// DataSourceTypeTest is the CamelCase version of the name used by tests for a data source
	DataSourceTypeTest string

	// ManifestTypeStruct is the CamelCase version of the name used by manifest data sources for the Terraform type
	ManifestTypeStruct string

	// ManifestDataStruct is the CamelCase version of the name used by manifest data sources for data struct
	ManifestDataStruct string

	// ManifestTypeTest is the CamelCase version of the name used by tests for a manifest data source
	ManifestTypeTest string

	TerraformModelType string

	// ResourceTypeName is the snake_case version of the name as used by Terraform without the provider prefix
	ResourceTypeName string

	// FullResourceTypeName is the snake_case version of the name as used by Terraform with the provider prefix
	FullResourceTypeName string

	// DataSourceTypeName is the snake_case version of the name as used by Terraform without the provider prefix
	DataSourceTypeName string

	// FullDataSourceTypeName is the snake_case version of the name as used by Terraform with the provider prefix
	FullDataSourceTypeName string

	// ManifestTypeName is the snake_case version of the name as used by Terraform without the provider prefix
	ManifestTypeName string

	// FullManifestTypeName is the snake_case version of the name as used by Terraform with the provider prefix
	FullManifestTypeName string

	Properties        []*Property
	AdditionalImports AdditionalImports
}

func ConvertOpenAPIv3

func ConvertOpenAPIv3(schemas []map[string]*openapi3.SchemaRef) []*TemplateData

Jump to

Keyboard shortcuts

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