Documentation
¶
Index ¶
- Constants
- func ValidateManifest(m *ManifestFile) error
- type ManifestFile
- type Parameter
- type Template
- type TemplatesFile
- func (r *TemplatesFile) Add(re ...*Template)
- func (r *TemplatesFile) Get(name string, version string) *Template
- func (r *TemplatesFile) Has(name string, version string) bool
- func (r *TemplatesFile) Remove(name string, version string) bool
- func (r *TemplatesFile) Update(re ...*Template) bool
- func (r *TemplatesFile) WriteFile(path string, perm os.FileMode) error
Constants ¶
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.