templateprov

package
v0.0.0-...-a07f48f Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// Guid is a random uuid generated the first time this resource is added to the project.
	Guid string

	// Uid is the combined id like type.class#id
	Uid string
	// Type is always defined as the resource type
	Type string
	// Class is the resource class, it defaults to 'default'
	Class string
	// Id is the resource id, like 'global-id' or 'workload.res-name'
	Id string

	Params   map[string]interface{}
	Metadata map[string]interface{}

	Init   map[string]interface{}
	State  map[string]interface{}
	Shared map[string]interface{}

	SourceWorkload   string
	WorkloadServices map[string]provisioners.NetworkService
}

Data is the structure sent to each template during rendering.

type Provisioner

type Provisioner struct {
	ProvisionerUri string  `yaml:"uri"`
	ResType        string  `yaml:"type"`
	ResClass       *string `yaml:"class,omitempty"`
	ResId          *string `yaml:"id,omitempty"`

	// The InitTemplate is always evaluated first, it is used as temporary or working set data that may be needed in the
	// later templates. It has access to the resource inputs and previous state.
	InitTemplate string `yaml:"init,omitempty"`
	// StateTemplate generates the new state of the resource based on the init and previous state.
	StateTemplate string `yaml:"state,omitempty"`
	// SharedStateTemplate generates modifications to the shared state, based on the init and current state.
	SharedStateTemplate string `yaml:"shared,omitempty"`
	// OutputsTemplate generates the outputs of the resource, based on the init and current state.
	OutputsTemplate string `yaml:"outputs,omitempty"`

	ManifestsTemplate string `yaml:"manifests,omitempty"`
}

Provisioner is the decoded template provisioner. A template provisioner provisions a resource by evaluating a series of Go text/templates that have access to some input parameters, previous state, and utility functions. Each parameter is expected to return a JSON object.

func Parse

func Parse(raw map[string]interface{}) (*Provisioner, error)

func (*Provisioner) Match

func (p *Provisioner) Match(resUid framework.ResourceUid) bool

func (*Provisioner) Provision

func (*Provisioner) Uri

func (p *Provisioner) Uri() string

Jump to

Keyboard shortcuts

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