2016-11-16 02:42:22 +01:00
|
|
|
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
|
|
|
|
2016-11-29 00:15:49 +01:00
|
|
|
package compiler
|
2016-11-16 02:42:22 +01:00
|
|
|
|
|
|
|
import (
|
2016-11-16 18:29:44 +01:00
|
|
|
"github.com/marapongo/mu/pkg/ast"
|
2016-11-29 00:15:49 +01:00
|
|
|
"github.com/marapongo/mu/pkg/compiler/backends"
|
2016-11-16 02:42:22 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// Context holds all state available to any templates or code evaluated at compile-time.
|
|
|
|
type Context struct {
|
2016-11-29 00:15:49 +01:00
|
|
|
Arch backends.Arch // the target cloud architecture.
|
2016-11-29 01:18:38 +01:00
|
|
|
Cluster ast.Cluster // the cluster that we will deploy to.
|
2016-11-25 21:58:29 +01:00
|
|
|
Properties ast.PropertyBag // properties supplied at stack construction time.
|
|
|
|
}
|
|
|
|
|
2016-11-29 00:15:49 +01:00
|
|
|
// WithProps returns a new clone of this Context with the given properties attached to it.
|
2016-11-25 21:58:29 +01:00
|
|
|
func (c *Context) WithProps(props ast.PropertyBag) *Context {
|
|
|
|
return &Context{
|
|
|
|
Properties: props,
|
|
|
|
}
|
2016-11-16 02:42:22 +01:00
|
|
|
}
|