flex

package
v6.0.0-...-cc36f16 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MPL-2.0 Imports: 28 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 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 ExpandFrameworkStringMap

func ExpandFrameworkStringMap(ctx context.Context, v basetypes.MapValuable) map[string]*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) inttypes.Set[string]

func ExpandFrameworkStringyValueSet

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

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 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.ListOfString

func FlattenFrameworkStringValueListOfStringLegacy

func FlattenFrameworkStringValueListOfStringLegacy(ctx context.Context, vs []string) fwtypes.ListOfString

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 FlattenFrameworkStringValueSetOfString

func FlattenFrameworkStringValueSetOfString(ctx context.Context, vs []string) fwtypes.SetOfString

func FlattenFrameworkStringValueSetOfStringLegacy

func FlattenFrameworkStringValueSetOfStringLegacy(ctx context.Context, vs []string) fwtypes.SetOfString

func FlattenFrameworkStringyValueSetOfStringEnum

func FlattenFrameworkStringyValueSetOfStringEnum[T enum.Valueser[T]](ctx context.Context, vs []T) fwtypes.SetOfStringEnum[T]

func Float64FromFramework

func Float64FromFramework(ctx context.Context, v basetypes.Float64Valuable) *float64

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

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 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 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 Int64ValueToFramework

func Int64ValueToFramework(ctx context.Context, v int64) types.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 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 tfslices.Stringable](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 tfslices.Stringable](_ 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