helper

package
v1.59.15 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(i bool) *bool

func BoolToInt64Pointer

func BoolToInt64Pointer(s bool) (i *uint64)

func BoolToInt64Ptr

func BoolToInt64Ptr(s bool) (i *int64)

func BuildToken

func BuildToken() string

func CheckIfSetTogether

func CheckIfSetTogether(d *schema.ResourceData, args ...string) error

CheckIfSetTogether will check all args, they should be all nil or not nil.

Such as vpc_id and subnet_id should set together, or don't set them.

func ComposeValidateFunc

func ComposeValidateFunc(fns ...schema.SchemaValidateFunc) schema.SchemaValidateFunc

compose all schema.SchemaValidateFunc to a schema.SchemaValidateFunc, like resource.ComposeTestCheckFunc, so that we can reuse exist schema.SchemaValidateFunc and reduce custom schema.SchemaValidateFunc codes size.

func DataResourceIdHash

func DataResourceIdHash(id string) string

Generates a hash for the set hash function used by the ID

func DataResourceIdsHash

func DataResourceIdsHash(ids []string) string

Generates a hash for the set hash function used by the IDs

func Float64

func Float64(i float64) *float64

func FormatUnixTime

func FormatUnixTime(n uint64) string

func GetTags

func GetTags(d *schema.ResourceData, k string) map[string]string

func IdFormat added in v1.58.0

func IdFormat(s ...string) string

func IdParse added in v1.58.0

func IdParse(s string) []string

func Int

func Int(i int) *int

func Int64

func Int64(i int64) *int64

func Int64Uint64

func Int64Uint64(i int64) *uint64

func IntInt64

func IntInt64(i int) *int64

func IntUint64

func IntUint64(i int) *uint64

func InterfacesIntInt64Point

func InterfacesIntInt64Point(configured []interface{}) []*int64

func InterfacesStrings

func InterfacesStrings(configured []interface{}) []string

Takes the result of flatmap.Expand for an array of strings and returns a []string

func InterfacesStringsPoint

func InterfacesStringsPoint(configured []interface{}) []*string

func PString

func PString(pointer *string) string

func ParseTime

func ParseTime(s string) (time.Time, error)

func SliceFieldSerialize

func SliceFieldSerialize(slice []string) string
    Serialize slice into the usage document
	eg["status_change","abnormal"] will be "`abnormal`,`status_change`"

func String

func String(i string) *string

func Strings

func Strings(strs []string) []*string

func StringsContain

func StringsContain(ss []string, str string) bool

func StringsInterfaces

func StringsInterfaces(list []*string) []interface{}

Flatten to an array of raw strings and returns a []interface{}

func Uint

func Uint(i uint) *uint

func Uint64

func Uint64(i uint64) *uint64

func Uint64sInterfaces

func Uint64sInterfaces(list []*uint64) []interface{}

func WrapError

func WrapError(cause error, id, requestId string) error

func WrapErrorf

func WrapErrorf(cause error, id, requestId, msg string, args ...interface{}) error

if cause is *sdkErrors.TencentCloudSDKError, will use sdk error request-id

Types

type Error

type Error struct {
	Id        string
	RequestId string
	Cause     error
	// contains filtered or unexported fields
}

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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