conversion

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSRegionToMongoDBRegion added in v1.19.0

func AWSRegionToMongoDBRegion(region string) string

AWSRegionToMongoDBRegion converts region in us-east-1-like format to US_EAST_1-like

func DecodeStateID

func DecodeStateID(stateID string) map[string]string

func EncodeStateID

func EncodeStateID(values map[string]string) string

func ExpandStringList

func ExpandStringList(list []any) (res []string)

func ExpandStringListFromSetSchema added in v1.15.0

func ExpandStringListFromSetSchema(set *schema.Set) []string

func ExpandTagsFromSetSchema added in v1.15.2

func ExpandTagsFromSetSchema(d *schema.ResourceData) *[]admin.ResourceTag
func FlattenLinks(links []admin.Link) []map[string]string

func FlattenTags added in v1.15.2

func FlattenTags(tags []admin.ResourceTag) []map[string]string

func GetEncodedID

func GetEncodedID(stateID, keyPosition string) string

func HasElementsSliceOrMap added in v1.17.4

func HasElementsSliceOrMap(value any) bool

HasElementsSliceOrMap checks if param is a non-empty slice or map

func ImportStateProjectIDClusterName added in v1.20.0

func ImportStateProjectIDClusterName(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)

func Int64PtrToIntPtr

func Int64PtrToIntPtr(i64 *int64) *int

func IntPtr

func IntPtr(v int) *int

func IntPtrToInt64Ptr

func IntPtrToInt64Ptr(i *int) *int64

func IsStringPresent

func IsStringPresent(strPtr *string) bool

IsStringPresent returns true if the string is non-empty.

func MongoDBRegionToAWSRegion

func MongoDBRegionToAWSRegion(region string) string

MongoDBRegionToAWSRegion converts region in US_EAST_1-like format to us-east-1-like

func Pointer

func Pointer[T any](x T) *T

func SafeString

func SafeString(s *string) string

func StringNullIfEmpty

func StringNullIfEmpty(v string) types.String

StringNullIfEmpty converts a string value to a Framework String value. An empty string is converted to a null String. Useful for optional attributes.

func StringPtr

func StringPtr(v string) *string

func StringPtrNullIfEmpty

func StringPtrNullIfEmpty(p *string) types.String

StringPtrNullIfEmpty is similar to StringNullIfEmpty but can also handle nil string pointers.

func StringToTime added in v1.15.2

func StringToTime(str string) (time.Time, bool)

StringToTime is the opposite to TimeToString, returns ok if conversion is possible.

func TimePtrToStringPtr

func TimePtrToStringPtr(t *time.Time) *string

utility conversions that can potentially be defined in sdk

func TimeToString

func TimeToString(t time.Time) string

TimeToString returns a RFC3339 date time string format. The resulting format is identical to the format returned by Atlas API, documented as ISO 8601 timestamp format in UTC. It also returns decimals in seconds (up to nanoseconds) if available. Example formats: "2023-07-18T16:12:23Z", "2023-07-18T16:12:23.456Z"

func ToAnySlicePointer added in v1.17.4

func ToAnySlicePointer(value *[]map[string]any) *[]any

ToAnySlicePointer converts to a slice pointer of any as needed in some Atlas SDK Go structs

func ToTFMapOfSlices added in v1.17.0

func ToTFMapOfSlices(ctx context.Context, values map[string][]string) (basetypes.MapValue, diag.Diagnostics)

func TypesListToString

func TypesListToString(ctx context.Context, list types.List) []string

func TypesSetToString

func TypesSetToString(ctx context.Context, set types.Set) []string

func ValRegion

func ValRegion(reg any, opt ...string) (string, error)

func ValidateClusterName added in v1.20.0

func ValidateClusterName(clusterName string) error

func ValidateProjectID added in v1.20.0

func ValidateProjectID(projectID string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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