converters

package
v1.65.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoSdkToTfSdkStruct

func GoSdkToTfSdkStruct(ctx context.Context, gosdk interface{}, tfsdk interface{}) (d diag.Diagnostics)

GoSdkToTfSdkStruct converts a gosdk struct into a tfsdk struct, with the folowing rules.

string -> types.String bool -> types.Bool int64 -> types.Int64 float64 -> types.Float64 Struct and pointer to struct -> types.List Slice -> types.List Map -> types.Map

`gosdk` parameter must be a struct or pointer to a struct. `tfsdk` must be a pointer to the corresponding TF SDK structure.

Structs in Go SDK are represented as types.Lists. If field name doesn't show up in ForceSendFields and the field is zero value, we set the null value on the tfsdk. Map keys must always be strings. TF SDK structs use types.String for all enum values. Non-JSON fields will be omitted.

func TfSdkToGoSdkStruct

func TfSdkToGoSdkStruct(ctx context.Context, tfsdk interface{}, gosdk interface{}) (d diag.Diagnostics)

TfSdkToGoSdkStruct converts a tfsdk struct into a gosdk struct, with the folowing rules.

types.String -> string
types.Bool -> bool
types.Int64 -> int64
types.Float64 -> float64
types.String -> string

NOTE:

Structs are represented as slice of structs in tfsdk, and pointers are removed

ForceSendFields are populated for string, bool, int64, float64 on non null values types.list and types.map are not supported map keys should always be a string tfsdk structs use types.String for all enum values

Types

This section is empty.

Jump to

Keyboard shortcuts

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