common

package
v1.23.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Descriptions = map[string]string{
	"access_key": "The access key for API operations. You can retrieve this\n" +
		"from the 'My Credential' section of the console.",

	"secret_key": "The secret key for API operations. You can retrieve this\n" +
		"from the 'My Credential' section of the console.",

	"auth_url": "The Identity authentication URL.",

	"region": "The OpenTelekomCloud region to connect to.",

	"user_name": "Username to login with.",

	"user_id": "User ID to login with.",

	"tenant_id": "The ID of the Tenant (Identity v2) or Project (Identity v3)\n" +
		"to login with.",

	"tenant_name": "The name of the Tenant (Identity v2) or Project (Identity v3)\n" +
		"to login with.",

	"password": "Password to login with.",

	"token": "Authentication token to use as an alternative to username/password.",

	"security_token": "Security token to use for OBS federated authentication.",

	"domain_id": "The ID of the Domain to scope to (Identity v3).",

	"domain_name": "The name of the Domain to scope to (Identity v3).",

	"insecure": "Trust self-signed certificates.",

	"cacert_file": "A Custom CA certificate.",

	"endpoint_type": "The catalog endpoint type to use.",

	"cert": "A client certificate to authenticate with.",

	"key": "A client private key to authenticate with.",

	"swauth": "Use Swift's authentication system instead of Keystone. Only used for\n" +
		"interaction with Swift.",

	"agency_name": "The name of agency",

	"agency_domain_name": "The name of domain who created the agency (Identity v3).",

	"delegated_project": "The name of delegated project (Identity v3).",

	"cloud": "An entry in a `clouds.yaml` file to use.",

	"max_retries": "How many times HTTP connection should be retried until giving up.",
}
View Source
var SuccessHTTPCodes = []int{200, 201, 202, 203, 204, 205, 206, 207, 208, 226}

Functions

func AddValueSpecs

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

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

func Base64IfNot

func Base64IfNot(src string) string

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 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 CheckForRetryableError

func CheckForRetryableError(err error) *resource.RetryError

func CheckYamlString

func CheckYamlString(yamlString interface{}) (string, error)

Takes a value containing YAML string and passes it through the YAML parser. Returns either a parsing error or original YAML string.

func ConvertStructToMap

func ConvertStructToMap(obj interface{}, nameMap map[string]string) (map[string]interface{}, error)

ConvertStructToMap converts an instance of struct to a map object, and changes each key of fields to the value of 'nameMap' if the key in it or to its corresponding lowercase.

func ExpandResourceTags

func ExpandResourceTags(tagMap map[string]interface{}) []tags.ResourceTag

ExpandResourceTags returns the tags for the given map of data.

func ExpandStringList

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

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

func ExpandToStringSlice

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

func FirstOneSet

func FirstOneSet(res map[string]interface{}, k1, k2 string) (interface{}, error)

FirstOneSet select first nonempty string or returns error if both are empty

func FlattenStringList

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

Takes list of pointers to strings. Expand to an array of raw strings and returns a []interface{} to keep compatibility w/ schema.NewSetschema.NewSet

func GetAllAvailableZones added in v1.23.2

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

func GetHashOrEmpty

func GetHashOrEmpty(v interface{}) string

func HasFilledOpt

func HasFilledOpt(d *schema.ResourceData, param string) bool

The result may be not correct when the type of param is string and user config it to 'param=""' but, there is no other way.

func ImportAsManaged

func ImportAsManaged(d *schema.ResourceData, _ interface{}) ([]*schema.ResourceData, error)

func InstallScriptEncode

func InstallScriptEncode(script string) string

func InstallScriptHashSum

func InstallScriptHashSum(script string) string

func IsEmptyValue

func IsEmptyValue(v reflect.Value) (bool, error)

func IsResourceNotFound

func IsResourceNotFound(err error) bool

func LooksLikeJsonString

func LooksLikeJsonString(s interface{}) bool

func MapResourceProp

func MapResourceProp(d *schema.ResourceData, prop string) map[string]interface{}

MapResourceProp converts ResourceData property into a map

func MapValueSpecs

func MapValueSpecs(d cfg.SchemaOrDiff) map[string]string

MapValueSpecs converts ResourceData into a map

func MultipleCustomizeDiffs

func MultipleCustomizeDiffs(funcs ...schema.CustomizeDiffFunc) schema.CustomizeDiffFunc
func NavigateValue(d interface{}, index []string, arrayIndex map[string]int) (interface{}, error)

func NormalizeJsonString

func NormalizeJsonString(jsonString interface{}) (string, error)

Takes a value containing JSON string and passes it through the JSON parser to normalize it, returns either a parsing error or normalized JSON string.

func ReplaceVars

func ReplaceVars(d *schema.ResourceData, linkTmpl string, kv map[string]string) (string, error)

func ReplaceVarsForTest

func ReplaceVarsForTest(rs *terraform.ResourceState, linkTmpl string) (string, error)

func SortVersions

func SortVersions(src []string) []string

SortVersions sorts versions from newer to older. If non-version-like string will be found in the slice, slice will be sorted as string slice in reversed order (z-a)

func StrSliceContains

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

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

func SuppressCaseInsensitive

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

func SuppressComputedFixedWhenFloatingIp

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

Suppress changes if we get a fixed ip when not expecting one, if we have a floating ip (generates fixed ip).

func SuppressDiffAll

func SuppressDiffAll(_, _, _ string, _ *schema.ResourceData) bool

Suppress all changes?

func SuppressEqualZoneNames

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

func SuppressEquivalentAwsPolicyDiffs

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

func SuppressExternalGateway

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

Suppress changes if we don't specify an external gateway, but one is specified for us

func SuppressLBWhitelistDiffs

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

func SuppressMinDisk

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

Suppress changes if we get a computed min_disk_gb if value is unspecified (default 0)

func SuppressRdsNameDiffs

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

func SuppressSmartVersionDiff

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

func TagsSchema

func TagsSchema() *schema.Schema

TagsSchema returns the schema to use for tags.

func TagsToMap

func TagsToMap(tags []tags.ResourceTag) map[string]string

TagsToMap returns the list of tags into a map.

func UpdateResourceTags

func UpdateResourceTags(client *golangsdk.ServiceClient, d *schema.ResourceData, resourceType, id string) error

UpdateResourceTags is a helper to update the tags for a resource. It expects the tags field to be named "tags"

func ValidateASGroupListenerID

func ValidateASGroupListenerID(v interface{}, k string) (ws []string, errors []error)

func ValidateAntiDdosAppTypeID

func ValidateAntiDdosAppTypeID(v interface{}, k string) (ws []string, errors []error)

func ValidateAntiDdosCleaningAccessPosID

func ValidateAntiDdosCleaningAccessPosID(v interface{}, k string) (ws []string, errors []error)

func ValidateAntiDdosHttpRequestPosID

func ValidateAntiDdosHttpRequestPosID(v interface{}, k string) (ws []string, errors []error)

func ValidateAntiDdosTrafficPosID

func ValidateAntiDdosTrafficPosID(v interface{}, k string) (ws []string, errors []error)

func ValidateCIDR

func ValidateCIDR(v interface{}, k string) (ws []string, errors []error)

func ValidateDDSStartTime

func ValidateDDSStartTime(v interface{}, _ string) (ws []string, errors []error)

func ValidateECSTagValue

func ValidateECSTagValue(v interface{}, _ string) (ws []string, errors []error)

func ValidateIP

func ValidateIP(v interface{}, k string) (ws []string, errors []error)

func ValidateIntRange

func ValidateIntRange(v interface{}, k string, l int, h int) (ws []string, errors []error)

ValidateIntRange Deprecated Use validation.IntBetween instead

func ValidateJsonString

func ValidateJsonString(v interface{}, k string) (ws []string, errors []error)

func ValidateK8sTagsMap

func ValidateK8sTagsMap(v interface{}, k string) (ws []string, errors []error)

func ValidateName

func ValidateName(v interface{}, k string) (ws []string, errors []error)

func ValidatePositiveInt

func ValidatePositiveInt(v interface{}, k string) (ws []string, errors []error)

ValidatePositiveInt Deprecated Use validation.IntAtLeast instead

func ValidateStackTemplate

func ValidateStackTemplate(v interface{}, k string) (ws []string, errors []error)

func ValidateStringList

func ValidateStringList(v interface{}, k string, l []string) (ws []string, errors []error)

ValidateStringList Deprecated Use validation.StringInSlice instead

func ValidateSubnet

func ValidateSubnet(argName string) schema.CustomizeDiffFunc

func ValidateTrueOnly

func ValidateTrueOnly(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSBackupName

func ValidateVBSBackupName(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSPolicyFrequency

func ValidateVBSPolicyFrequency(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSPolicyName

func ValidateVBSPolicyName(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSPolicyRetainBackup

func ValidateVBSPolicyRetainBackup(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSPolicyRetentionNum

func ValidateVBSPolicyRetentionNum(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSPolicyStatus

func ValidateVBSPolicyStatus(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSTagKey

func ValidateVBSTagKey(v interface{}, k string) (ws []string, errors []error)

func ValidateVBSTagValue

func ValidateVBSTagValue(v interface{}, k string) (ws []string, errors []error)

func ValidateVPC

func ValidateVPC(argName string) schema.CustomizeDiffFunc

func ValidateVolumeType

func ValidateVolumeType(argName string) schema.CustomizeDiffFunc

func WaitToFinish

func WaitToFinish(target, pending []string, timeout, interval time.Duration, f resource.StateRefreshFunc) (interface{}, error)

Types

type StringSearcher

type StringSearcher interface {
	AddToIndex(keys ...string)
	Contains(key string) bool
}

StringSearcher is string search structure with internal cache This allows single iteration from base slice for multiple string searches

func NewStringSearcher

func NewStringSearcher() StringSearcher

Create new StringSearcher instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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