Documentation
¶
Index ¶
- Variables
- func AttributeValueLength(v attr.Value) int
- func AttributeValueToBigFloat(v attr.Value) (*big.Float, error)
- func AttributeValueToFloat64(v attr.Value) (float64, big.Accuracy, error)
- func AttributeValueToInt64(v attr.Value) (int64, big.Accuracy, error)
- func AttributeValueToString(v attr.Value) string
- func AttributeValueToStrings(av attr.Value) []string
- func BoolPtrToBoolValue(b *bool) types.Bool
- func BoolToBoolValue(b bool) types.Bool
- func BoolValueToBool(v attr.Value) bool
- func BoolValueToBoolPtr(v attr.Value) *bool
- func BoolValueToString(v attr.Value) string
- func BytesToStringValue(b []byte) types.String
- func Float32ToFloat64Value(f float32) types.Float64
- func Float32ToNumberValue(f float32) types.Number
- func Float64ToFloat64Value(f float64) types.Float64
- func Float64ToNumberValue(f float64) types.Number
- func Float64ValueToFloat32(v attr.Value) float32
- func Float64ValueToFloat64(v attr.Value) float64
- func Float64ValueToString(v attr.Value) string
- func FormatAttributePathSteps(pathSteps ...tftypes.AttributePathStep) string
- func FormatAttributePaths(paths ...*tftypes.AttributePath) string
- func FormatPathPathSteps(pathSteps ...path.PathStep) string
- func FormatPathPaths(paths ...path.Path) string
- func GoNumberToString(num interface{}) string
- func Int64ListToInts(v attr.Value) []int
- func Int64SetToInts(v attr.Value) []int
- func Int64ToInt64Value(i int64) types.Int64
- func Int64ToNumberValue(i int64) types.Number
- func Int64ValueToInt(v attr.Value) int
- func Int64ValueToInt64(v attr.Value) int64
- func Int64ValueToIntPtr(v attr.Value) *int
- func Int64ValueToString(v attr.Value) string
- func IntPtrToInt64Value(i *int) types.Int64
- func IntToInt64Value(i int) types.Int64
- func IntToNumberValue(i int) types.Number
- func IntsToInt64List(in []int, nullOnEmpty bool) types.List
- func IntsToInt64Set(in []int, nullOnEmpty bool) types.Set
- func IsValueIsEmptyError(err error) bool
- func IsValueIsNullError(err error) bool
- func IsValueIsUnknownError(err error) bool
- func IsValueTypeUnhandledError(err error) bool
- func LengthOfListValue(v attr.Value) int
- func LengthOfMapValue(v attr.Value) int
- func LengthOfSetValue(v attr.Value) int
- func LengthOfStringValue(v attr.Value) int
- func NumberListToInts(v attr.Value) []int
- func NumberSetToInts(v attr.Value) []int
- func NumberValueToBigFloat(v attr.Value) *big.Float
- func NumberValueToFloat64(v attr.Value) (float64, big.Accuracy)
- func NumberValueToInt(v attr.Value) (int, big.Accuracy)
- func NumberValueToInt64(v attr.Value) (int64, big.Accuracy)
- func NumberValueToString(v attr.Value) string
- func StringListToStrings(v attr.Value) []string
- func StringPtrToStringValue(s *string) types.String
- func StringSetToStrings(v attr.Value) []string
- func StringToStringValue(s string) types.String
- func StringValueToBytes(v attr.Value) []byte
- func StringValueToFloat64(v attr.Value) (float64, error)
- func StringValueToInt64(v attr.Value) (int, error)
- func StringValueToString(v attr.Value) string
- func StringValueToStringPtr(v attr.Value) *string
- func StringsToStringList(in []string, nullOnEmpty bool) types.List
- func StringsToStringSet(in []string, nullOnEmpty bool) types.Set
- func TestAttributeValueState(av attr.Value) error
- func ValueToBoolType(v attr.Value) types.Bool
- func ValueToFloat64Type(v attr.Value) types.Float64
- func ValueToInt64Type(v attr.Value) types.Int64
- func ValueToListType(v attr.Value) types.List
- func ValueToMapType(v attr.Value) types.Map
- func ValueToNumberType(v attr.Value) types.Number
- func ValueToObjectType(v attr.Value) types.Object
- func ValueToSetType(v attr.Value) types.Set
- func ValueToStringType(v attr.Value) types.String
- func ValueTypeUnhandledError(scope string, av attr.Value) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrValueIsNull = errors.New("value is nil") ErrValueIsUnknown = errors.New("value is unknown") ErrValueIsEmpty = errors.New("value is empty") ErrValueTypeUnhandled = errors.New("value type is unhandled, this usually means this package is out of date with the upstream provider framework") )
var FloatPrecision uint = 3
Functions ¶
func AttributeValueLength ¶
AttributeValueLength attempts to determine the "length" of an attribute value, for types where that value has significance.
func AttributeValueToBigFloat ¶
AttributeValueToBigFloat accepts either a literal or pointer to a concrete attr.Value implementation, attempting to return a *big.Float instance of its value.
func AttributeValueToFloat64 ¶
AttributeValueToFloat64 accepts either a literal or pointer to a concrete attr.Value implementation, attempting to to return a float64 representation of its value.
func AttributeValueToInt64 ¶
AttributeValueToInt64 accepts either a literal or pointer to a concrete attr.Value implementation, attempting to return an int64 representation of its value.
func AttributeValueToString ¶
AttributeValueToString will attempt to execute the appropriate AttributeStringerFunc from the ones registered.
func AttributeValueToStrings ¶
AttributeValueToStrings attempts to convert the provided attr.Value into a slice of strings.
func BoolPtrToBoolValue ¶ added in v3.0.3
BoolPtrToBoolValue accepts a bool pointer, returning a types.Bool with the dereferenced value.
If the provided pointer is nil, the returned Bool type will be set as Null.
func BoolToBoolValue ¶
BoolToBoolValue takes a bool and wraps it up as a types.Bool DEPRECATED: use types.BoolValue() directly
func BoolValueToBool ¶
BoolValueToBool accepts either a types.Bool or *types.Bool and extracts the raw bool value within
func BoolValueToBoolPtr ¶
BoolValueToBoolPtr accepts either a types.Bool or *types.Bool, extracting the raw bool value within and returning a pointer to a copy of that value
If the Value is unknown or null, a nil is returned.
func BoolValueToString ¶
BoolValueToString accepts an instance of either types.Bool or *types.Bool, attempting to convert the value to a string. DEPRECATED: use AttributeValueToString in all cases
func BytesToStringValue ¶
BytesToStringValue takes a byte slice and wraps it as a types.String. If the provided slice is `nil`, then the resulting String type will be marked as "null".
func Float32ToFloat64Value ¶
Float32ToFloat64Value takes a float32 and wraps it up as a types.Float64
func Float32ToNumberValue ¶
Float32ToNumberValue takes a float32 and wraps it up as a types.Number
func Float64ToFloat64Value ¶
Float64ToFloat64Value takes a float64 and wraps it up as a types.Float64 DEPRECATED: use types.Float64Value() directly
func Float64ToNumberValue ¶
Float64ToNumberValue takes a float64 and wraps it up as a types.Number
func Float64ValueToFloat32 ¶
Float64ValueToFloat32 accepts either a types.Float64 or *types.Float64, returning a float32 representation of the raw float64 value
func Float64ValueToFloat64 ¶
Float64ValueToFloat64 accepts either a types.Float64 or *types.Float64, returning the raw float64 value within
func Float64ValueToString ¶
Float64ValueToString accepts an instance of either types.Float64 or *types.Float64, attempting to convert the value to a string. DEPRECATED: use AttributeValueToString in all cases
func FormatAttributePathSteps ¶
func FormatAttributePathSteps(pathSteps ...tftypes.AttributePathStep) string
FormatAttributePathSteps takes one or more path steps and joins them together with "."
func FormatAttributePaths ¶
func FormatAttributePaths(paths ...*tftypes.AttributePath) string
FormatAttributePaths takes one or more *tftypes.AttributePaths and returns a pretty-printable string.
func FormatPathPathSteps ¶
FormatPathPathSteps takes one or more path steps and joins them together with "."
func FormatPathPaths ¶
FormatPathPaths takes one or more path.Path types and returns a pretty-printable string.
func GoNumberToString ¶
func GoNumberToString(num interface{}) string
GoNumberToString is a laziness helper to convert several types to a usable string value.
func Int64ListToInts ¶
Int64ListToInts accepts an instance of either types.List or *types.List where ElementType MUST be types.Int64Type, returning a slice of ints of the value of each element.
func Int64SetToInts ¶
Int64SetToInts accepts an instance of either types.Set or *types.set where ElementType MUST be types.Int64Type returning a slice of ints of the value of each element
func Int64ToInt64Value ¶
Int64ToInt64Value takes an int64 and wraps it up as a types.Int64 DEPRECATED: use types.Int64Value() directly
func Int64ToNumberValue ¶
Int64ToNumberValue takes an int64 and wraps it up as a types.Number
func Int64ValueToInt ¶
Int64ValueToInt accepts either a types.Int64 or *types.Int64, returning an int representation of the value within
func Int64ValueToInt64 ¶
Int64ValueToInt64 accepts either a types.Int64 or *types.Int64, returning the raw int64 value within
func Int64ValueToIntPtr ¶
Int64ValueToIntPtr accepts either a types.Int64 or *types.Int64, returning a pointer to a copy of the int representation of the value within
If the Value is unknown or null, a nil is returned.
func Int64ValueToString ¶
Int64ValueToString accepts an instance of either types.Int64 or *types.Int64, attempting to convert the value to a string. DEPRECATED: use AttributeValueToString in all cases
func IntPtrToInt64Value ¶
IntPtrToInt64Value takes an *int and wraps it up as a types.Int64
If the go value is nil, Null will be true on the outgoing attr.Value type
func IntToInt64Value ¶
IntToInt64Value takes an int and wraps it up as a types.Int64
func IntToNumberValue ¶
IntToNumberValue takes an int and wraps it up as a types.Number
func IntsToInt64List ¶
IntsToInt64List takes a slice of ints and creates a typed types.List with a ElementType of types.Int64Type and each value of Elements being an instance of types.Int64
If nullOnEmpty parameter is `true`, the returned types.List will be set to Null. This can be used to avoid Terraform state inconsistencies under certain circumstances.
func IntsToInt64Set ¶
IntsToInt64Set takes a slice of ints and creates a typed types.Set with an ElementType of types.Int64Type and each value of Elements being an instance of types.Int64
If nullOnEmpty parameter is `true`, the returned types.Set will be set to Null. This can be used to avoid Terraform state inconsistencies under certain circumstances.
func IsValueIsEmptyError ¶
func IsValueIsNullError ¶
func IsValueIsUnknownError ¶
func LengthOfListValue ¶
LengthOfListValue returns the number of elements in the List attribute. This will return 0 if the attribute was not set, set to null, or defined as an empty list.
func LengthOfMapValue ¶
LengthOfMapValue returns the number of elements in the Map attribute. This will return 0 if the attribute was not set, set to null, or defined as an empty map.
func LengthOfSetValue ¶
LengthOfSetValue returns the number of elements in the Set attribute. This will return 0 if the attribute was not set, set to null, or defined as an empty set.
func LengthOfStringValue ¶
LengthOfStringValue returns the number of bytes in the String attribute. This will return 0 if the attribute was not set, set to 0, or defined as an empty string.
func NumberListToInts ¶
NumberListToInts accepts either an instance of types.List or *types.List where ElementType MUST be types.NumberType returning a slice of ints of the value of each element
func NumberSetToInts ¶
NumberSetToInts accepts either an instance of types.Set or *types.Set where ElementType MUST be types.NumberType returning a slice of ints of the value of each element
func NumberValueToBigFloat ¶
NumberValueToBigFloat accepts either a types.Number or *types.Number, returning the raw *big.Float value. This may be nil if the value was not set.
func NumberValueToFloat64 ¶
NumberValueToFloat64 accepts either a types.Number or *types.Number, returning a float64 representation of the *big.Float value within. It will return [0.0, big.Exact] of the value was not set.
func NumberValueToInt ¶
NumberValueToInt accepts either a types.Number or *types.Number, returning an int representation of the *big.Float value within. It will return [0, big.Exact] if the value was not set
func NumberValueToInt64 ¶
NumberValueToInt64 accepts either a types.Number or *types.Number, returning an int64 representation of the *big.Float value within. It will return [0, big.Exact] of the value was not set.
func NumberValueToString ¶
NumberValueToString accepts an instance of either types.Number or *types.Number, attempting to convert the value to a string. DEPRECATED: use AttributeValueToString in all cases
func StringListToStrings ¶
StringListToStrings accepts an instance of either types.List or *types.List where ElementType MUST be types.StringType, returning a slice of strings of the value of each element
func StringPtrToStringValue ¶
StringPtrToStringValue takes a *string and wraps it up as a types.String
If the go value is nil, Null will be true on the outgoing attr.Value type
func StringSetToStrings ¶
StringSetToStrings accepts an instance of either types.Set or *types.Set where ElementType MUST be types.StringType, returning a slice of strings of the value of each element
func StringToStringValue ¶
StringToStringValue takes a string and wraps it up as a types.String DEPRECATED: use types.StringValue() directly
func StringValueToBytes ¶
StringValueToBytes accepts an instance of either types.String or *types.String, returning the raw string value cast to a byte slice
func StringValueToFloat64 ¶
StringValueToFloat64 accepts either a types.String or *types.string, attempting to parse the value as a float64
func StringValueToInt64 ¶
StringValueToInt64 accepts either a types.String or *types.String, attempting to parse the value as an int64.
func StringValueToString ¶
StringValueToString accepts an instance of either types.String or *types.String, returning the raw string value DEPRECATED: use AttributeValueToString in all cases
func StringValueToStringPtr ¶
StringValueToStringPtr accepts an instance of either types.String or *types.String, returning a pointer to a copy of the raw string value
If the Value is unknown or null, a nil is returned.
func StringsToStringList ¶ added in v3.1.0
StringsToStringList takes a slice of strings and creates a typed types.List with an ElementType of types.String and each value of Elements being an instance of types.String
If nullOnEmpty parameter is `true`, the returned types.List will be set to Null. This can be used to avoid Terraform state inconsistencies under certain circumstances.
func StringsToStringSet ¶ added in v3.1.0
StringsToStringSet takes a slice of strings and creates a typed types.Set with an ElementType of types.String and each value of Elements being an instance of types.String
If nullOnEmpty parameter is `true`, the returned types.Set will be set to Null. This can be used to avoid Terraform state inconsistencies under certain circumstances.
func TestAttributeValueState ¶
TestAttributeValueState - Determine the state of the attribute value
An Attribute Value can have one of 3 main states:
- Unknown
- Null
- Valued
This function tests every attr.Value implementation for each of these states, and additionally performs an "emptiness" check.
There are bespoke errors for Unknown, Null, and Empty. See errors.go for details on how to use these error types.
This function will only ever return one error, going from greatest to least significance:
unknown > null > empty > non-empty
A 'nil' response from this function means the attribute's value was defined to a non-"empty" value at runtime. See function body for a particular type if you're interested in what "empty" means.
func ValueToBoolType ¶
ValueToBoolType ensures we have a types.Bool literal
func ValueToFloat64Type ¶
ValueToFloat64Type ensures we have a types.Float64 literal
func ValueToInt64Type ¶
ValueToInt64Type ensures we have a types.Int64 literal
func ValueToListType ¶
ValueToListType ensures we have a types.List literal
func ValueToMapType ¶
ValueToMapType ensures we have a types.Map literal
func ValueToNumberType ¶
ValueToNumberType ensures we have a types.Number literal
func ValueToObjectType ¶
ValueToObjectType ensures we have a types.Object literal
func ValueToSetType ¶
ValueToSetType ensures we have a types.Set literal
func ValueToStringType ¶
ValueToStringType ensures we have a types.String literal
Types ¶
This section is empty.