Documentation
¶
Index ¶
- func Cases(casesTypes []CasesValidatorType) validator.String
- func HTTPCode(settings HTTPCodeParams) validator.String
- func IsIP() validator.String
- func IsMacAddress() validator.String
- func IsNetmask() validator.String
- func IsNetwork(networkTypes []NetworkValidatorType, comparatorOR bool) validator.String
- func IsURN() validator.String
- func IsUUID() validator.String
- func Not(valueValidator validator.String) validator.String
- func NullIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.String
- func NullIfAttributeIsSet(path path.Expression) validator.String
- func OneOfWithDescription(values ...OneOfWithDescriptionValues) validator.String
- func OneOfWithDescriptionIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value, ...) validator.String
- func PrefixContains(prefix string) validator.String
- func RequireIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value) validator.String
- func RequireIfAttributeIsSet(path path.Expression) validator.String
- type CasesValidatorType
- type HTTPCodeParams
- type NetworkValidatorType
- type OneOfWithDescriptionIfAttributeIsOneOfValues
- type OneOfWithDescriptionValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cases ¶ added in v1.12.0
func Cases(casesTypes []CasesValidatorType) validator.String
Cases returns a new string validator that checks if the string matches any of the specified case types.
Parameters:
- casesTypes: A slice of CasesValidatorType that specifies the types of cases to validate against.
Returns:
- validator.String: A string validator that validates the string against the specified case types.
func HTTPCode ¶ added in v1.15.0
func HTTPCode(settings HTTPCodeParams) validator.String
HTTPCode validates that a string represents a valid HTTP status code.
Parameters:
- settings: HTTPCodeParams containing the configuration for the validator.
Returns:
- validator.String: A validator that checks if the string is a valid HTTP status code.
func IsIP ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Not returns a validator which ensures that the validators passed as arguments are not met.
func NullIfAttributeIsOneOf ¶
NullIfAttributeIsOneOf checks if the path.Path attribute contains one of the exceptedValue attr.Value.
func NullIfAttributeIsSet ¶
func NullIfAttributeIsSet(path path.Expression) validator.String
NullIfAttributeIsSet checks if the path.Path attribute contains one of the exceptedValue attr.Value.
func OneOfWithDescription ¶
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 OneOfWithDescriptionIfAttributeIsOneOf ¶ added in v1.10.0
func OneOfWithDescriptionIfAttributeIsOneOf(path path.Expression, exceptedValue []attr.Value, values ...OneOfWithDescriptionIfAttributeIsOneOfValues) validator.String
OneOfWithDescriptionIfAttributeIsOneOf checks that the String value is one of the expected values if the attribute is one of the exceptedValue. The description of the value is used to generate advanced Description and MarkdownDescription messages.
func PrefixContains ¶
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 ¶
RequireIfAttributeIsOneOf checks if the path.Path attribute contains one of the exceptedValue attr.Value.
func RequireIfAttributeIsSet ¶
func RequireIfAttributeIsSet(path path.Expression) validator.String
RequireIfAttributeIsSet checks if the path.Path attribute is set.
Types ¶
type CasesValidatorType ¶ added in v1.12.0
type CasesValidatorType string
const ( CasesDisallowUpper CasesValidatorType = "disallow_upper" CasesDisallowNumber CasesValidatorType = "disallow_number" CasesDisallowSpace CasesValidatorType = "disallow_space" CasesDisallowLower CasesValidatorType = "disallow_lower" )
type HTTPCodeParams ¶ added in v1.15.0
type NetworkValidatorType ¶
type NetworkValidatorType string
const ( IPV4 NetworkValidatorType = "ipv4" IPV4WithCIDR NetworkValidatorType = "ipv4_with_cidr" IPV4WithNetmask NetworkValidatorType = "ipv4_with_netmask" IPV4Range NetworkValidatorType = "ipv4_range" RFC1918 NetworkValidatorType = "rfc1918" TCPUDPPortRange NetworkValidatorType = "tcpudp_port_range" TCPUDPPort NetworkValidatorType = "tcpudp_port" )
type OneOfWithDescriptionIfAttributeIsOneOfValues ¶ added in v1.10.0
Source Files
¶
- cases.go
- http_code.go
- network.go
- network_ip.go
- network_mac_address.go
- network_netmask.go
- not_valid.go
- null_if_attribute_is_one_of.go
- null_if_attribute_is_set.go
- one_of_with_description.go
- one_of_with_description_if_attribute_is_one_of.go
- prefix.go
- require_if_attribute_is_one_of.go
- require_if_attribute_is_set.go
- urn.go
- uuid.go