Documentation ¶
Index ¶
- Variables
- func BuiltinBackend() starlark.Value
- func BuiltinFunctionComputed() starlark.Value
- func BuiltinHCL() starlark.Value
- func BuiltinProvider(pm *terraform.PluginManager) starlark.Value
- func BuiltinProvisioner(pm *terraform.PluginManager) starlark.Value
- type Backend
- type Computed
- type HCLCompatible
- type Kind
- type MapSchema
- func (m *MapSchema) Attr(name string) (starlark.Value, error)
- func (s *MapSchema) AttrNames() []string
- func (m *MapSchema) Freeze()
- func (m *MapSchema) Hash() (uint32, error)
- func (m *MapSchema) Name() string
- func (m *MapSchema) String() string
- func (t *MapSchema) ToHCL(b *hclwrite.Body)
- func (m *MapSchema) Truth() starlark.Bool
- func (m *MapSchema) Type() string
- type NamedValue
- type Provider
- func (p *Provider) Attr(name string) (starlark.Value, error)
- func (p *Provider) AttrNames() []string
- func (x *Provider) CompareSameType(op syntax.Token, y_ starlark.Value, depth int) (bool, error)
- func (p *Provider) String() string
- func (s *Provider) ToHCL(b *hclwrite.Body)
- func (p *Provider) Type() string
- type Provisioner
- type Resource
- func (r *Resource) Attr(name string) (starlark.Value, error)
- func (r *Resource) AttrNames() []string
- func (x *Resource) CompareSameType(op syntax.Token, y_ starlark.Value, depth int) (bool, error)
- func (r *Resource) Freeze()
- func (r *Resource) Hash() (uint32, error)
- func (r *Resource) LoadDict(d *starlark.Dict) error
- func (r *Resource) Name() string
- func (r *Resource) SetField(name string, v starlark.Value) error
- func (r *Resource) String() string
- func (r *Resource) ToHCL(b *hclwrite.Body)
- func (r *Resource) Truth() starlark.Bool
- func (r *Resource) Type() string
- type ResourceCollection
- func (c *ResourceCollection) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
- func (c *ResourceCollection) Freeze()
- func (c *ResourceCollection) Hash() (uint32, error)
- func (c *ResourceCollection) LoadList(l *starlark.List) error
- func (c *ResourceCollection) MakeResource(name string, dict *starlark.Dict) (*Resource, error)
- func (c *ResourceCollection) Name() string
- func (c *ResourceCollection) String() string
- func (c *ResourceCollection) ToHCL(b *hclwrite.Body)
- func (c *ResourceCollection) Truth() starlark.Bool
- func (c *ResourceCollection) Type() string
- type Type
- type Value
- type Values
- func (a Values) ForEach(cb func(*NamedValue) error) error
- func (a Values) Get(name string) *NamedValue
- func (a Values) Has(name string) bool
- func (a Values) Hash() (uint32, error)
- func (a Values) Len() int
- func (a Values) List() []*NamedValue
- func (a *Values) Set(name string, v *Value) *NamedValue
- func (a Values) ToStringDict(d starlark.StringDict)
Constants ¶
This section is empty.
Variables ¶
var NameGenerator = func() string { t := time.Now() entropy := ulid.Monotonic(rand.New(rand.NewSource(t.UnixNano())), 0) return fmt.Sprintf("id_%s", ulid.MustNew(ulid.Timestamp(t), entropy)) }
NameGenerator function used to generate Resource names, by default is based on a ULID generator.
Functions ¶
func BuiltinBackend ¶
func BuiltinFunctionComputed ¶
func BuiltinHCL ¶
func BuiltinProvider ¶
func BuiltinProvider(pm *terraform.PluginManager) starlark.Value
func BuiltinProvisioner ¶
func BuiltinProvisioner(pm *terraform.PluginManager) starlark.Value
Types ¶
type Computed ¶
type Computed struct {
// contains filtered or unexported fields
}
func NewComputedWithPath ¶
type HCLCompatible ¶
type Kind ¶
type Kind string
Kind describes what kind of resource is represented by a Resource isntance.
type MapSchema ¶
type MapSchema struct {
// contains filtered or unexported fields
}
func NewMapSchema ¶
type NamedValue ¶
NamedValue represents a Value with a given name.
type Provider ¶
type Provider struct { *Resource // contains filtered or unexported fields }
Provider represents a provider as a starlark.Value.
func MakeProvider ¶
func MakeProvider(pm *terraform.PluginManager, name, version, alias string) (*Provider, error)
MakeProvider returns a new Provider instance from a given name version and alias.
func (*Provider) CompareSameType ¶
CompareSameType honors starlark.Comprable interface.
type Provisioner ¶
type Provisioner struct { *Resource // contains filtered or unexported fields }
func MakeProvisioner ¶
func MakeProvisioner(pm *terraform.PluginManager, name string) (*Provisioner, error)
func (*Provisioner) ToHCL ¶
func (s *Provisioner) ToHCL(b *hclwrite.Body)
func (*Provisioner) Type ¶
func (p *Provisioner) Type() string
Type honors the starlark.Value interface. It shadows p.Resource.Type.
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource represents a resource as a starlark.Value, it can be of four kinds, provider, resource, data source or a nested resource.
func MakeResource ¶
func MakeResource(name, typ string, k Kind, b *configschema.Block, provider *Provider, parent *Resource) *Resource
MakeResource returns a new resource of the given kind, type based on the given configschema.Block.
func (*Resource) CompareSameType ¶
CompareSameType honors starlark.Comprable interface.
type ResourceCollection ¶
func NewResourceCollection ¶
func NewResourceCollection( typ string, k Kind, block *configschema.Block, provider *Provider, parent *Resource, ) *ResourceCollection
func (*ResourceCollection) CallInternal ¶
func (c *ResourceCollection) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
CallInternal honors the starlark.Callable interface.
func (*ResourceCollection) Freeze ¶
func (c *ResourceCollection) Freeze()
Freeze honors the starlark.Value interface.
func (*ResourceCollection) Hash ¶
func (c *ResourceCollection) Hash() (uint32, error)
Hash honors the starlark.Value interface.
func (*ResourceCollection) LoadList ¶
func (c *ResourceCollection) LoadList(l *starlark.List) error
LoadList loads a list of dicts on the collection. It clears the collection.
func (*ResourceCollection) MakeResource ¶
MakeResource it makes a new resource and loads the dict on it.
func (*ResourceCollection) Name ¶
func (c *ResourceCollection) Name() string
Name honors the starlark.Callable interface.
func (*ResourceCollection) String ¶
func (c *ResourceCollection) String() string
String honors the starlark.Value interface.
func (*ResourceCollection) ToHCL ¶
func (c *ResourceCollection) ToHCL(b *hclwrite.Body)
func (*ResourceCollection) Truth ¶
func (c *ResourceCollection) Truth() starlark.Bool
Truth honors the starlark.Value interface.
func (*ResourceCollection) Type ¶
func (c *ResourceCollection) Type() string
Type honors the starlark.Value interface.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type is a helper to manipulate and transform starlark.Type and cty.Type
func MustTypeFromCty ¶
MustTypeFromCty returns a Type froma given cty.Type. Panics if error.
func MustTypeFromStarlark ¶
MustTypeFromStarlark returns a Type from a given starlark type string. Panics if error.
func NewTypeFromCty ¶
NewTypeFromCty returns a Type froma given cty.Type.
func NewTypeFromStarlark ¶
NewTypeFromStarlark returns a Type from a given starlark type string.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is helper to manipulate and transform starlark.Value to go types and cty.Value.
func (*Value) Interface ¶
func (v *Value) Interface() interface{}
Interface returns the value as a Go value.
type Values ¶
type Values struct {
// contains filtered or unexported fields
}
Values is a list of NamedValues.
func (Values) ForEach ¶
func (a Values) ForEach(cb func(*NamedValue) error) error
ForEach call cb for each value on Values, it stop the iteration an error is returned.
func (Values) Get ¶
func (a Values) Get(name string) *NamedValue
Get returns the NamedValue with the given name, if any.
func (Values) List ¶
func (a Values) List() []*NamedValue
List return a list of NamedValues sorted by name.
func (*Values) Set ¶
func (a *Values) Set(name string, v *Value) *NamedValue
Set sets a name and a value and returns it as a NamedValue.
func (Values) ToStringDict ¶
func (a Values) ToStringDict(d starlark.StringDict)
ToStringDict adds a name/value entry to d for each field of the struct.