verify

package
v0.0.0-...-c441d59 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const UUIDRegexPattern = `[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[ab89][a-f0-9]{3}-[a-f0-9]{12}`

Variables

View Source
var ValidStringDateOrPositiveInt = validation.Any(
	validation.IsRFC3339Time,
	validation.StringMatch(regexp.MustCompile(`^\d+$`), "must be a positive integer value"),
)

Functions

func Base64Encode

func Base64Encode(data []byte) string

Base64Encode encodes data if the input isn't already encoded using base64.StdEncoding.EncodeToString. If the input is already base64 encoded, return the original input unchanged.

func CIDRBlocksEqual

func CIDRBlocksEqual(cidr1, cidr2 string) bool

CIDRBlocksEqual returns whether or not two CIDR blocks are equal: - Both CIDR blocks parse to an IP address and network - The string representation of the IP addresses are equal - The string representation of the networks are equal This function is especially useful for IPv6 CIDR blocks which have multiple valid representations.

func CanonicalCIDRBlock

func CanonicalCIDRBlock(cidr string) string

CanonicalCIDRBlock returns the canonical representation of a CIDR block. This function is especially useful for hash functions for sets which include IPv6 CIDR blocks.

func DiffStringMaps

func DiffStringMaps(oldMap, newMap map[string]interface{}) (map[string]*string, map[string]*string, map[string]*string)

DiffStringMaps returns the set of keys and values that must be created, the set of keys and values that must be destroyed, and the set of keys and values that are unchanged.

func IsBase64Encoded

func IsBase64Encoded(data []byte) bool

func JSONBytesEqual

func JSONBytesEqual(b1, b2 []byte) bool

func NormalizeJSONOrYAMLString

func NormalizeJSONOrYAMLString(templateString interface{}) (string, error)

func PointersMapToStringList

func PointersMapToStringList(pointers map[string]*string) map[string]interface{}

func RetryOnAWSCode

func RetryOnAWSCode(code string, f func() (interface{}, error)) (interface{}, error)

func SetTagsDiff

func SetTagsDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error

SetTagsDiff sets the new plan difference with the result of merging resource tags on to those defined at the provider-level; returns an error if unsuccessful or if the resource tags are identical to those configured at the provider-level to avoid non-empty plans after resource READ operations as resource and provider-level tags will be indistinguishable when returned from an AWS API.

func SliceContainsString

func SliceContainsString(slice []interface{}, s string) (int, bool)

func SuppressEquivalentJSONDiffs

func SuppressEquivalentJSONDiffs(k, old, new string, d *schema.ResourceData) bool

func SuppressEquivalentJSONOrYAMLDiffs

func SuppressEquivalentJSONOrYAMLDiffs(k, old, new string, d *schema.ResourceData) bool

func SuppressEquivalentPolicyDiffs

func SuppressEquivalentPolicyDiffs(k, old, new string, d *schema.ResourceData) bool

func SuppressEquivalentTypeStringBoolean

func SuppressEquivalentTypeStringBoolean(k, old, new string, d *schema.ResourceData) bool

SuppressEquivalentTypeStringBoolean provides custom difference suppression for TypeString booleans Some arguments require three values: true, false, and "" (unspecified), but confusing behavior exists when converting bare true/false values with state.

func SuppressMissingOptionalConfigurationBlock

func SuppressMissingOptionalConfigurationBlock(k, old, new string, d *schema.ResourceData) bool

SuppressMissingOptionalConfigurationBlock handles configuration block attributes in the following scenario:

  • The resource schema includes an optional configuration block with defaults
  • The API response includes those defaults to refresh into the Terraform state
  • The operator's configuration omits the optional configuration block

func ValidARN

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

func ValidAccountID

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

func ValidCIDRNetworkAddress

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

ValidCIDRNetworkAddress ensures that the string value is a valid CIDR that represents a network address - it adds an error otherwise

func ValidIAMPolicyJSON

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

func ValidIPv4CIDRNetworkAddress

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

ValidIPv4CIDRNetworkAddress ensures that the string value is a valid IPv4 CIDR that represents a network address - it adds an error otherwise

func ValidIPv6CIDRNetworkAddress

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

ValidIPv6CIDRNetworkAddress ensures that the string value is a valid IPv6 CIDR that represents a network address - it adds an error otherwise

func ValidLaunchTemplateID

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

func ValidLaunchTemplateName

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

func ValidOnceADayWindowFormat

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

func ValidOnceAWeekWindowFormat

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

func ValidStringIsJSONOrYAML

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

func ValidTypeStringNullableBoolean

func ValidTypeStringNullableBoolean(v interface{}, k string) (ws []string, es []error)

ValidTypeStringNullableBoolean provides custom error messaging for TypeString booleans Some arguments require three values: true, false, and "" (unspecified). This ValidateFunc returns a custom message since the message with validation.StringInSlice([]string{"", "false", "true"}, false) is confusing: to be one of [ false true], got 1

func ValidTypeStringNullableFloat

func ValidTypeStringNullableFloat(v interface{}, k string) (ws []string, es []error)

ValidTypeStringNullableFloat provides custom error messaging for TypeString floats Some arguments require a floating point value or an unspecified, empty field.

func ValidUTCTimestamp

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

ValidUTCTimestamp validates a string in UTC Format required by APIs including: https://docs.aws.amazon.com/iot/latest/apireference/API_CloudwatchMetricAction.html https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceToPointInTime.html

func ValidateIPv4CIDRBlock

func ValidateIPv4CIDRBlock(cidr string) error

ValidateIPv4CIDRBlock validates that the specified CIDR block is valid: - The CIDR block parses to an IP address and network - The IP address is an IPv4 address - The CIDR block is the CIDR block for the network

func ValidateIPv6CIDRBlock

func ValidateIPv6CIDRBlock(cidr string) error

ValidateIPv6CIDRBlock validates that the specified CIDR block is valid: - The CIDR block parses to an IP address and network - The IP address is an IPv6 address - The CIDR block is the CIDR block for the network

Types

type ResourceDiffer

type ResourceDiffer interface {
	HasChange(string) bool
}

ResourceDiffer exposes the interface for accessing changes in a resource Implementations: * schema.ResourceData * schema.ResourceDiff FIXME: can be removed if https://github.com/hashicorp/terraform-plugin-sdk/pull/626/files is merged

Jump to

Keyboard shortcuts

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