template

package
v0.0.0-...-f8ed139 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAttributes

func BuildAttributes(filePath string, defaults map[string]interface{}) map[string]interface{}

func ResolveTemplate

func ResolveTemplate(templatePath string, attributes map[string]interface{}) (string, error)

ResolveTemplate resolves a template according to the attributes passed

Types

type AttributesMetadata

type AttributesMetadata map[string]map[string]map[string]SingleAttributeMetadata

AttributesMetadata holds a whole collection of MetadataAttribute organized into three levels: <resource-type>/<resource-name>/<attribute-name> (e.g. "svc/frontend/balancer")

type Metadata

type Metadata struct {
	Name                   string
	Maintainer             string
	Email                  string
	Description            string
	Version                string
	Attributes             AttributesMetadata
	ReplicationControllers map[string]string `yaml:"rc"`
	Services               map[string]string `yaml:"svc"`
	// contains filtered or unexported fields
}

Metadata holds generic info about the deployment's resources and attributes

func ParseMetadata

func ParseMetadata(path string) Metadata

ParseMetadata parses the metadata file in the kube dir

func (Metadata) AttributeDefaults

func (m Metadata) AttributeDefaults() (map[string]interface{}, error)

AttributeDefaults returns default values for attributes

func (Metadata) CheckRequiredAttributes

func (m Metadata) CheckRequiredAttributes(attributes map[string]interface{}) error

CheckRequiredAttributes returns an error if some required attribute is missing

func (Metadata) ParseControllers

func (m Metadata) ParseControllers(attributes map[string]interface{}) (map[string]string, error)

ParseControllers parses the replication controllers in the kube and returns their JSON representations

func (Metadata) ParseServices

func (m Metadata) ParseServices(attributes map[string]interface{}) (map[string]string, error)

ParseServices parses the service templates in the kube and returns their JSON representations

func (Metadata) RequiredAttributes

func (m Metadata) RequiredAttributes() ([]string, error)

RequiredAttributes returns default values for attributes

type SingleAttributeMetadata

type SingleAttributeMetadata struct {
	Description string      // Description of the attribute
	Default     interface{} // Default value for the attribute: could be string, number, or bool
	Required    bool        // Required or not
}

SingleAttributeMetadata holds metadata for a configuration attribute

Jump to

Keyboard shortcuts

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