utils

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package utils provides utils for Terraform Provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateUUID

func GenerateUUID[T tfValuesForUUID](values ...T) types.String

GenerateUUID generates a unique UUID. The value can be a string or a slice of strings. This is used to generate a unique ID for a resource.

func ModelCopy added in v0.7.0

func ModelCopy(source, dest interface{})

func SlicePointerToSlice added in v0.15.0

func SlicePointerToSlice[T any](slicePointer []*T) []T

func SliceToSlicePointer added in v0.15.0

func SliceToSlicePointer[T any](slice []T) []*T

func SliceTypesStringToSliceString added in v0.5.0

func SliceTypesStringToSliceString(slice []types.String) []string

SliceTypesStringToSliceString converts a slice of types.String to a slice of string.

func SortMapStringByKeys added in v0.3.0

func SortMapStringByKeys[T any](m map[string]T) map[string]T

SortMapStringByKeys sorts a map[string]string by keys.

func StringValueOrNull

func StringValueOrNull(value string) basetypes.StringValue

StringValueOrNull return a null StringValue if value is "" or return StringValue(value) if not.

func SuperSliceTypesStringToSliceString added in v0.7.0

func SuperSliceTypesStringToSliceString(slice []supertypes.StringValue) []string

SuperSliceTypesStringToSliceString converts a slice of supertypes.StringValue to a slice of string.

func SuperStringValueOrNull added in v0.7.0

func SuperStringValueOrNull(value string) supertypes.StringValue

SuperStringValueOrNull return a null SuperStringValue if value is "" or return SuperStringValue(value) if not.

func TakeBoolPointer

func TakeBoolPointer(value bool) *bool

TakeBoolPointer accepts a boolean and returns a pointer to this value.

func TakeInt64Pointer

func TakeInt64Pointer(x int64) *int64

TakeInt64Pointer accepts an int64 and returns a pointer to this value.

func TakeIntPointer

func TakeIntPointer(x int) *int

TakeIntPointer accepts an int and returns a pointer to this value.

func TakePointer added in v0.15.0

func TakePointer[T any](value T) *T

TakePointer return a pointer to the value.

Types

type OpenAPIValues added in v0.6.0

type OpenAPIValues []string

func OpenAPIReferenceToSliceID added in v0.6.0

func OpenAPIReferenceToSliceID(slice []govcdtypes.OpenApiReference) OpenAPIValues

OpenApiReferenceToSliceID converts a slice of OpenApiReference to a slice of ID.

func OpenAPIReferenceToSliceName added in v0.6.0

func OpenAPIReferenceToSliceName(slice []govcdtypes.OpenApiReference) OpenAPIValues

OpenAPIReferenceToSliceName converts a slice of OpenApiReference to a slice of Name.

func (*OpenAPIValues) ToTerraformTypesString added in v0.6.0

func (o *OpenAPIValues) ToTerraformTypesString() []types.String

ToTerraformTypes converts a slice of string to a slice of types.String.

func (OpenAPIValues) ToTerraformTypesStringSet added in v0.6.0

func (o OpenAPIValues) ToTerraformTypesStringSet(ctx context.Context) basetypes.SetValue

ToTerraformTypesSet converts a slice of string to a slice of types.StringSet.

Jump to

Keyboard shortcuts

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