Documentation
¶
Index ¶
- func BoolPointerValue(value *bool) types.Bool
- func BoolPointerValueWithDefault(value *bool, defaultValue bool) types.Bool
- func BoolPtrToBool(b *bool) bool
- func BoolPtrToTypeBool(b *bool) types.Bool
- func BoolValue(value bool) types.Bool
- func BuildObjectSetFromSlice(ctx context.Context, attrTypes map[string]attr.Type, ...) types.Set
- func ByteStringToBase64(b []byte) string
- func BytesToString(value []byte) types.String
- func DateOnlyPtrToString(date *serialization.DateOnly) types.String
- func DecodeBase64ToString(ctx context.Context, encoded string) types.String
- func EnumListPtrToTypeStringSlice[T fmt.Stringer](input []*T) []types.String
- func EnumPtrToTypeString[T fmt.Stringer](e *T) types.String
- func EnumSliceToTypeStringSlice[T fmt.Stringer](input []T) []types.String
- func ISO8601DurationToString(duration *serialization.ISODuration) types.String
- func Int32PointerToInt64Value(value *int32) types.Int64
- func Int32PointerValue(value *int32) types.Int32
- func Int32PtrToTypeInt32(i *int32) types.Int32
- func Int32PtrToTypeInt64(i *int32) types.Int64
- func Int64PointerValue(value *int64) types.Int64
- func Int64PtrToTypeInt64(i *int64) types.Int64
- func IsNilOrEmpty(value *string) bool
- func ListNullIfEmpty(elementType attr.Type, values []attr.Value) types.List
- func ListValueFromStrings(input []string) types.List
- func ObjectNullIfEmpty(attrTypes map[string]attr.Type, values map[string]attr.Value) types.Object
- func ObjectValueMust(attrTypes map[string]attr.Type, values map[string]attr.Value) types.Object
- func SliceToTypeStringSlice(input []string) []types.String
- func StringListToTypeList(strings []string) types.List
- func StringPointerValue(value *string) types.String
- func StringPointerValueWithDefault(value *string, defaultValue string) types.String
- func StringPtrToString(s *string) string
- func StringSliceToSet(ctx context.Context, input []string) types.Set
- func StringValue(value string) types.String
- func StringValueWithDefault(value string, defaultValue string) types.String
- func TimeOnlyPtrToString(time *serialization.TimeOnly) types.String
- func TimeToString(t *time.Time) types.String
- func UUIDPtrToTypeString(id *uuid.UUID) types.String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolPointerValue ¶
BoolPointerValue safely converts a *bool to types.Bool. Returns types.BoolNull() if the pointer is nil.
func BoolPointerValueWithDefault ¶
BoolPointerValueWithDefault safely converts a *bool to types.Bool. Returns the default value if the pointer is nil.
func BoolPtrToBool ¶
BoolPtrToBool converts a bool pointer to a bool. If the input is nil, it returns false.
func BoolPtrToTypeBool ¶
BoolPtrToTypeBool converts a *bool to a types.Bool. If the input is nil, it returns types.BoolNull().
func BoolValue ¶
BoolValue safely converts a bool to types.Bool. Always returns a valid types.Bool value, never null.
func BuildObjectSetFromSlice ¶
func BuildObjectSetFromSlice( ctx context.Context, attrTypes map[string]attr.Type, extract func(i int) map[string]attr.Value, length int, ) types.Set
BuildObjectSetFromSlice creates a Set from a slice using an extractor function.
This function converts a Go slice into a Terraform Framework Set type with proper error handling and logging. It's commonly used for mapping Graph API collections to Terraform state.
Parameters:
- ctx: Context for logging
- attrTypes: Map defining the attribute types for objects in the set
- extract: Function that extracts attribute values for each slice element
- length: Length of the source slice
Returns:
- types.Set: The constructed set, or a null set if errors occur
func ByteStringToBase64 ¶
ByteStringToBase64 converts a byte slice to a base64-encoded string. This is useful for when the bytes represent binary data that should be base64 encoded. For script content that is already UTF-8, use BytesToString.
func BytesToString ¶
BytesToString safely converts a byte slice to types.String. Returns types.StringNull() if the byte slice is nil, otherwise converts the byte slice to a string and wraps it in types.String. This is useful for script content which is stored as []byte but needs to be represented as a string in Terraform.
func DateOnlyPtrToString ¶
func DateOnlyPtrToString(date *serialization.DateOnly) types.String
DateOnlyPtrToString converts a DateOnly pointer to a Terraform string.
func DecodeBase64ToString ¶
DecodeBase64ToString decodes a base64-encoded string and returns a basetypes.StringValue. If decoding fails, it logs a warning and returns the original string as a basetypes.StringValue.
func EnumListPtrToTypeStringSlice ¶
EnumListPtrToTypeStringSlice converts a slice of pointers to enum-like constants to a slice of types.String. It uses the String() method of the enum type to convert each value to a string.
func EnumPtrToTypeString ¶
EnumPtrToTypeString converts a pointer to an enum-like type to a types.String. It uses the String() method of the enum type to convert the value to a string.
func EnumSliceToTypeStringSlice ¶
EnumSliceToTypeStringSlice converts a slice of enum-like constants to a slice of types.String. It uses the String() method of the enum type to convert each value to a string.
func ISO8601DurationToString ¶
func ISO8601DurationToString(duration *serialization.ISODuration) types.String
ISO8601DurationToString converts an ISODuration to a types.String value.
func Int32PointerToInt64Value ¶
Int32PointerToInt64Value safely converts a *int32 to types.Int64. Returns types.Int64Null() if the pointer is nil.
func Int32PointerValue ¶
Int32PointerValue safely converts a *int32 to types.Int32. Returns types.Int32Null() if the pointer is nil.
func Int32PtrToTypeInt32 ¶
Int32PtrToTypeInt32 converts a pointer to an int32 to a types.Int32. This function is useful for converting nullable int32 values from the SDK to Terraform's types.Int32.
func Int32PtrToTypeInt64 ¶
Int32PtrToTypeInt64 converts a pointer to an int32 to a types.Int64. This function is useful for converting nullable int32 values from the SDK to Terraform's types.Int64.
func Int64PointerValue ¶
Int64PointerValue safely converts a *int64 to types.Int64. Returns types.Int64Null() if the pointer is nil.
func Int64PtrToTypeInt64 ¶
Int64PtrToTypeInt64 converts a *int64 to a types.Int64. If the input is nil, it returns types.Int64Null().
func IsNilOrEmpty ¶
IsNilOrEmpty checks if a string pointer is nil or points to an empty string.
func ListNullIfEmpty ¶
ListNullIfEmpty returns ListNull if the slice is empty, otherwise creates a list with the values.
func ListValueFromStrings ¶
ListValueFromStrings creates a types.List from a slice of strings. If the input slice is nil or empty, it returns an empty list, not null.
func ObjectNullIfEmpty ¶
ObjectNullIfEmpty returns ObjectNull if the map is empty, otherwise creates an object with the values.
func ObjectValueMust ¶
ObjectValueMust creates a types.Object with known values from a map. It panics if the creation fails, which should only happen if there's a programming error.
func SliceToTypeStringSlice ¶
SliceToTypeStringSlice converts a slice of strings to a slice of types.String. It handles nil input by returning nil, and empty slices by returning an empty slice of types.String.
func StringListToTypeList ¶
StringListToTypeList converts a slice of strings to a types.List.
func StringPointerValue ¶
StringPointerValue safely converts a *string to types.String. Returns types.StringNull() if the pointer is nil.
func StringPointerValueWithDefault ¶
StringPointerValueWithDefault safely converts a *string to types.String. Returns default if the pointer is nil or points to an empty string.
func StringPtrToString ¶
StringPtrToString converts a string pointer to a string.
func StringSliceToSet ¶
StringSliceToSet converts a []string to a Terraform types.Set (StringType).
func StringValue ¶
StringValue safely converts a string to types.String. Always returns a valid types.String value, never null.
func StringValueWithDefault ¶
StringValueWithDefault safely converts a string to types.String. If the value is empty, it returns the default value instead.
func TimeOnlyPtrToString ¶
func TimeOnlyPtrToString(time *serialization.TimeOnly) types.String
TimeOnlyPtrToString converts a TimeOnly pointer to a Terraform string.
func TimeToString ¶
TimeToString converts a *time.Time to a types.String. If the input is nil, it returns types.StringNull(). Otherwise, it returns a types.String with the time formatted in RFC3339 format.
Types ¶
This section is empty.