manifest

package
v0.0.0-...-3a937ec Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrivateNamespace = "private"
	PublicNamespace  = "public"
)

Variables

This section is empty.

Functions

func ExtractEnv

func ExtractEnv(v string) (res []string)

func Heredoc

func Heredoc(raw string) (res string)

func Interpolate

func Interpolate(v string, env ...map[string]string) (res string)

func IsEqual

func IsEqual(left, right *Pod) (ok bool)

Compare

func ParseList

func ParseList(lists []*ast.ObjectList, key string, parser ListParser) (err error)

Types

type Blob

type Blob struct {
	Name        string
	Permissions int  `json:",omitempty"`
	Leave       bool `json:",omitempty"`
	Source      string
}

Pod file

func (Blob) GetID

func (b Blob) GetID(parent ...string) string

func (*Blob) ParseAST

func (b *Blob) ParseAST(raw *ast.ObjectItem) (err error)

type Blobs

type Blobs []Blob

func (*Blobs) Append

func (b *Blobs) Append(v interface{}) (err error)

func (*Blobs) Empty

func (b *Blobs) Empty() ObjectParser

type Constraint

type Constraint map[string]string

Constraint can contain interpolations in form ${ns.key}. Right field can also begins with compare operation: "<", ">" or "~" (in).

func (Constraint) Check

func (c Constraint) Check(env map[string]string) (err error)

Check constraint against given environment

func (Constraint) Clone

func (c Constraint) Clone() (res Constraint)

Returns clone of constraint

func (Constraint) FilterOut

func (c Constraint) FilterOut(prefix ...string) (res Constraint)

FilterOut returns Constraint without pairs which contains references with given prefixes

func (Constraint) Merge

func (c Constraint) Merge(constraint ...Constraint) (res Constraint)

Merge returns constraint merged with given constraints

type FlatMap

type FlatMap map[string]string

FlatMap

func (FlatMap) Filter

func (e FlatMap) Filter(r ...*regexp.Regexp) (res FlatMap)

Return flatmap without regex

func (FlatMap) Interpolate

func (e FlatMap) Interpolate(source string) (res string)

Interpolate source

func (FlatMap) Merge

func (e FlatMap) Merge(env ...FlatMap) (res FlatMap)

Merge values with environment

func (FlatMap) WithJSON

func (e FlatMap) WithJSON(key string) (j FlatMap)

type ListParser

type ListParser interface {
	Empty() ObjectParser
	Append(v interface{}) (err error)
}

type ObjectParser

type ObjectParser interface {
	WithID
	ParseAST(raw *ast.ObjectItem) (err error)
}

type Pod

type Pod struct {
	Namespace  string
	Name       string
	Runtime    bool
	Target     string
	Constraint Constraint `json:",omitempty"`
	Units      Units      `json:",omitempty" hcl:"-"`
	Blobs      Blobs      `json:",omitempty" hcl:"-"`
	Resources  Resources  `json:",omitempty" hcl:"-"`
	Providers  Providers  `json:",omitempty" hcl:"-"`
}

Pod manifest

func (Pod) GetID

func (p Pod) GetID(parent ...string) string

func (*Pod) Mark

func (p *Pod) Mark() (res uint64)

Get Pod checksum

func (*Pod) ParseAST

func (p *Pod) ParseAST(raw *ast.ObjectItem) (err error)

type PodSlice

type PodSlice []*Pod

func (*PodSlice) Append

func (r *PodSlice) Append(v interface{}) (err error)

func (*PodSlice) Empty

func (r *PodSlice) Empty() ObjectParser

func (*PodSlice) SetNamespace

func (r *PodSlice) SetNamespace(namespace string)

func (*PodSlice) Unmarshal

func (r *PodSlice) Unmarshal(namespace string, reader ...io.Reader) (err error)

type Provider

type Provider struct {
	Kind   string                 // Resource kind: range, pool ...
	Name   string                 // Logical name unique within pod
	Config map[string]interface{} `json:",omitempty"`
}

Resource provider

func (Provider) GetID

func (p Provider) GetID(parent ...string) string

func (Provider) ID

func (p Provider) ID(parent string) string

func (*Provider) ParseAST

func (p *Provider) ParseAST(raw *ast.ObjectItem) (err error)

type Providers

type Providers []Provider

func (*Providers) Append

func (p *Providers) Append(v interface{}) (err error)

func (*Providers) Empty

func (p *Providers) Empty() ObjectParser

type Resource

type Resource struct {

	// Resource name unique within pod
	Name string `hcl:"-"`

	// Provider
	Provider string `hcl:"-"`

	// Request config
	Config map[string]interface{} `json:",omitempty" hcl:"-"`
}

Resources are referenced by ${resource.<pod>.<name>}

func (Resource) Clone

func (r Resource) Clone() (res Resource)

func (*Resource) GetAllocationConstraint

func (r *Resource) GetAllocationConstraint(podName string) (res Constraint)

Returns required constraint for provision with allocated resource

func (Resource) GetID

func (r Resource) GetID(parent ...string) string

func (*Resource) GetRequestConstraint

func (r *Resource) GetRequestConstraint() (res Constraint)

Returns "resource.request.<kind>.allow": "true"

func (*Resource) GetValuesKey

func (r *Resource) GetValuesKey(podName string) (res string)

Returns `resource.<kind>.<pod>.<name>.__values_json`

func (*Resource) ParseAST

func (r *Resource) ParseAST(raw *ast.ObjectItem) (err error)

type Resources

type Resources []Resource

func (*Resources) Append

func (r *Resources) Append(v interface{}) (err error)

func (*Resources) Empty

func (r *Resources) Empty() ObjectParser

type Transition

type Transition struct {
	Create    string `json:",omitempty"`
	Update    string `json:",omitempty"`
	Destroy   string `json:",omitempty"`
	Permanent bool   `json:",omitempty"`
}

Unit transition

type Unit

type Unit struct {
	Transition `json:",omitempty" hcl:",squash"`
	Name       string
	Source     string
}

func (Unit) GetID

func (u Unit) GetID(parent ...string) string

func (*Unit) ParseAST

func (u *Unit) ParseAST(raw *ast.ObjectItem) (err error)

type Units

type Units []Unit

func (*Units) Append

func (u *Units) Append(v interface{}) (err error)

func (*Units) Empty

func (u *Units) Empty() ObjectParser

type WithID

type WithID interface {
	GetID(parent ...string) string // Get entity ID
}

WithID represents single manifest entity

Jump to

Keyboard shortcuts

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