utils

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolRef

func BoolRef(value any) *bool

func DecodeStruct added in v1.15.0

func DecodeStruct(input interface{}, result interface{}) error

func FromLocalizedString added in v1.8.0

func FromLocalizedString(value platform.LocalizedString) customtypes.LocalizedStringValue

func FromOptionalBool

func FromOptionalBool(value *bool) basetypes.BoolValue

func FromOptionalInt

func FromOptionalInt(value *int) basetypes.Int64Value

func FromOptionalLocalizedString added in v1.6.2

func FromOptionalLocalizedString(value *platform.LocalizedString) customtypes.LocalizedStringValue

func FromOptionalString

func FromOptionalString(value *string) basetypes.StringValue

func GetRef added in v1.17.0

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

GetRef gets the reference of value with generic type

func HCLTemplate

func HCLTemplate(data string, params map[string]any) string

func IntRef

func IntRef(value any) *int

func IsResourceNotFoundError

func IsResourceNotFoundError(err error) bool

IsResourceNotFoundError returns true if commercetools returned a 404 error

func OptionalInt

func OptionalInt(value types.Int64) *int

func OptionalString

func OptionalString(value types.String) *string

func ProcessRemoteError

func ProcessRemoteError(err error) *resource.RetryError

func Ref added in v1.15.0

func Ref[T comparable](value T) *T

func StringRef

func StringRef(value any) *string

Types

type Decoder added in v1.15.0

type Decoder interface {
	DecodeStruct(map[string]interface{}) error
}

type MutexKV

type MutexKV struct {
	// contains filtered or unexported fields
}

Copied from https://www.terraform.io/plugin/sdkv2/guides/v2-upgrade-guide#removal-of-helper-mutexkv-package

MutexKV is a simple key/value store for arbitrary mutexes. It can be used to serialize changes across arbitrary collaborators that share knowledge of the keys they must serialize on.

The initial use case is to let aws_security_group_rule resources serialize their access to individual security groups based on SG ID.

func NewMutexKV

func NewMutexKV() *MutexKV

Returns a properly initialized MutexKV

func (*MutexKV) Lock

func (m *MutexKV) Lock(key string)

Locks the mutex for the given key. Caller is responsible for calling Unlock for the same key

func (*MutexKV) Unlock

func (m *MutexKV) Unlock(key string)

Unlock the mutex for the given key. Caller must have called Lock for the same key first

type ProviderData

type ProviderData struct {
	Client *platform.ByProjectKeyRequestBuilder
	Mutex  *MutexKV
}

Jump to

Keyboard shortcuts

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