Documentation ¶
Index ¶
- Constants
- func ExtractEnv(v string) (res []string)
- func Heredoc(raw string) (res string)
- func Interpolate(v string, env ...map[string]string) (res string)
- func IsEqual(left, right *Pod) (ok bool)
- func ParseList(lists []*ast.ObjectList, key string, parser ListParser) (err error)
- type Blob
- type Blobs
- type Constraint
- type FlatMap
- type ListParser
- type ObjectParser
- type Pod
- type PodSlice
- type Provider
- type Providers
- type Resource
- func (r Resource) Clone() (res Resource)
- func (r *Resource) GetAllocationConstraint(podName string) (res Constraint)
- func (r Resource) GetID(parent ...string) string
- func (r *Resource) GetRequestConstraint() (res Constraint)
- func (r *Resource) GetValuesKey(podName string) (res string)
- func (r *Resource) ParseAST(raw *ast.ObjectItem) (err error)
- type Resources
- type Transition
- type Unit
- type Units
- type WithID
Constants ¶
View Source
const ( PrivateNamespace = "private" PublicNamespace = "public" )
Variables ¶
This section is empty.
Functions ¶
func ExtractEnv ¶
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
type Constraint ¶
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) 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 ¶
FlatMap
func (FlatMap) Interpolate ¶
Interpolate source
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
type PodSlice ¶
type PodSlice []*Pod
func (*PodSlice) Empty ¶
func (r *PodSlice) Empty() ObjectParser
func (*PodSlice) SetNamespace ¶
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
type Providers ¶
type Providers []Provider
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) GetAllocationConstraint ¶
func (r *Resource) GetAllocationConstraint(podName string) (res Constraint)
Returns required constraint for provision with allocated resource
func (*Resource) GetRequestConstraint ¶
func (r *Resource) GetRequestConstraint() (res Constraint)
Returns "resource.request.<kind>.allow": "true"
func (*Resource) GetValuesKey ¶
Returns `resource.<kind>.<pod>.<name>.__values_json`
type Resources ¶
type Resources []Resource
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 }
Click to show internal directories.
Click to hide internal directories.