tfschema

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAttributes

func NewAttributes(as map[string]*configschema.Attribute) map[string]*Attribute

NewAttributes creates a new map of Attributes.

func NewBlockTypes

func NewBlockTypes(bs map[string]*configschema.NestedBlock) map[string]*NestedBlock

NewBlockTypes creates a new map of NestedBlocks.

Types

type Attribute

type Attribute struct {
	// Type is a type of the attribute's value.
	// Note that Type is not cty.Type
	// We cannot import github.com/hashicorp/terraform/vendor/github.com/zclconf/go-cty/cty
	// On the other hand, tfschema does not need a dynamic type.
	// So, we use a simple representation of type defined in this package.
	Type Type `json:"type"`
	// Required is a flag whether this attribute is required.
	Required bool `json:"required"`
	// Optional is a flag whether this attribute is optional.
	// This field conflicts with Required.
	Optional bool `json:"optional"`
	// Computed is a flag whether this attribute is computed.
	// If true, the value may come from provider rather than configuration.
	// If combined with Optional, then the config may optionally provide an
	// overridden value.
	Computed bool `json:"computed"`
	// Sensitive is a flag whether this attribute may contain sensitive information.
	Sensitive bool `json:"sensitive"`
}

Attribute is wrapper for configschema.Attribute.

func NewAttribute

func NewAttribute(a *configschema.Attribute) *Attribute

NewAttribute creates a new Attribute instance.

type Block

type Block struct {
	// Attributes is a map of any attributes.
	Attributes map[string]*Attribute `json:"attributes"`
	// BlockTypes is a map of any nested block types.
	BlockTypes map[string]*NestedBlock `json:"block_types"`
}

Block is wrapper for configschema.Block. This ia a layer for customization not enough for Terraform's core. Most of the structure is the smae as the core, but some are different.

func NewBlock

func NewBlock(b *configschema.Block) *Block

NewBlock creates a new Block instance.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a tfschema Client.

func NewClient

func NewClient(providerName string) (*Client, error)

NewClient creates a new Client instance.

func (*Client) DataSources

func (c *Client) DataSources() []terraform.DataSource

DataSources returns a list of data sources.

func (*Client) GetDataSourceSchema

func (c *Client) GetDataSourceSchema(dataSource string) (*Block, error)

GetDataSourceSchema returns a type definiton of data source.

func (*Client) GetProviderSchema

func (c *Client) GetProviderSchema() (*Block, error)

GetProviderSchema returns a type definiton of provider schema.

func (*Client) GetResourceTypeSchema

func (c *Client) GetResourceTypeSchema(resourceType string) (*Block, error)

GetResourceTypeSchema returns a type definiton of resource type.

func (*Client) Kill

func (c *Client) Kill()

Kill kills a process of the plugin.

func (*Client) Resources

func (c *Client) Resources() []terraform.ResourceType

Resources returns a list of resource types.

type NestedBlock

type NestedBlock struct {
	// Block is a nested child block.
	Block
	// Nesting is a nesting mode.
	Nesting configschema.NestingMode `json:"nesting"`
	// MinItems is a lower limit on number of nested child blocks.
	MinItems int `json:"min_items"`
	// MaxItems is a upper limit on number of nested child blocks.
	MaxItems int `json:"max_items"`
}

NestedBlock is wrapper for configschema.NestedBlock

func NewNestedBlock

func NewNestedBlock(b *configschema.NestedBlock) *NestedBlock

NewNestedBlock creates a new NestedBlock instance.

type Type

type Type struct {
	// contains filtered or unexported fields
}

Type is a type of the attribute's value.

func NewType

func NewType(t interface{}) *Type

NewType creates a new Type instance.

func (*Type) MarshalJSON

func (t *Type) MarshalJSON() ([]byte, error)

MarshalJSON returns a encoded string in JSON.

func (*Type) Name

func (t *Type) Name() (string, error)

Name returns a name of type. This method depends on the private method of cty.typeImpl.GoString(). It's fragile but in the meantime easy to implement. Ideally it should be implemented by looking at the type of cty.typeImpl.

Jump to

Keyboard shortcuts

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