Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseTemplate ¶
ParseTemplate creates go Template with the given id from the given string content in any error occurs creating the template, an erro is returned
Types ¶
type DownloadTemplate ¶
type DownloadTemplate struct {
// contains filtered or unexported fields
}
func (*DownloadTemplate) Content ¶
func (d *DownloadTemplate) Content() string
func (*DownloadTemplate) Id ¶
func (d *DownloadTemplate) Id() string
func (*DownloadTemplate) Name ¶
func (d *DownloadTemplate) Name() string
func (*DownloadTemplate) UpdateContent ¶
func (d *DownloadTemplate) UpdateContent(newContent string)
type FileBasedTemplate ¶
FileBasedTemplate is the usual (only) type of config template monaco uses This is the usual API payload JSON file
type Template ¶
type Template interface { // id of the template, used as a key in the template cache Id() string // human readable name for this template, mostly used for debugging Name() string // string content of the template Content() string // UpdateContent sets the content of the template to the new provided one UpdateContent(newContent string) }
Template is the main interface of a configuration payload that may contain template references (using Go Templates) The only implementation used in monaco is the FilebasedTemplate, but this interface is meant to enable any usecase where the content of a configuration is not coming from a file - e.g. a possible use as a library in a terraform provider, which could implement its own extension of a Template that turns an object in TF configuration language into deployable JSON payload when Content() is called.
func CreateTemplateFromString ¶
tries to parse the given string into a template and return it
func LoadTemplate ¶
tries to load the file at the given path and turns it into a template. the name of the template will be the sanitized path.