Documentation ¶
Index ¶
- Variables
- func SkipZeroValue(a interface{}) bool
- func StringMatchesRegexp(rs string) schema.SchemaValidateDiagFunc
- func StringNotMatchesRegexp(rs string) schema.SchemaValidateDiagFunc
- func ValidateAll(validators ...schema.SchemaValidateDiagFunc) schema.SchemaValidateDiagFunc
- type ConfigConditionFunc
- type ConfigMeta
- type ConfigProperty
- func ArrayWithObjects(rootAPIKey string, terraformKey string, fields map[string]string) ConfigProperty
- func ArrayWithStrings(rootAPIKey string, nestedAPIField string, terraformKey string) ConfigProperty
- func Conditional(apiKey, terraformKey string, condition ConfigConditionFunc) ConfigProperty
- func Discriminator(apiKey string, values DiscriminatorValues) ConfigProperty
- func Simple(apiKey, terraformKey string, filters ...ValueFilter) ConfigProperty
- type DiscriminatorValues
- type FromStateFunc
- type Registry
- type TestConfig
- type ToStateFunc
- type ValueFilter
Constants ¶
This section is empty.
Variables ¶
var EmptyTestConfig = TestConfig{TerraformCreate: "", APICreate: "{}", TerraformUpdate: "", APIUpdate: "{}"}
Functions ¶
func SkipZeroValue ¶
func SkipZeroValue(a interface{}) bool
SkipZeroValue is a ValueFilter that returns true if the value is golang's zero value or an empty slice.
func StringMatchesRegexp ¶
func StringMatchesRegexp(rs string) schema.SchemaValidateDiagFunc
func StringNotMatchesRegexp ¶
func StringNotMatchesRegexp(rs string) schema.SchemaValidateDiagFunc
func ValidateAll ¶
func ValidateAll(validators ...schema.SchemaValidateDiagFunc) schema.SchemaValidateDiagFunc
Types ¶
type ConfigConditionFunc ¶
ConfigConditionFunc is a function that checks a provided API config object for some condition and returns true if the condition is met.
func Equals ¶
func Equals(key string, value string) ConfigConditionFunc
equals returns a ConfigConditionFunc that is true if the API config contains the specified key and it has the specified value.
type ConfigMeta ¶
type ConfigMeta struct { APIType string SkipConfig bool ConfigSchema map[string]*schema.Schema Properties []ConfigProperty }
func (*ConfigMeta) APIToState ¶
func (cm *ConfigMeta) APIToState(api string) (string, error)
func (*ConfigMeta) StateToAPI ¶
func (cm *ConfigMeta) StateToAPI(state string) (string, error)
type ConfigProperty ¶
type ConfigProperty struct { ToStateFunc ToStateFunc FromStateFunc FromStateFunc }
ConfigProperty defines how a property in a API config object (e.g source/destination config) maps to terraform state and vice versa.
func ArrayWithObjects ¶
func ArrayWithObjects(rootAPIKey string, terraformKey string, fields map[string]string) ConfigProperty
func ArrayWithStrings ¶
func ArrayWithStrings(rootAPIKey string, nestedAPIField string, terraformKey string) ConfigProperty
func Conditional ¶
func Conditional(apiKey, terraformKey string, condition ConfigConditionFunc) ConfigProperty
conditional returns a ConfigProperty that maps an API config key to a terraform config key only if provided condition is satisfied for that API config.
func Discriminator ¶
func Discriminator(apiKey string, values DiscriminatorValues) ConfigProperty
discriminator returns a ConfigProperty that is not stored directly in terraform state. The corresponding API config value is set based on the provided DiscriminatorValues. if a DiscriminatorValues key exists in terraform state, the corresponding value in the values object is used.
func Simple ¶
func Simple(apiKey, terraformKey string, filters ...ValueFilter) ConfigProperty
Simple returns a ConfigProperty that maps an API config key to a terraform config key and vice versa. Additional ValueFilter filters can be applied to ignore a field in state depending on its value.
type DiscriminatorValues ¶
type DiscriminatorValues map[string]interface{}
DiscriminatorValues is a map of API config values for discriminator fields, mapped to a terraform state key of a config.
type FromStateFunc ¶
FromStateFunc modifies am API config json object using terraform state information provided by a ResourceData object. It returns the modified config and an optional error.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Entries ¶
func (r *Registry) Entries() map[string]ConfigMeta
func (*Registry) Register ¶
func (r *Registry) Register(name string, cm ConfigMeta)
type TestConfig ¶
type ToStateFunc ¶
ToStateFunc modifies a terraform state json object that represents a config object by extracting data from a provided API config json object. It returns the modified terraform state and an optional error.
type ValueFilter ¶
type ValueFilter func(a interface{}) bool