utils

package
v0.20.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoBoxBoolNumberStr

func AutoBoxBoolNumberStr(str interface{}) types.Bool

func AutoBoxString

func AutoBoxString(str interface{}) types.String

func AutoUnboxString

func AutoUnboxString(str types.String, def string) string

func BoolToNumberStr

func BoolToNumberStr(b bool) string

Functions to handle booleans

func ColumnFirstOrDefault

func ColumnFirstOrDefault(resp *response.Response, colName string, def interface{}) interface{}

func ColumnIndexOrDefault

func ColumnIndexOrDefault(resp *response.Response, colName string, def interface{}, idx int) interface{}

Functions for dealing the the API "column" concept easier

func ColumnOrDefault

func ColumnOrDefault(resp *response.Response, colName string, def []string) []string

func FillRequestArray

func FillRequestArray(ctx context.Context, list elementsAsCapableValue, oldList elementsAsCapableValue, prefix string, req map[string]interface{}, diags *diag.Diagnostics)

func FillRequestArrayWithIgnore added in v0.9.0

func FillRequestArrayWithIgnore(ctx context.Context, listObj elementsAsCapableValue, oldListObj elementsAsCapableValue, prefix string, req map[string]interface{}, diags *diag.Diagnostics, ignore map[string]bool)

func HandleExtraAttributesRead

func HandleExtraAttributesRead(resp *response.Response) types.Map

Functions to handle X- attributes

func HandleExtraAttributesWrite

func HandleExtraAttributesWrite(extraAttributesBox types.Map, oldExtraAttributesBox types.Map, req map[string]interface{})

func HandlePossibleErrorResponse

func HandlePossibleErrorResponse(resp *response.Response, diags *diag.Diagnostics)

func HandleUnexpectedUnknown

func HandleUnexpectedUnknown(diags *diag.Diagnostics)

func IPAddressType

func IPAddressType(allowIPv4 bool, allowIPv6 bool) *ipAddressType

func MakeNotConfiguredError

func MakeNotConfiguredError(diags *diag.Diagnostics)

func NumberStrToBool

func NumberStrToBool(str string) bool

func ResourceSchemaToDataSourceSchema added in v0.17.0

func ResourceSchemaToDataSourceSchema(resourceSchema map[string]resource_schema.Attribute, idField string) map[string]datasource_schema.Attribute

func StringListToAttrList

func StringListToAttrList(elems []string) []attr.Value

func StringListToAttrListWithIgnore added in v0.9.0

func StringListToAttrListWithIgnore(elems []string, ignore map[string]bool) []attr.Value

func StringListToTypedAttrList added in v0.16.1

func StringListToTypedAttrList(elems []string, typeCtor TypeCtor) []attr.Value

func StringListToTypedAttrListWithIgnore added in v0.16.1

func StringListToTypedAttrListWithIgnore(elems []string, ignore map[string]bool, typeCtor TypeCtor) []attr.Value

Types

type CommandType

type CommandType = string

Useful constants

const (
	CommandCreate CommandType = "Add"
	CommandRead   CommandType = "Status"
	CommandUpdate CommandType = "Modify"
	CommandDelete CommandType = "Delete"
)

type TypeCtor added in v0.16.1

type TypeCtor = func(str string) attr.Value

Jump to

Keyboard shortcuts

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