config

package
v0.2.1-0...-3b06ce0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// StringType represents the representation of a string parameter type.
	StringType = "string"

	// IntegerType represents the representation of a integer parameter type.
	IntegerType = "integer"

	// BooleanType represents the representation of a boolean parameter type.
	BooleanType = "boolean"
)

Variables

This section is empty.

Functions

func ValidateManifest

func ValidateManifest(m *ManifestFile) error

ValidateManifest validates the expected YAML structure of a manifest.

Types

type ManifestFile

type ManifestFile struct {
	Version    string       `json:"version"`
	Parameters []*Parameter `json:"parameters"`
}

ManifestFile represents a template's metadata.

func LoadManifestData

func LoadManifestData(b []byte) (*ManifestFile, error)

LoadManifestData unmarshals YAML content into a ManifestFile.

type Parameter

type Parameter struct {
	Name         string   `json:"name"`
	Prompt       string   `json:"prompt"`
	Type         string   `json:"type"`
	Enum         []string `json:"enum"`
	Description  string   `json:"description"`
	DefaultValue string   `json:"defaultValue"`
}

Parameter represents a parameter defined as part of a template's metadata.

type Template

type Template struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	ArchivePath string `json:"archivePath"`
}

Template represents a template in the local registry.

type TemplatesFile

type TemplatesFile struct {
	Generated time.Time   `json:"generated"`
	Templates []*Template `json:"templates"`
}

TemplatesFile represents a local template registry file.

func LoadTemplatesFile

func LoadTemplatesFile(path string) (*TemplatesFile, error)

LoadTemplatesFile loads the template registry file.

func NewTemplatesFile

func NewTemplatesFile() *TemplatesFile

NewTemplatesFile creates a local template registry file of type TemplatesFile.

func (*TemplatesFile) Add

func (r *TemplatesFile) Add(re ...*Template)

Add adds a template to the registry.

func (*TemplatesFile) Get

func (r *TemplatesFile) Get(name string, version string) *Template

Get retrieves a template with a given name and version from the registry.

func (*TemplatesFile) Has

func (r *TemplatesFile) Has(name string, version string) bool

Has checks if a template with a given name and version has been installed.

func (*TemplatesFile) Remove

func (r *TemplatesFile) Remove(name string, version string) bool

Remove removes an existing template from the registry.

func (*TemplatesFile) Update

func (r *TemplatesFile) Update(re ...*Template) bool

Update updates an existing template in the registry.

func (*TemplatesFile) WriteFile

func (r *TemplatesFile) WriteFile(path string, perm os.FileMode) error

WriteFile write the template registry file.

Jump to

Keyboard shortcuts

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