templateset

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetaVars

type MetaVars struct {
	// ServiceAlias contains the exact string used to identify the AWS service
	// API in the aws-sdk-go's models/apis/ directory. Note that some APIs this
	// alias does not match the ServiceID. e.g. The AWS Step Functions API has
	// a ServiceID of "SFN" and a service alias of "states"...
	ServiceAlias string
	// ServiceID is the exact string that appears in the AWS service API's
	// api-2.json descriptor file under `metadata.serviceId`
	ServiceID string
	// ServiceIDClean is the ServiceID lowercased and stripped of any
	// non-alphanumeric characters
	ServiceIDClean string
	// APIVersion contains the version of the Kubernetes API resources, e.g.
	// "v1alpha1"
	APIVersion string
	// APIGroup contains the normalized name of the Kubernetes APIGroup used
	// for custom resources, e.g. "sns.services.k8s.aws" or
	// "sfn.services.k8s.aws"
	APIGroup string
	// SDKAPIInterfaceTypeName is the name of the interface type used by the
	// aws-sdk-go services/$SERVICE/api.go file
	SDKAPIInterfaceTypeName string
	//CRDNames contains all crds names lowercased and in plural
	CRDNames []string
}

MetaVars contains template variables that most templates need access to that describe the service alias, its package name, etc

type TemplateSet

type TemplateSet struct {
	// contains filtered or unexported fields
}

TemplateSet contains a set of templates and copy files for a particular target

func New

func New(
	templateBasePath string,
	includePaths []string,
	copyPaths []string,
	funcMap ttpl.FuncMap,
) *TemplateSet

New returns a pointer to a TemplateSet

func (*TemplateSet) Add

func (ts *TemplateSet) Add(
	outPath string,
	templatePath string,
	vars interface{},
) error

Add constructs a named template from a path and variables

func (*TemplateSet) Execute

func (ts *TemplateSet) Execute() error

Execute runs all of the template and copy files in our TemplateSet and returns whether any error occurred executing any of the templates. Once Execute() is run, `TemplateSet.Executed()` can be used to iterate over a set of byte buffers containing the output of executed templates

func (*TemplateSet) Executed

func (ts *TemplateSet) Executed() map[string]*bytes.Buffer

Executed returns a map, keyed by the template or copy file path, of *bytes.Buffer objects containing executed template or copied file contents

Jump to

Keyboard shortcuts

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