flex

package
v0.0.70 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DateTimePointerToFramework added in v0.0.68

func DateTimePointerToFramework(v *strfmt.DateTime) timetypes.RFC3339

DateTimePointerToFramework converts a *strfmt.DateTime to a timetypes.RFC3339. A nil pointer or zero time returns a null timetypes.RFC3339.

func DateTimeValueToFramework added in v0.0.69

func DateTimeValueToFramework(v strfmt.DateTime) timetypes.RFC3339

DateTimeValueToFramework converts a strfmt.DateTime (by value) to a timetypes.RFC3339. A zero time returns a null timetypes.RFC3339.

func DiffStringSet added in v0.0.55

func DiffStringSet(
	ctx context.Context,
	a types.Set,
	b types.Set,
	diags *diag.Diagnostics,
) []types.String

DiffStringSet returns items that exist in a but not in b (set difference: a - b).

func ExpandListAs added in v0.0.52

func ExpandListAs[T any](
	ctx context.Context,
	list types.List,
	diags *diag.Diagnostics,
) []T

ExpandListAs converts a Terraform Framework types.List into a Go slice of the specified type. If the list is null or unknown, it returns an empty slice.

func ExpandSetAs added in v0.0.52

func ExpandSetAs[T any](
	ctx context.Context,
	set types.Set,
	diags *diag.Diagnostics,
) []T

ExpandSetAs converts a Terraform Framework types.Set into a Go slice of the specified type. If the set is null or unknown, it returns an empty slice.

func ExpandSetWithConverter added in v0.0.68

func ExpandSetWithConverter[TSource, TDest any](
	ctx context.Context,
	set types.Set,
	converter func(TSource) (TDest, diag.Diagnostics),
) ([]TDest, diag.Diagnostics)

ExpandSetWithConverter converts a Terraform Framework types.Set into a Go slice using a converter function to transform each element from the Terraform model type to the desired output type. If the set is null or unknown, it returns an empty slice.

func FlattenHostGroupsToList added in v0.0.62

func FlattenHostGroupsToList(
	ctx context.Context,
	groups []*models.HostGroupsHostGroupV1,
) (types.List, diag.Diagnostics)

FlattenHostGroupsToList converts []*models.HostGroupsHostGroupV1 to a Terraform list of host group IDs. Returns null if there are no groups or all groups are nil/have nil IDs.

func FlattenHostGroupsToSet added in v0.0.62

func FlattenHostGroupsToSet(
	ctx context.Context,
	groups []*models.HostGroupsHostGroupV1,
) (types.Set, diag.Diagnostics)

FlattenHostGroupsToSet converts []*models.HostGroupsHostGroupV1 to a Terraform set of host group IDs. Returns null if there are no groups or all groups are nil/have nil IDs.

func FlattenObjectValueSetFrom added in v0.0.68

func FlattenObjectValueSetFrom[TSource, TDest any](
	ctx context.Context,
	objectType types.ObjectType,
	sources []TSource,
	converter func(TSource) (TDest, diag.Diagnostics),
) (types.Set, diag.Diagnostics)

FlattenObjectValueSetFrom converts a slice of source objects to a Terraform set of objects using a converter function to transform each element. Returns null if the slice is empty or nil, or if diagnostics has errors.

func FlattenStringValueList added in v0.0.62

func FlattenStringValueList(
	ctx context.Context,
	values []string,
) (types.List, diag.Diagnostics)

FlattenStringValueList converts a slice of strings to a Terraform list of strings. Returns null if the slice is empty or nil.

Pair with a validator that prevents users from setting empty lists. When the API returns an empty slice for unset fields, normalizing [] to null ensures state matches config and prevents inconsistent result after apply errors.

func FlattenStringValueSet added in v0.0.62

func FlattenStringValueSet(
	ctx context.Context,
	values []string,
) (types.Set, diag.Diagnostics)

FlattenStringValueSet converts a slice of strings to a Terraform set of strings. Returns null if the slice is empty or nil.

Pair with a validator that prevents users from setting empty sets. When the API returns an empty slice for unset fields, normalizing [] to null ensures state matches config and prevents inconsistent result after apply errors.

func FrameworkToInt32Pointer added in v0.0.62

func FrameworkToInt32Pointer(v types.Int32) *int32

FrameworkToInt32Pointer converts a Terraform framework types.Int32 to an int32 pointer. If the framework int32 is null or unknown, it returns nil.

func FrameworkToRFC3339Pointer added in v0.0.61

func FrameworkToRFC3339Pointer(v timetypes.RFC3339) *string

FrameworkToRFC3339Pointer converts a Terraform framework timetypes.RFC3339 to a string pointer. If the framework RFC3339 is null or unknown, it returns a pointer to an empty string.

func FrameworkToStringPointer added in v0.0.50

func FrameworkToStringPointer(v types.String) *string

FrameworkToStringPointer converts a Terraform framework types.String to a string pointer. If the framework string is null or unknown, it returns a pointer to an empty string.

func Int32PointerToFramework added in v0.0.62

func Int32PointerToFramework(v *int32) types.Int32

Int32PointerToFramework converts an int32 pointer to a Terraform framework types.Int32. A nil pointer returns a null types.Int32.

func MergeStringSet added in v0.0.55

func MergeStringSet(
	ctx context.Context,
	a types.Set,
	b types.Set,
	diags *diag.Diagnostics,
) types.Set

MergeStringSet combines two sets and returns a new set containing unique items from both.

func RFC3339PointerToFramework added in v0.0.61

func RFC3339PointerToFramework(v *string) (timetypes.RFC3339, diag.Diagnostics)

RFC3339PointerToFramework converts a string pointer to a Terraform framework timetypes.RFC3339. A nil pointer or empty string returns a null timetypes.RFC3339.

Pair with a validator that prevents users from setting empty strings. When the API returns "" for unset fields, normalizing "" to null ensures state matches config and prevents inconsistent result after apply errors.

func RFC3339ValueToFramework added in v0.0.61

func RFC3339ValueToFramework[T ~string](v T) (timetypes.RFC3339, diag.Diagnostics)

RFC3339ValueToFramework converts a string to a Terraform framework timetypes.RFC3339. An empty string returns a null timetypes.RFC3339.

Pair with a validator that prevents users from setting empty strings. When the API returns "" for unset fields, normalizing "" to null ensures state matches config and prevents inconsistent result after apply errors.

func StringPointerToFramework

func StringPointerToFramework(v *string) types.String

StringPointerToFramework converts a string pointer to a Terraform framework types.String. A nil pointer or empty string returns a null types.String.

Pair with a validator (e.g. StringNotWhitespace) that prevents users from setting empty strings. When the API returns "" for unset fields, normalizing "" to null ensures state matches config and prevents inconsistent result after apply errors.

func StringValueToFramework

func StringValueToFramework[T ~string](v T) types.String

StringValueToFramework converts a string to a Terraform framework types.String. An empty string returns a null types.String.

Pair with a validator (e.g. StringNotWhitespace) that prevents users from setting empty strings. When the API returns "" for unset fields, normalizing "" to null ensures state matches config and prevents inconsistent result after apply errors.

func Unique added in v0.0.52

func Unique[E comparable](s []E) []E

Unique returns a new slice containing only the unique elements from the input slice. It works for any comparable type E and preserves the order of first occurrence.

Types

This section is empty.

Jump to

Keyboard shortcuts

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