templates

package
v0.0.6-rc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterpolateLeafNode

func InterpolateLeafNode(executor TemplateExecutor, template []byte, tagInterpolator tagInterpolator) (interface{}, error)

InterpolateLeafNode merges the context variables anywhere a $(<<jsonPath>>)$ tag is found It validates that the jsonPath refers to objects within the context

func NewClusterConfigTemplateModel

func NewClusterConfigTemplateModel(template *v1alpha1.ClusterConfigTemplate, eval evaluator) *clusterConfigTemplate

func NewClusterImageTemplateModel

func NewClusterImageTemplateModel(template *v1alpha1.ClusterImageTemplate, eval evaluator) *clusterImageTemplate

func NewClusterSourceTemplateModel

func NewClusterSourceTemplateModel(template *v1alpha1.ClusterSourceTemplate, eval evaluator) *clusterSourceTemplate

func NewClusterTemplateModel

func NewClusterTemplateModel(template *v1alpha1.ClusterTemplate) *clusterTemplate

Types

type Config

type Config interface{}

type ConfigInput

type ConfigInput struct {
	Config interface{} `json:"config"`
	Name   string      `json:"name"`
}

type Image

type Image interface{}

type ImageInput

type ImageInput struct {
	Image interface{} `json:"image"`
	Name  string      `json:"name"`
}

type Inputs

type Inputs struct {
	Sources []SourceInput `json:"sources"`
	Images  []ImageInput  `json:"images"`
	Configs []ConfigInput `json:"configs"`
}

type JsonPathContext

type JsonPathContext interface{}

JsonPathContext is any structure that you intend for jsonpath to treat as it's context. typically any struct with template-specific json structure tags

type JsonPathError

type JsonPathError struct {
	Err error
	// contains filtered or unexported fields
}

func NewJsonPathError

func NewJsonPathError(expression string, err error) JsonPathError

func (JsonPathError) Error

func (e JsonPathError) Error() string

func (JsonPathError) JsonPathExpression

func (e JsonPathError) JsonPathExpression() string

type Labels

type Labels map[string]string

type Output

type Output struct {
	Source *Source
	Image  Image
	Config Config
}

type Outputs added in v0.0.5

type Outputs map[string]apiextensionsv1.JSON

type Param

type Param struct {
	Name  string               `json:"name"`
	Value apiextensionsv1.JSON `json:"value"`
}

type Params

type Params []Param

func ParamsBuilder

func ParamsBuilder(defaultParams v1alpha1.DefaultParams, componentParams []v1alpha1.SupplyChainParam) Params

type RunTemplate added in v0.0.5

type RunTemplate interface {
	GetName() string
	GetResourceTemplate() v1alpha1.TemplateSpec
	GetOutput(stampedObject *unstructured.Unstructured) (Outputs, error)
}

func NewRunTemplateModel added in v0.0.5

func NewRunTemplateModel(template *v1alpha1.RunTemplate) RunTemplate

type Source

type Source struct {
	URL      interface{} `json:"url"`
	Revision interface{} `json:"revision"`
}

type SourceInput

type SourceInput struct {
	URL      interface{} `json:"url"`
	Revision interface{} `json:"revision"`
	Name     string      `json:"name"`
}

type Stamper

type Stamper struct {
	TemplatingContext JsonPathContext
	Owner             client.Object
	Labels            Labels
}

func StamperBuilder

func StamperBuilder(owner client.Object, templatingContext JsonPathContext, labels Labels) Stamper

func (*Stamper) Stamp

func (s *Stamper) Stamp(ctx context.Context, resourceTemplate v1alpha1.TemplateSpec) (*unstructured.Unstructured, error)

type StandardTagInterpolator

type StandardTagInterpolator struct {
	Context   JsonPathContext
	Evaluator evaluator
}

func (StandardTagInterpolator) Evaluate

func (t StandardTagInterpolator) Evaluate(tag string) (interface{}, error)

func (StandardTagInterpolator) InterpolateTag

func (t StandardTagInterpolator) InterpolateTag(w io.Writer, tag string) (int, error)

type Template

type Template interface {
	GetResourceTemplate() v1alpha1.TemplateSpec
	GetDefaultParams() v1alpha1.DefaultParams
	GetOutput(stampedObject *unstructured.Unstructured) (*Output, error)
	GetName() string
	GetKind() string
}

func NewModelFromAPI

func NewModelFromAPI(template client.Object) (Template, error)

type TemplateExecutor

type TemplateExecutor func(template, startTag, endTag string, f fasttemplate.TagFunc) (string, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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