stringvalidator

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIP

func IsIP() validator.String

IsIP returns a validator which ensures that the configured attribute value is a valid IP address with net.ParseIP package.

Null (unconfigured) and unknown (known after apply) values are skipped.

func IsMacAddress

func IsMacAddress() validator.String

IsMacAddress

returns a validator which ensures that the configured attribute value is a valid MacAddress.

Null (unconfigured) and unknown (known after apply) values are skipped.

func IsNetmask

func IsNetmask() validator.String

IsNetmask

returns a validator which ensures that the configured attribute value is a valid Netmask.

Null (unconfigured) and unknown (known after apply) values are skipped.

func IsNetwork added in v1.8.0

func IsNetwork(networkTypes []NetworkValidatorType, comparatorOR bool) validator.String

IsNetwork returns a validator that validates the string value is a valid network.

Parameters:

  • networkTypes : The network types to validate.
  • comparatorOR : If true, the value must be at least one of the network types.

func IsURN

func IsURN() validator.String

IsURN returns a validator which ensures that the configured attribute value is a valid URN.

Null (unconfigured) and unknown (known after apply) values are skipped.

func IsUUID

func IsUUID() validator.String

IsUUID returns a validator which ensures that the configured attribute value is a valid (v4) UUID.

Null (unconfigured) and unknown (known after apply) values are skipped.

func Not

func Not(valueValidator validator.String) validator.String

Not returns a validator which ensures that the validators passed as arguments are not met.

func NullIfAttributeIsOneOf added in v1.6.0

func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.String

NullIfAttributeIsOneOf checks if the path.Path attribute contains one of the exceptedValue attr.Value.

func NullIfAttributeIsSet added in v1.8.0

func NullIfAttributeIsSet(path path.Expression) validator.String

NullIfAttributeIsSet checks if the path.Path attribute contains one of the exceptedValue attr.Value.

func OneOfWithDescription added in v1.5.0

func OneOfWithDescription(values ...OneOfWithDescriptionValues) validator.String

OneOfWithDescription checks that the String held in the attribute is one of the given `values`. The description of the value is used to generate advanced Description and MarkdownDescription messages.

func PrefixContains added in v1.7.0

func PrefixContains(prefix string) validator.String

PrefixContainsValidator is a validator which ensures that the configured attribute value contains the specified prefix.

Null (unconfigured) and unknown (known after apply) values are skipped.

func RequireIfAttributeIsOneOf

func RequireIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.String

RequireIfAttributeIsOneOf checks if the path.Path attribute contains one of the exceptedValue attr.Value.

func RequireIfAttributeIsSet added in v1.8.0

func RequireIfAttributeIsSet(path path.Expression) validator.String

RequireIfAttributeIsSet checks if the path.Path attribute is set

Types

type NetworkValidatorType added in v1.8.0

type NetworkValidatorType string
const (
	IPV4            NetworkValidatorType = "ipv4"
	IPV4WithCIDR    NetworkValidatorType = "ipv4_with_cidr"
	IPv4WithNetmask NetworkValidatorType = "ipv4_with_netmask"
	RFC1918         NetworkValidatorType = "rfc1918"
)

type OneOfWithDescriptionValues added in v1.5.0

type OneOfWithDescriptionValues struct {
	Value       string
	Description string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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