utils

package
v6.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Available = "AVAILABLE"
View Source
const DefaultTimeout = 60 * time.Minute
View Source
const IonosDebug = "IONOS_DEBUG"

IonosDebug - env variable, set to true to enable debug

View Source
const MaxRetries = 999

MaxRetries - number of retries in case of rate-limit

View Source
const MaxWaitTime = 4 * time.Second

MaxWaitTime - waits 4 seconds before retry in case of rate limit

View Source
const SleepInterval = 5 * time.Second

Variables

This section is empty.

Functions

func CheckFileExists added in v6.3.2

func CheckFileExists(filePath string) bool

func CreateTransport

func CreateTransport() *http.Transport

CreateTransport - creates customizable transport for http clients

func DiffEmptyIps added in v6.3.6

func DiffEmptyIps(_, old, new string, _ *schema.ResourceData) bool

DiffEmptyIps suppress difference when empty value for array is overwritten by API and assigned an actual IP address

func DiffSlice

func DiffSlice(slice1 []string, slice2 []string) []string

func DiffSliceOneWay

func DiffSliceOneWay(a, b []string) []string

DiffSliceOneWay returns the elements in `a` that aren't in `b`.

func DiffToLower added in v6.3.2

func DiffToLower(_, old, new string, _ *schema.ResourceData) bool

DiffToLower terraform suppress differences between lower and upper

func DiffWithoutNewLines added in v6.3.2

func DiffWithoutNewLines(_, old, new string, _ *schema.ResourceData) bool

DiffWithoutNewLines terraform suppress differences between newlines

func GenerateEmail

func GenerateEmail() string

func GenerateImmutableError added in v6.3.6

func GenerateImmutableError(resource, field string) error

func GenerateSetError

func GenerateSetError(resource, field string, err error) error

func IsValidUUID added in v6.3.0

func IsValidUUID(uuid string) bool

func RemoveNewLines added in v6.3.2

func RemoveNewLines(s string) string

func SetPropWithNilCheck

func SetPropWithNilCheck(m map[string]interface{}, prop string, v interface{})

func TestImageNotNull added in v6.3.0

func TestImageNotNull(resource, attribute string) resource.TestCheckFunc

func TestNotEmptySlice added in v6.3.0

func TestNotEmptySlice(resource, attribute string) resource.TestCheckFunc

func TestValueInSlice

func TestValueInSlice(resource, attribute, value string) resource.TestCheckFunc

func WaitForResourceToBeDeleted added in v6.3.4

func WaitForResourceToBeDeleted(ctx context.Context, d *schema.ResourceData, fn IsResourceDeletedFunc) error

WaitForResourceToBeDeleted - keeps retrying until resource is not found(404), or until ctx is cancelled

func WaitForResourceToBeReady added in v6.3.4

func WaitForResourceToBeReady(ctx context.Context, d *schema.ResourceData, fn ResourceReadyFunc) error

WaitForResourceToBeReady - keeps retrying until resource is ready(true is returned), or until err is thrown, or ctx is cancelled

func WriteToFile added in v6.3.3

func WriteToFile(name, value string) error

WriteToFile - creates the file and writes 'value' to it.

Types

type ApiResponseInfo added in v6.3.4

type ApiResponseInfo interface {
	HttpNotFound() bool
	LogInfo()
}

ApiResponseInfo - interface over different ApiResponse types from sdks

type IsResourceDeletedFunc added in v6.3.4

type IsResourceDeletedFunc func(ctx context.Context, d *schema.ResourceData) (bool, error)

IsResourceDeletedFunc polls api to see if resource exists based on id

type ResourceReadyFunc added in v6.3.4

type ResourceReadyFunc func(ctx context.Context, d *schema.ResourceData) (bool, error)

ResourceReadyFunc polls api to see if resource exists based on id

Jump to

Keyboard shortcuts

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