generate

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ConfigFiles is the set of configuration files that are generated.
	ConfigFiles = []string{
		"config/controller/deployment.yaml",
		"config/controller/kustomization.yaml",
		"config/default/kustomization.yaml",
		"config/rbac/cluster-role-binding.yaml",
		"config/rbac/kustomization.yaml",
	}

	// ReleaseFiles is the set of template files that are generated for Helm
	// chart releases artifacts.
	ReleaseFiles = append(releaseTemplateFiles, releaseCopyFiles...)
)

Functions

func IncludeTemplate

func IncludeTemplate(t *ttpl.Template, tplDir string, tplName string) (*ttpl.Template, error)

IncludeTemplate includes a template into a supplied Template struct

Types

type Generator

type Generator struct {
	SDKAPI *ackmodel.SDKAPI
	// contains filtered or unexported fields
}

Generator creates the ACK service controller Kubernetes API types (CRDs) and the service controller implementation/SDK linkage

func New

func New(
	SDKAPI *ackmodel.SDKAPI,
	apiVersion string,
	configPath string,
	templateBasePath string,
	defaultConfig ackgenconfig.Config,
) (*Generator, error)

New returns a new Generator struct for a supplied API model. Optionally, pass a file path to a generator config file that can be used to instruct the code generator how to handle the API properly

func (*Generator) GenerateAPIFile

func (g *Generator) GenerateAPIFile(

	target string,
) (*bytes.Buffer, error)

GenerateAPIFile returns a byte buffer containing the output of an executed template for the Kubernetes API type definitions for a service API

func (*Generator) GenerateCRDFile

func (g *Generator) GenerateCRDFile(
	crdName string,
) (*bytes.Buffer, error)

GenerateCRDFile returns a byte buffer containing the output of an executed template for a particular top-level resource/CRD

func (*Generator) GenerateCmdControllerMainFile

func (g *Generator) GenerateCmdControllerMainFile() (*bytes.Buffer, error)

GenerateCmdControllerMainFile returns a byte buffer containing the output of an executed template for a service controller's main.go file

func (*Generator) GenerateConfigFile

func (g *Generator) GenerateConfigFile(

	target string,
) (*bytes.Buffer, error)

GenerateConfigFile returns a byte buffer containing the output of an executed template for the Kubernetes YAML manifest/configuration file

func (*Generator) GenerateReleaseFile

func (g *Generator) GenerateReleaseFile(

	target string,

	releaseVersion string,

	imageRepository string,

	serviceAccountName string,
) (*bytes.Buffer, error)

GenerateReleaseFile returns a byte buffer containing the output of an executed template for a release artifact (e.g. Helm chart)

func (*Generator) GenerateResourcePackageFile

func (g *Generator) GenerateResourcePackageFile(
	crdName string,
	target string,
) (*bytes.Buffer, error)

GenerateResourcePackageFile returns a byte buffer containing the output of an executed template containing a file in a specific CRD's resource package

func (*Generator) GenerateResourceRegistryFile

func (g *Generator) GenerateResourceRegistryFile() (*bytes.Buffer, error)

GenerateResourceRegistryFile returns a byte buffer containing the output of an executed template containing the resource registry for the service controller

func (*Generator) GetCRDs

func (g *Generator) GetCRDs() ([]*ackmodel.CRD, error)

GetCRDs returns a slice of `ackmodel.CRD` structs that describe the top-level resources discovered by the code generator for an AWS service API

func (*Generator) GetEnumDefs

func (g *Generator) GetEnumDefs() ([]*ackmodel.EnumDef, error)

GetEnumDefs returns a slice of pointers to `ackmodel.EnumDef` structs which represent string fields whose value is constrained to one or more specific string values.

func (*Generator) GetTypeDefs

func (g *Generator) GetTypeDefs() ([]*ackmodel.TypeDef, map[string]string, error)

GetTypeDefs returns a slice of `ackmodel.TypeDef` pointers and a map of package import information

func (*Generator) IsShapeUsedInCRDs

func (g *Generator) IsShapeUsedInCRDs(shapeName string) bool

IsShapeUsedInCRDs returns true if the supplied shape name is a member of amy CRD's payloads or those payloads sub-member shapes

func (*Generator) RemoveIgnoredOperations

func (g *Generator) RemoveIgnoredOperations(crdOps *ackmodel.CRDOps)

RemoveIgnoredOperations updates CRDOps argument by setting those operations to nil that are configured to be ignored in generator config for the AWS service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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