template

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ImplicitParameters = []Parameter{
	{
		Name:        "name",
		Description: "application name",
		Type:        StringParamType,
		Optional:    false,
	},
	{
		Name:        "tenant",
		Description: "tenant used to deploy the application",
		Type:        StringParamType,
		Optional:    false,
	},
	{
		Name:        "working_directory",
		Description: "working directory where application is located",
		Type:        StringParamType,
		Optional:    false,
		Default:     "./",
	},
	{
		Name:        "version_prefix",
		Description: "version prefix for application",
		Type:        StringParamType,
		Optional:    false,
		Default:     "v",
	},
}

Functions

func Render

func Render(t *FulfilledTemplate, targetPath string) error

Types

type Argument

type Argument struct {
	Name  string
	Value any
}

type FulfilledTemplate

type FulfilledTemplate struct {
	Spec      *Spec
	Arguments []Argument
}

type Parameter

type Parameter struct {
	Name        string        `yaml:"name"`
	Description string        `yaml:"description"`
	Type        ParameterType `yaml:"type"`
	Default     string        `yaml:"default"`
	Optional    bool          `yaml:"optional"`
}

func (Parameter) ValidateAndMap added in v0.23.1

func (p Parameter) ValidateAndMap(value string) (any, error)

type ParameterType

type ParameterType string
var (
	StringParamType ParameterType = "string"
	IntParamType    ParameterType = "int"
)

func (ParameterType) ValidateAndMap added in v0.23.1

func (t ParameterType) ValidateAndMap(value string) (any, error)

type Spec

type Spec struct {
	Name         string      `yaml:"name"`
	Description  string      `yaml:"description"`
	SkeletonPath string      `yaml:"skeletonPath"`
	Parameters   []Parameter `yaml:"parameters"`
	// contains filtered or unexported fields
}

func FindByName

func FindByName(templatesPath string, name string) (*Spec, error)

func List

func List(templatesPath string) ([]Spec, error)

func (*Spec) GetParameter added in v0.23.1

func (t *Spec) GetParameter(name string) *Parameter

func (*Spec) IsValid

func (t *Spec) IsValid() bool

Jump to

Keyboard shortcuts

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