helper

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapData

type MapData map[string]interface{}

MapData wraps a map satisfying the Data interface, so it can be used in the accessor methods defined below.

It is not possible to fully mirror the functionality of Data as some information available to schema.ResourceData is lost when dealing with maps.

func (MapData) Get

func (md MapData) Get(key string) interface{}

Get returns the data for the given key, or nil if the key doesn't exist in the map.

func (MapData) GetChange

func (md MapData) GetChange(key string) (interface{}, interface{})

GetChange returns the old and new value for a given key. The old and new values will always be the same.

func (MapData) GetOk

func (md MapData) GetOk(key string) (interface{}, bool)

GetOk returns the data for the given key and whether or not the key has been set to a non-zero value at some point.

func (MapData) GetOkExists

func (md MapData) GetOkExists(key string) (interface{}, bool)

GetOkExists returns the data for a given key and whether or not the key has been set to a non-nil and non-zero value.

func (MapData) HasChange

func (md MapData) HasChange(key string) bool

HasChange reports whether the key exists in the map.

func (MapData) IsNewResource

func (md MapData) IsNewResource() bool

IsNewResource always reports false.

func (MapData) Set

func (md MapData) Set(key string, value interface{}) error

Set sets the value for the given key.

type ResourceData

type ResourceData interface {

	// IsNewResource reports whether or not the resource is seen for the first
	// time.
	IsNewResource() bool

	// HasChange reports whether or not the given key has been changed.
	HasChange(key string) bool

	// GetChange returns the old and new value for a given key.
	GetChange(key string) (interface{}, interface{})

	// Get returns the data for the given key, or nil if the key doesn't exist
	// in the schema.
	Get(key string) interface{}

	// GetOk returns the data for the given key and whether or not the key
	// has been set to a non-zero value at some point.
	GetOk(key string) (interface{}, bool)

	// GetOkExists returns the data for a given key and whether or not the key
	// has been set to a non-zero value. This is only useful for determining
	// if boolean attributes have been set, if they are Optional but do not
	// have a Default value.
	GetOkExists(key string) (interface{}, bool)

	// Set sets the value for the given key.
	//
	// If the key is invalid or the value is not a correct type, an error
	// will be returned.
	Set(key string, value interface{}) error
}

The ResourceData interface represents a schema.ResourceData and defines some of its methods that are commonly used by the helper packages.

Directories

Path Synopsis
Package expand contains helper functions used to map terraform configuration to an API object.
Package expand contains helper functions used to map terraform configuration to an API object.
Package flatten contains helper functions to deal with arbitrary data structures with terraform providers.
Package flatten contains helper functions to deal with arbitrary data structures with terraform providers.

Jump to

Keyboard shortcuts

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