templateset

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTemplateNotFound is returned when a template path couldn't be located
	// in any base search path
	ErrTemplateNotFound = errors.New("Template Not Found")
)

Functions

This section is empty.

Types

type MetaVars

type MetaVars struct {
	// ControllerName contains the exact string used to identify the ACK
	// controller in the aws-controllers-k8s project. This name is used as the
	// name of the ACK controller's module, repository and helm chart.
	ControllerName string
	// ServiceModelName 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 name does not match the ServiceID. e.g. The AWS Step Functions
	// API has a ServiceID of "SFN" and a service model name of "states"...
	ServiceModelName string
	// ServicePackageName contains the exact string used to identify the AWS
	// service API in the aws-sdk-go `service/` directory. It is also used as
	// the identifier for the ACK controller's name and packages.
	ServicePackageName string
	// ServiceID is the exact string that appears in the AWS service API's
	// api-2.json descriptor file under `metadata.serviceId`
	ServiceID 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
	// ClientInterfaceTypeName is the name of the interface type used by the
	// aws-sdk-go services/$SERVICE/api.go file
	ClientInterfaceTypeName string
	// ClientStructTypeName is the name of the struct type defining the service
	// sdk client.
	ClientStructTypeName 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(
	baseSearchPaths []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