util

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const RequestIDHeader = "X-Openstack-Request-Id"

Variables

View Source
var DecoderConfig = &mapstructure.DecoderConfig{
	TagName: "json",
}

Functions

func AddValueSpecs

func AddValueSpecs(body map[string]interface{}) map[string]interface{}

AddValueSpecs expands the 'value_specs' object and removes 'value_specs' from the reqeust body.

func BuildRequest

func BuildRequest(opts interface{}, parent string) (map[string]interface{}, error)

BuildRequest takes an opts struct and builds a request body for Gophercloud to execute.

func CheckAlreadyExists

func CheckAlreadyExists(err error, msg, resourceName, conflict string) error

func CheckDeleted

func CheckDeleted(d *schema.ResourceData, err error, msg string) error

CheckDeleted checks the error to see if it's a 404 (Not Found) and, if so, sets the resource ID to the empty string instead of throwing an error.

func CheckDeletedDatasource added in v0.3.0

func CheckDeletedDatasource(ctx context.Context, r *datasource.ReadResponse, err error) error

checkDeletedDatasource checks the error to see if it's a 404 (Not Found) and, if so, sets the resource ID to the empty string instead of throwing an error.

func CheckDeletedResource added in v0.4.0

func CheckDeletedResource(ctx context.Context, r *resource.ReadResponse, err error) error

checkDeletedResource checks the error to see if it's a 404 (Not Found) and, if so, sets the resource ID to the empty string instead of throwing an error.

func CheckForRetryableError

func CheckForRetryableError(err error) *retry.RetryError

func CopyToMap

func CopyToMap(dst, src *map[string]string)

func EnsureOnlyOnePresented

func EnsureOnlyOnePresented(d *schema.ResourceData, keys ...string) (string, error)

func ErrorWithRequestID added in v0.5.4

func ErrorWithRequestID(err error, requestID string) error

func ExpandObjectReadTags

func ExpandObjectReadTags(d *schema.ResourceData, tags []string)

func ExpandObjectTags

func ExpandObjectTags(d *schema.ResourceData) []string

func ExpandObjectUpdateTags

func ExpandObjectUpdateTags(d *schema.ResourceData) []string

func ExpandToMapStringString

func ExpandToMapStringString(v map[string]interface{}) map[string]string

func ExpandToStringSlice

func ExpandToStringSlice(v []interface{}) []string

func ExpandVendorOptions

func ExpandVendorOptions(vendOptsRaw []interface{}) map[string]interface{}

func GetRegion

func GetRegion(d *schema.ResourceData, config clients.Config) string

GetRegion returns the region that was specified in the resource. If a region was not set, the provider-level region is checked. The provider-level region can either be set by the region argument or by OS_REGION_NAME.

func GetTimestamp

func GetTimestamp(t *time.Time) string

GetTimestamp ...

func IsOperationNotSupported

func IsOperationNotSupported(d string, types ...string) bool

func MapStructureDecoder

func MapStructureDecoder(strct interface{}, v *map[string]interface{}, config *mapstructure.DecoderConfig) error

MapStructureDecoder ...

func MapValueSpecs

func MapValueSpecs(d *schema.ResourceData) map[string]string

MapValueSpecs converts ResourceData into a map.

func SliceUnion

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

func StrSliceContains

func StrSliceContains(haystack []string, needle string) bool

util.StrSliceContains checks if a given string is contained in a slice When anybody asks why Go needs generics, here you go.

func StructToMap

func StructToMap(s interface{}) (map[string]interface{}, error)

StructToMap converts a structure to map with keys set to lowered structure field names NOTE: This function does not implement mapping nested structures

func ValueKnownBoolPointer added in v0.5.0

func ValueKnownBoolPointer(v basetypes.BoolValue) *bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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