flex

package
v5.0.0-...-02ba6c8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultIgnoredFieldNames = []string{
		"Tags",
	}
)

Functions

func BoolFromFramework

func BoolFromFramework(ctx context.Context, v basetypes.BoolValuable) *bool

BoolFromFramework converts a Framework Bool value to a bool pointer. A null Bool is converted to a nil bool pointer.

func BoolToFramework

func BoolToFramework(ctx context.Context, v *bool) types.Bool

BoolToFramework converts a bool pointer to a Framework Bool value. A nil bool pointer is converted to a null Bool.

func BoolToFrameworkLegacy

func BoolToFrameworkLegacy(_ context.Context, v *bool) types.Bool

BoolToFrameworkLegacy converts a bool pointer to a Framework Bool value. A nil bool pointer is converted to a false Bool.

func BoolValueFromFramework

func BoolValueFromFramework(ctx context.Context, v basetypes.BoolValuable) bool

func BoolValueToFramework

func BoolValueToFramework(ctx context.Context, v bool) types.Bool

BoolValueToFramework converts a bool value to a Framework Bool value.

func DiagFlatteningIncompatibleTypes

func DiagFlatteningIncompatibleTypes(sourceType, targetType reflect.Type) diag.ErrorDiagnostic

func EmptyStringAsNull

func EmptyStringAsNull(v types.String) types.String

func Expand

func Expand(ctx context.Context, tfObject, apiObject any, optFns ...AutoFlexOptionsFunc) diag.Diagnostics

Expand "expands" a resource's "business logic" data structure, implemented using Terraform Plugin Framework data types, into an AWS SDK for Go v2 API data structure. The resource's data structure is walked and exported fields that have a corresponding field in the API data structure (and a suitable target data type) are copied.

func ExpandFrameworkInt32List

func ExpandFrameworkInt32List(ctx context.Context, v basetypes.ListValuable) []*int32

func ExpandFrameworkInt32Set

func ExpandFrameworkInt32Set(ctx context.Context, v basetypes.SetValuable) []*int32

func ExpandFrameworkInt32ValueList

func ExpandFrameworkInt32ValueList(ctx context.Context, v basetypes.ListValuable) []int32

func ExpandFrameworkInt32ValueSet

func ExpandFrameworkInt32ValueSet(ctx context.Context, v basetypes.SetValuable) []int32

func ExpandFrameworkInt64List

func ExpandFrameworkInt64List(ctx context.Context, v basetypes.ListValuable) []*int64

func ExpandFrameworkInt64Set

func ExpandFrameworkInt64Set(ctx context.Context, v basetypes.SetValuable) []*int64

func ExpandFrameworkInt64ValueList

func ExpandFrameworkInt64ValueList(ctx context.Context, v basetypes.ListValuable) []int64

func ExpandFrameworkInt64ValueSet

func ExpandFrameworkInt64ValueSet(ctx context.Context, v basetypes.SetValuable) []int64

func ExpandFrameworkStringList

func ExpandFrameworkStringList(ctx context.Context, v basetypes.ListValuable) []*string

func ExpandFrameworkStringMap

func ExpandFrameworkStringMap(ctx context.Context, v basetypes.MapValuable) map[string]*string

func ExpandFrameworkStringSet

func ExpandFrameworkStringSet(ctx context.Context, v basetypes.SetValuable) []*string

func ExpandFrameworkStringValueList

func ExpandFrameworkStringValueList(ctx context.Context, v basetypes.ListValuable) []string

func ExpandFrameworkStringValueMap

func ExpandFrameworkStringValueMap(ctx context.Context, v basetypes.MapValuable) map[string]string

func ExpandFrameworkStringValueSet

func ExpandFrameworkStringValueSet(ctx context.Context, v basetypes.SetValuable) itypes.Set[string]

func ExpandFrameworkStringyValueSet

func ExpandFrameworkStringyValueSet[T ~string](ctx context.Context, v basetypes.SetValuable) itypes.Set[T]

func Flatten

func Flatten(ctx context.Context, apiObject, tfObject any, optFns ...AutoFlexOptionsFunc) diag.Diagnostics

Flatten "flattens" an AWS SDK for Go v2 API data structure into a resource's "business logic" data structure, implemented using Terraform Plugin Framework data types. The API data structure's fields are walked and exported fields that have a corresponding field in the resource's data structure (and a suitable target data type) are copied.

func FlattenFrameworkInt32List

func FlattenFrameworkInt32List(ctx context.Context, v []*int32) types.List

FlattenFrameworkInt64List converts a slice of int32 pointers to a framework List value.

A nil slice is converted to a null List. An empty slice is converted to a null List.

func FlattenFrameworkInt32Set

func FlattenFrameworkInt32Set(ctx context.Context, v []*int32) types.Set

FlattenFrameworkInt64Set converts a slice of int32 pointers to a framework Set value.

A nil slice is converted to a null Set. An empty slice is converted to a null Set.

func FlattenFrameworkInt32ValueList

func FlattenFrameworkInt32ValueList[T ~int32](ctx context.Context, v []T) types.List

FlattenFrameworkInt64ValueList converts a slice of int32 values to a framework List value.

A nil slice is converted to a null List. An empty slice is converted to a null List.

func FlattenFrameworkInt32ValueSet

func FlattenFrameworkInt32ValueSet[T ~int32](ctx context.Context, v []T) types.Set

FlattenFrameworkInt64ValueSet converts a slice of int32 values to a framework Set value.

A nil slice is converted to a null Set. An empty slice is converted to a null Set.

func FlattenFrameworkInt64List

func FlattenFrameworkInt64List(ctx context.Context, v []*int64) types.List

FlattenFrameworkInt64List converts a slice of int64 pointers to a framework List value.

A nil slice is converted to a null List. An empty slice is converted to a null List.

func FlattenFrameworkInt64Set

func FlattenFrameworkInt64Set(ctx context.Context, v []*int64) types.Set

FlattenFrameworkInt64Set converts a slice of int64 pointers to a framework Set value.

A nil slice is converted to a null Set. An empty slice is converted to a null Set.

func FlattenFrameworkInt64ValueList

func FlattenFrameworkInt64ValueList[T ~int64](ctx context.Context, v []T) types.List

FlattenFrameworkInt64ValueList converts a slice of int64 values to a framework List value.

A nil slice is converted to a null List. An empty slice is converted to a null List.

func FlattenFrameworkInt64ValueSet

func FlattenFrameworkInt64ValueSet[T ~int64](ctx context.Context, v []T) types.Set

FlattenFrameworkInt64ValueSet converts a slice of int64 values to a framework Set value.

A nil slice is converted to a null Set. An empty slice is converted to a null Set.

func FlattenFrameworkStringList

func FlattenFrameworkStringList(ctx context.Context, v []*string) types.List

FlattenFrameworkStringList converts a slice of string pointers to a framework List value.

A nil slice is converted to a null List. An empty slice is converted to a null List.

func FlattenFrameworkStringListLegacy

func FlattenFrameworkStringListLegacy(_ context.Context, vs []*string) types.List

FlattenFrameworkStringListLegacy is the Plugin Framework variant of FlattenStringList. A nil slice is converted to an empty (non-null) List.

func FlattenFrameworkStringMap

func FlattenFrameworkStringMap(ctx context.Context, v map[string]*string) types.Map

FlattenFrameworkStringMap converts a map of string pointers to a framework Map value.

A nil map is converted to a null Map. An empty map is converted to a null Map.

func FlattenFrameworkStringSet

func FlattenFrameworkStringSet(ctx context.Context, v []*string) types.Set

FlattenFrameworkStringSet converts a slice of string pointers to a framework Set value.

A nil slice is converted to a null Set. An empty slice is converted to a null Set.

func FlattenFrameworkStringValueList

func FlattenFrameworkStringValueList[T ~string](ctx context.Context, v []T) types.List

FlattenFrameworkStringValueList converts a slice of string values to a framework List value.

A nil slice is converted to a null List. An empty slice is converted to a null List.

func FlattenFrameworkStringValueListLegacy

func FlattenFrameworkStringValueListLegacy[T ~string](_ context.Context, vs []T) types.List

FlattenFrameworkStringValueListLegacy is the Plugin Framework variant of FlattenStringValueList. A nil slice is converted to an empty (non-null) List.

func FlattenFrameworkStringValueListOfString

func FlattenFrameworkStringValueListOfString(ctx context.Context, vs []string) fwtypes.ListValueOf[basetypes.StringValue]

func FlattenFrameworkStringValueMap

func FlattenFrameworkStringValueMap(ctx context.Context, v map[string]string) types.Map

FlattenFrameworkStringValueMap converts a map of strings to a framework Map value.

A nil map is converted to a null Map. An empty map is converted to a null Map.

func FlattenFrameworkStringValueMapLegacy

func FlattenFrameworkStringValueMapLegacy(_ context.Context, m map[string]string) types.Map

FlattenFrameworkStringValueMapLegacy has no Plugin SDK equivalent as schema.ResourceData.Set can be passed string value maps directly. A nil map is converted to an empty (non-null) Map.

func FlattenFrameworkStringValueSet

func FlattenFrameworkStringValueSet[T ~string](ctx context.Context, v []T) types.Set

FlattenFrameworkStringValueSet converts a slice of string values to a framework Set value.

A nil slice is converted to a null Set. An empty slice is converted to a null Set.

func FlattenFrameworkStringValueSetLegacy

func FlattenFrameworkStringValueSetLegacy[T ~string](_ context.Context, vs []T) types.Set

FlattenFrameworkStringValueSetLegacy is the Plugin Framework variant of FlattenStringValueSet. A nil slice is converted to an empty (non-null) Set.

func Float32ToFrameworkFloat64

func Float32ToFrameworkFloat64(_ context.Context, v *float32) types.Float64

Float32ToFrameworkFloat64 converts a float32 pointer to a Framework Float64 value. A nil float32 pointer is converted to a null Float64.

func Float32ToFrameworkFloat64Legacy

func Float32ToFrameworkFloat64Legacy(_ context.Context, v *float32) types.Float64

Float32ToFrameworkFloat64Legacy converts a float32 pointer to a Framework Float64 value. A nil float32 pointer is converted to a zero float64.

func Float64ToFramework

func Float64ToFramework(ctx context.Context, v *float64) types.Float64

Float64ToFramework converts a float64 pointer to a Framework Float64 value. A nil float64 pointer is converted to a null Float64.

func Float64ToFrameworkLegacy

func Float64ToFrameworkLegacy(_ context.Context, v *float64) types.Float64

Float64ToFrameworkLegacy converts a float64 pointer to a Framework Float64 value. A nil float64 pointer is converted to a zero float64.

func Int32FromFramework

func Int32FromFramework(ctx context.Context, v basetypes.Int32Valuable) *int32

Int32FromFramework coverts a Framework Int32 value to an int32 pointer. A null Int32 is converted to a nil int32 pointer.

func Int32FromFrameworkInt64

func Int32FromFrameworkInt64(ctx context.Context, v basetypes.Int64Valuable) *int32

Int32FromFrameworkInt64 coverts a Framework Int64 value to an int32 pointer. A null Int64 is converted to a nil int32 pointer.

func Int32FromFrameworkLegacy

func Int32FromFrameworkLegacy(_ context.Context, v types.Int32) *int32

func Int32ToFramework

func Int32ToFramework(ctx context.Context, v *int32) types.Int32

Int32ToFramework converts an int32 pointer to a Framework Int32 value. A nil int32 pointer is converted to a null Int32.

func Int32ToFrameworkInt64

func Int32ToFrameworkInt64(ctx context.Context, v *int32) types.Int64

func Int32ToFrameworkInt64Legacy

func Int32ToFrameworkInt64Legacy(_ context.Context, v *int32) types.Int64

Int32ToFrameworkInt64Legacy converts an int32 pointer to a Framework Int64 value. A nil int32 pointer is converted to a zero Int64.

func Int32ValueFromFrameworkInt64

func Int32ValueFromFrameworkInt64(ctx context.Context, v basetypes.Int64Valuable) int32

Int32ValueFromFrameworkInt64 coverts a Framework Int64 value to an int32 value. A null Int64 is converted to a nil int32 pointer.

func Int32ValueToFrameworkInt64

func Int32ValueToFrameworkInt64(ctx context.Context, v int32) types.Int64

func Int64FromFramework

func Int64FromFramework(ctx context.Context, v basetypes.Int64Valuable) *int64

Int64FromFramework converts a Framework Int64 value to an int64 pointer. A null Int64 is converted to a nil int64 pointer.

func Int64FromFrameworkLegacy

func Int64FromFrameworkLegacy(_ context.Context, v types.Int64) *int64

func Int64ToFramework

func Int64ToFramework(ctx context.Context, v *int64) types.Int64

Int64ToFramework converts an int64 pointer to a Framework Int64 value. A nil int64 pointer is converted to a null Int64.

func Int64ToFrameworkLegacy

func Int64ToFrameworkLegacy(_ context.Context, v *int64) types.Int64

Int64ToFrameworkLegacy converts an int64 pointer to a Framework Int64 value. A nil int64 pointer is converted to a zero Int64.

func Int64ValueFromFramework

func Int64ValueFromFramework(ctx context.Context, v basetypes.Int64Valuable) int64

func RegisterLogger

func RegisterLogger(ctx context.Context) context.Context

func StringFromFramework

func StringFromFramework(ctx context.Context, v basetypes.StringValuable) *string

StringFromFramework converts a Framework String value to a string pointer. A null String is converted to a nil string pointer.

func StringFromFrameworkLegacy

func StringFromFrameworkLegacy(_ context.Context, v types.String) *string

func StringSliceValueFromFramework

func StringSliceValueFromFramework(ctx context.Context, v basetypes.StringValuable) []string

StringSliceValueFromFramework converts a single Framework String value to a string slice. A null String is converted to a nil slice.

func StringToFramework

func StringToFramework(ctx context.Context, v *string) types.String

StringToFramework converts a string pointer to a Framework String value. A nil string pointer is converted to a null String.

func StringToFrameworkARN

func StringToFrameworkARN(ctx context.Context, v *string) fwtypes.ARN

StringToFrameworkARN converts a string pointer to a Framework custom ARN value. A nil string pointer is converted to a null ARN.

func StringToFrameworkLegacy

func StringToFrameworkLegacy(_ context.Context, v *string) types.String

StringToFrameworkLegacy converts a string pointer to a Framework String value. A nil string pointer is converted to an empty String.

func StringToFrameworkValuable

func StringToFrameworkValuable[T basetypes.StringValuable](ctx context.Context, v *string) T

StringToFrameworkValuable converts a string pointer to a Framework StringValuable value. A nil string pointer is converted to a null StringValuable.

func StringValueFromFramework

func StringValueFromFramework(ctx context.Context, v basetypes.StringValuable) string

StringValueFromFramework converts a Framework String value to a string. A null String is converted to an empty string.

func StringValueToFramework

func StringValueToFramework[T ~string](ctx context.Context, v T) types.String

StringValueToFramework converts a string value to a Framework String value. An empty string is converted to a null String.

func StringValueToFrameworkLegacy

func StringValueToFrameworkLegacy[T ~string](_ context.Context, v T) types.String

StringValueToFrameworkLegacy converts a string value to a Framework String value. An empty string is left as an empty String.

func TimeFromFramework

func TimeFromFramework(ctx context.Context, v timetypes.RFC3339) *time.Time

TimeFromFramework converts a Framework RFC3339 value to a time pointer. A null or unknonwn RFC3339 is converted to a nil time pointer.

func TimeToFramework

func TimeToFramework(ctx context.Context, v *time.Time) timetypes.RFC3339

TimeFromFramework converts a Framework RFC3339 value to a time pointer.

func ZeroInt32AsNull

func ZeroInt32AsNull(v types.Int32) types.Int32

Types

type AutoFlexOptions

type AutoFlexOptions struct {
	// contains filtered or unexported fields
}

AutoFlexOptions stores configurable options for an auto-flattener or expander.

type AutoFlexOptionsFunc

type AutoFlexOptionsFunc func(*AutoFlexOptions)

AutoFlexOptionsFunc is a type alias for an autoFlexer functional option.

func WithFieldNamePrefix

func WithFieldNamePrefix(s string) AutoFlexOptionsFunc

WithFieldNamePrefix specifies a prefix to be accounted for when matching field names between Terraform and AWS data structures

Use this option to improve fuzzy matching of field names during AutoFlex expand/flatten operations.

func WithFieldNameSuffix

func WithFieldNameSuffix(s string) AutoFlexOptionsFunc

WithFieldNameSuffix specifies a suffix to be accounted for when matching field names between Terraform and AWS data structures

Use this option to improve fuzzy matching of field names during AutoFlex expand/flatten operations.

func WithIgnoredFieldNames

func WithIgnoredFieldNames(fields []string) AutoFlexOptionsFunc

WithIgnoredFieldNames sets the list of ignored field names

Use this option to fully overwrite the ignored fields list. To preseve preexisting items, use WithIgnoredFieldNamesAppend instead.

func WithIgnoredFieldNamesAppend

func WithIgnoredFieldNamesAppend(s string) AutoFlexOptionsFunc

WithIgnoredFieldNamesAppend appends to the list of ignored field names

Use this option to preserve preexisting items in the ignored fields list.

func WithNoIgnoredFieldNames

func WithNoIgnoredFieldNames() AutoFlexOptionsFunc

WithNoIgnoredFieldNames empties the list of ignored field names

type ChangeOption

type ChangeOption func(*ChangeOptions)

ChangeOption is a type alias for a functional option that modifies ChangeOptions

func WithIgnoredField

func WithIgnoredField(fieldName string) ChangeOption

WithIgnoredField specifies a field name to be ignored when calculating plan changes

type ChangeOptions

type ChangeOptions struct {
	IgnoredFields []string
}

ChangeOptions holds configuration for calculating plan changes

func NewChangeOptions

func NewChangeOptions(options ...ChangeOption) *ChangeOptions

NewChangeOptions initializes ChangeOptions with the provided options

type Expander

type Expander interface {
	Expand(ctx context.Context) (any, diag.Diagnostics)
}

Expander is implemented by types that customize their expansion

type Flattener

type Flattener interface {
	Flatten(ctx context.Context, v any) diag.Diagnostics
}

Flattener is implemented by types that customize their flattening

type Results

type Results struct {
	// contains filtered or unexported fields
}

func Diff

func Diff(ctx context.Context, plan, state any, options ...ChangeOption) (*Results, diag.Diagnostics)

Diff compares the plan and state values and returns whether there are changes

func (*Results) HasChanges

func (r *Results) HasChanges() bool

HasChanges returns whether there are changes between the plan and state values

func (*Results) IgnoredFieldNames

func (r *Results) IgnoredFieldNames() []string

IgnoredFieldNames returns the list of ignored field names

func (*Results) IgnoredFieldNamesOpts

func (r *Results) IgnoredFieldNamesOpts() []AutoFlexOptionsFunc

IgnoredFieldNamesOpts returns the list of ignored field names as AutoFlexOptionsFunc

type TypedExpander

type TypedExpander interface {
	ExpandTo(ctx context.Context, targetType reflect.Type) (any, diag.Diagnostics)
}

Expander is implemented by types that customize their expansion and can have multiple target types

Jump to

Keyboard shortcuts

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