Documentation ¶
Overview ¶
Package utils provides utils for Terraform Provider.
Index ¶
- func GenerateUUID[T tfValuesForUUID](values ...T) types.String
- func ModelCopy(source, dest interface{})
- func SlicePointerToSlice[T any](slicePointer []*T) []T
- func SliceToSlicePointer[T any](slice []T) []*T
- func SliceTypesStringToSliceString(slice []types.String) []string
- func SortMapStringByKeys[T any](m map[string]T) map[string]T
- func StringValueOrNull(value string) basetypes.StringValue
- func SuperSliceTypesStringToSliceString(slice []supertypes.StringValue) []string
- func SuperStringValueOrNull(value string) supertypes.StringValue
- func TakeBoolPointer(value bool) *bool
- func TakeInt64Pointer(x int64) *int64
- func TakeIntPointer(x int) *int
- func TakePointer[T any](value T) *T
- type OpenAPIValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateUUID ¶
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 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
SliceTypesStringToSliceString converts a slice of types.String to a slice of string.
func SortMapStringByKeys ¶ added in v0.3.0
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 ¶
TakeBoolPointer accepts a boolean and returns a pointer to this value.
func TakeInt64Pointer ¶
TakeInt64Pointer accepts an int64 and returns a pointer to this value.
func TakeIntPointer ¶
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.