util

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCompositeId added in v0.38.0

func BuildCompositeId(keys ...string) string

func BuildStringSetOrEmpty added in v1.0.0

func BuildStringSetOrEmpty(values []string) types.Set

func CalculateStateTime added in v1.1.0

func CalculateStateTime(ctx context.Context, stateValue timetypes.RFC3339, updatedValue time.Time) (timetypes.RFC3339, diag.Diagnostics)

func ConvertAttrStringMapToStringMap added in v0.33.0

func ConvertAttrStringMapToStringMap(attrMap map[string]attr.Value) map[string]string

func ConvertMapStringArrayToMapAttrValue added in v0.38.0

func ConvertMapStringArrayToMapAttrValue(ctx context.Context, m map[string][]string) (map[string]attr.Value, diag.Diagnostics)

func ConvertMapStringToMapAttrValue added in v0.38.0

func ConvertMapStringToMapAttrValue(m map[string]string) map[string]attr.Value

func ConvertMapToStringMap added in v1.0.0

func ConvertMapToStringMap(ctx context.Context, values types.Map) (map[string]types.String, diag.Diagnostics)

func ConvertPropertiesToAttributeValuesMap added in v1.0.0

func ConvertPropertiesToAttributeValuesMap(properties map[string]core.PropertyValue) (types.Map, diag.Diagnostics)

func ConvertStringMapToAttrStringMap added in v0.33.0

func ConvertStringMapToAttrStringMap(strMap map[string]string) map[string]attr.Value

func ConvertToPropertyValue added in v1.0.0

func ConvertToPropertyValue(value types.String, sensitive bool) core.PropertyValue

func Create

func Create(ctx context.Context, resource string, v ...any)

func Created

func Created(ctx context.Context, resource string, v ...any)

func DatasourceReading

func DatasourceReading(ctx context.Context, resource string, v ...any)

func DatasourceResultCount

func DatasourceResultCount(ctx context.Context, resource string, count int)

func Delete

func Delete(ctx context.Context, resource string, v ...any)

func Deleted

func Deleted(ctx context.Context, resource string, v ...any)

func ExpandStringList

func ExpandStringList(list types.List) []string

func ExpandStringSet added in v1.3.4

func ExpandStringSet(set types.Set) []string

func FlattenStringList

func FlattenStringList(list []string) types.List

func FlattenStringSet added in v1.3.4

func FlattenStringSet(slice []string, currentSet types.Set) types.Set

func GetDataSourceDescription

func GetDataSourceDescription(resourceName string) string

func GetIds

func GetIds(ids types.List) []string

func GetNumber

func GetNumber(val types.Int64) int

func GetOptionalIntValue added in v1.1.0

func GetOptionalIntValue(value types.Int64) int

func GetOptionalString added in v1.1.0

func GetOptionalString(value types.String) string

func GetOptionalStringPointer added in v1.1.0

func GetOptionalStringPointer(value types.String) *string

func GetProviderName

func GetProviderName() string

func GetResourceSchemaDescription

func GetResourceSchemaDescription(resourceName string) string

func GetStringOrEmpty

func GetStringOrEmpty(tfAttr interface{}) string

func GetStringPointer added in v1.1.0

func GetStringPointer(s types.String) *string

func GetTypeName

func GetTypeName(name string) string

func Map

func Map[T, V any](items []T, fn func(T) V) []V

func MapOptionalIntValue added in v1.1.0

func MapOptionalIntValue(value int) types.Int64

func MapOptionalStringValue added in v1.1.0

func MapOptionalStringValue(value string) types.String

func MergePropertyValues added in v1.0.0

func MergePropertyValues(ctx context.Context, properties map[string]core.PropertyValue, values types.Map) diag.Diagnostics

func Read

func Read(ctx context.Context, resource string, v ...any)

func Reading

func Reading(ctx context.Context, resource string, v ...any)

func SetToStringArray

func SetToStringArray(ctx context.Context, set types.Set) ([]string, diag.Diagnostics)

func SliceContains added in v1.3.2

func SliceContains[T comparable](slice []T, target T) bool

SliceContains returns true if it finds an item in the slice that is equal to the target

func SliceFilter added in v1.3.2

func SliceFilter[T any](slice []T, predicate func(item T) bool) []T

SliceFilter takes an input collection and returns elements where `predicate` returns true Known as 'filter' in most other languages or 'Select' in C# Linq.

func SliceFind added in v1.3.2

func SliceFind[T any](slice []T, predicate func(T) bool) *T

SliceFind returns the first element from the slice where the predicate returns true, or nil if not found

func SliceTransform added in v1.3.2

func SliceTransform[T any, TResult any](slice []T, transform func(item T) TResult) []TResult

SliceTransform takes an input collection, applies the transform function to each row, and returns the output. Known as 'map' in most other languages or 'Select' in C# Linq.

func SplitCompositeId added in v0.38.0

func SplitCompositeId(id string) []string

func StringOrNull

func StringOrNull(s string) types.String

func StringSlicesEqual added in v1.3.2

func StringSlicesEqual(a, b []string) bool

StringSlicesEqual compares two string slices for equality (ignoring order)

func Ternary

func Ternary[T interface{}](condition bool, whenTrue T, whenFalse T) T

func ToValueSlice

func ToValueSlice(slice []string) []attr.Value

func Update

func Update(ctx context.Context, resource string, v ...any)

func Updated

func Updated(ctx context.Context, resource string, v ...any)

Types

type AttributeBuilder

type AttributeBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewAttributeBuilder

func NewAttributeBuilder[T any]() *AttributeBuilder[T]

func ResourceBool

func ResourceBool() *AttributeBuilder[schema.BoolAttribute]

func ResourceInt32 added in v0.35.0

func ResourceInt32() *AttributeBuilder[schema.Int32Attribute]

func ResourceInt64

func ResourceInt64() *AttributeBuilder[schema.Int64Attribute]

func ResourceList

func ResourceList(elementType attr.Type) *AttributeBuilder[schema.ListAttribute]

func ResourceMap

func ResourceMap(elementType attr.Type) *AttributeBuilder[schema.MapAttribute]

func ResourceObject

func ResourceObject(attributeTypes map[string]attr.Type) *AttributeBuilder[schema.ObjectAttribute]

func ResourceSet

func ResourceSet(elementType attr.Type) *AttributeBuilder[schema.SetAttribute]

func (*AttributeBuilder[T]) AttributeTypes

func (b *AttributeBuilder[T]) AttributeTypes(attributeTypes map[string]attr.Type) *AttributeBuilder[T]

func (*AttributeBuilder[T]) Build

func (b *AttributeBuilder[T]) Build() T

func (*AttributeBuilder[T]) Computed

func (b *AttributeBuilder[T]) Computed() *AttributeBuilder[T]

func (*AttributeBuilder[T]) Default

func (b *AttributeBuilder[T]) Default(defaultValue interface{}) *AttributeBuilder[T]

func (*AttributeBuilder[T]) DefaultEmpty added in v1.0.0

func (b *AttributeBuilder[T]) DefaultEmpty() *AttributeBuilder[T]

DefaultEmpty sets the default value of an attribute to an empty collection.

This method applies only to ListAttribute, SetAttribute or MapAttribute types.

func (*AttributeBuilder[T]) Deprecated

func (b *AttributeBuilder[T]) Deprecated(deprecationMessage string) *AttributeBuilder[T]

func (*AttributeBuilder[T]) Description

func (b *AttributeBuilder[T]) Description(desc string) *AttributeBuilder[T]

func (*AttributeBuilder[T]) ElementType

func (b *AttributeBuilder[T]) ElementType(elementType attr.Type) *AttributeBuilder[T]

func (*AttributeBuilder[T]) Optional

func (b *AttributeBuilder[T]) Optional() *AttributeBuilder[T]

func (*AttributeBuilder[T]) PlanModifiers

func (b *AttributeBuilder[T]) PlanModifiers(modifiers ...any) *AttributeBuilder[T]

func (*AttributeBuilder[T]) Required

func (b *AttributeBuilder[T]) Required() *AttributeBuilder[T]

func (*AttributeBuilder[T]) Sensitive

func (b *AttributeBuilder[T]) Sensitive() *AttributeBuilder[T]

func (*AttributeBuilder[T]) Validators

func (b *AttributeBuilder[T]) Validators(validators ...any) *AttributeBuilder[T]

type DataSourceAttributeBuilder

type DataSourceAttributeBuilder[T any] struct {
	// contains filtered or unexported fields
}

func DataSourceList

func DataSourceList(elementType attr.Type) *DataSourceAttributeBuilder[schema.ListAttribute]

func DataSourceMap

func DataSourceMap(elementType attr.Type) *DataSourceAttributeBuilder[schema.MapAttribute]

func DataSourceSet

func DataSourceSet(elementType attr.Type) *DataSourceAttributeBuilder[schema.SetAttribute]

func NewDataSourceAttributeBuilder

func NewDataSourceAttributeBuilder[T any]() *DataSourceAttributeBuilder[T]

func (*DataSourceAttributeBuilder[T]) Build

func (b *DataSourceAttributeBuilder[T]) Build() T

func (*DataSourceAttributeBuilder[T]) Computed

func (*DataSourceAttributeBuilder[T]) Deprecated

func (b *DataSourceAttributeBuilder[T]) Deprecated(deprecationMessage string) *DataSourceAttributeBuilder[T]

func (*DataSourceAttributeBuilder[T]) Description

func (b *DataSourceAttributeBuilder[T]) Description(desc string) *DataSourceAttributeBuilder[T]

func (*DataSourceAttributeBuilder[T]) ElementType

func (b *DataSourceAttributeBuilder[T]) ElementType(elementType attr.Type) *DataSourceAttributeBuilder[T]

func (*DataSourceAttributeBuilder[T]) Optional

func (*DataSourceAttributeBuilder[T]) Required

func (*DataSourceAttributeBuilder[T]) Sensitive

Jump to

Keyboard shortcuts

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