definition

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StepTypes = map[string]bool{
	"stage":     true,
	"container": true,
	"command":   true,
	"export":    true,
}

StepTypes - Defines step types

Functions

This section is empty.

Types

type CorkTemplateRenderer

type CorkTemplateRenderer struct {
	Outputs      map[string]map[string]string
	RequiredVars map[string]TemplateVar
	UserParams   map[string]string
	FuncMap      template.FuncMap
	WorkDir      string
	HostWorkDir  string
	CacheDir     string
}

func NewTemplateRenderer

func NewTemplateRenderer() *CorkTemplateRenderer

func NewTemplateRendererWithOptions

func NewTemplateRendererWithOptions(options CorkTemplateRendererOptions) *CorkTemplateRenderer

func (*CorkTemplateRenderer) AddOutput

func (c *CorkTemplateRenderer) AddOutput(stepName string, varName string, value string)

func (*CorkTemplateRenderer) ListRequiredVars added in v0.2.0

func (c *CorkTemplateRenderer) ListRequiredVars() map[string]TemplateVar

func (*CorkTemplateRenderer) Render

func (c *CorkTemplateRenderer) Render(templateStr string) (string, error)

func (*CorkTemplateRenderer) ResetRequiredVarTracker added in v0.2.0

func (c *CorkTemplateRenderer) ResetRequiredVarTracker()

type CorkTemplateRendererOptions

type CorkTemplateRendererOptions struct {
	WorkDir     string
	HostWorkDir string
	CacheDir    string
	UserParams  map[string]string
}

type Empty

type Empty struct {
}

type Export

type Export struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

Export - used for export variable definition

type Param added in v0.2.0

type Param struct {
	Type        string  `yaml:"type"`
	Default     *string `yaml:"default,omitempty"`
	Description string  `yaml:"description"`
	IsSensitive bool    `yaml:"is_sensitive"`
}

func (Param) HasDefault added in v0.2.0

func (p Param) HasDefault() bool

type ServerDefinition

type ServerDefinition struct {
	Stages  map[string]Stage `yaml:"stages"`
	Params  map[string]Param `yaml:"params"`
	Tags    []string         `yaml:"tags"`
	Version int              `yaml:"version"`
	// contains filtered or unexported fields
}

ServerDefinition - Defines a cork server

func LoadFromBytes

func LoadFromBytes(defBytes []byte) (*ServerDefinition, error)

LoadFromBytes - Loads the server definition from bytes

func LoadFromDir

func LoadFromDir(corkDir string) (*ServerDefinition, error)

Load - Loads the server definition from the default location

func LoadFromPath

func LoadFromPath(defPath string) (*ServerDefinition, error)

LoadFromPath - Loads the server definition from the specified path

func LoadFromString

func LoadFromString(defStr string) (*ServerDefinition, error)

LoadFromString - Loads the server definition from a string

func (*ServerDefinition) ListStages added in v0.2.0

func (sd *ServerDefinition) ListStages() []string

func (*ServerDefinition) ListSteps

func (sd *ServerDefinition) ListSteps(stageName string) ([]*Step, error)

ListSteps - Traverses the steps of a stage and resolves everything to a step

func (*ServerDefinition) RequiredUserParamsForStage added in v0.2.0

func (sd *ServerDefinition) RequiredUserParamsForStage(stageName string) ([]string, error)

RequiredUserParamsForStage gathers the required user params for a specific stage

func (*ServerDefinition) Validate

func (sd *ServerDefinition) Validate() error

Validate validates a definition file by running through the stages

type Stage

type Stage []*Step

Stage - Defines a stage

type Step

type Step struct {
	Type      string   `yaml:"type"`
	Name      string   `yaml:"name,omitempty"`
	Args      StepArgs `yaml:"args,omitempty"`
	MatchTags []string `yaml:"match_tags,omitempty"`
	SkipTags  []string `yaml:"skip_tags,omitempty"`
	Outputs   []string `yaml:"outputs,omitempty"`
}

Step - Defines a step

func (*Step) ReferenceName added in v0.2.0

func (s *Step) ReferenceName() string

type StepArgs

type StepArgs struct {
	Image   string            `yaml:"image,omitempty"`
	Command string            `yaml:"command,omitempty"`
	Stage   string            `yaml:"stage,omitempty"`
	Params  map[string]string `yaml:"params,omitempty"`
	Export  Export            `yaml:"export,omitempty"`
}

StepArgs - Defines a step's arguments

func (*StepArgs) ResolveArgs

func (sa *StepArgs) ResolveArgs(renderer *CorkTemplateRenderer) (*StepArgs, error)

type TemplateRenderer

type TemplateRenderer interface {
	Render(templateStr string)
	AddOutput(stepName string, varName string, value string)
}

TemplateRenderer - Interface to user for the template rendering

type TemplateVar added in v0.2.0

type TemplateVar struct {
	Type   string
	Lookup string
}

Jump to

Keyboard shortcuts

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