Documentation
¶
Overview ¶
Package stringvalidator provides validators for types.String attributes.
Index ¶
- func LengthAtLeast(minLength int) tfsdk.AttributeValidator
- func LengthAtMost(maxLength int) tfsdk.AttributeValidator
- func LengthBetween(minLength, maxLength int) tfsdk.AttributeValidator
- func NoneOf(unacceptableStrings ...string) tfsdk.AttributeValidator
- func NoneOfCaseInsensitive(unacceptableStrings ...string) tfsdk.AttributeValidator
- func OneOf(acceptableStrings ...string) tfsdk.AttributeValidator
- func OneOfCaseInsensitive(acceptableStrings ...string) tfsdk.AttributeValidator
- func RegexMatches(regexp *regexp.Regexp, message string) tfsdk.AttributeValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LengthAtLeast ¶
func LengthAtLeast(minLength int) tfsdk.AttributeValidator
LengthAtLeast returns an AttributeValidator which ensures that any configured attribute value:
- Is a string.
- Is of length exclusively greater than the given minimum.
Null (unconfigured) and unknown (known after apply) values are skipped.
func LengthAtMost ¶
func LengthAtMost(maxLength int) tfsdk.AttributeValidator
LengthAtMost returns an AttributeValidator which ensures that any configured attribute value:
- Is a string.
- Is of length exclusively less than the given maximum.
Null (unconfigured) and unknown (known after apply) values are skipped.
func LengthBetween ¶
func LengthBetween(minLength, maxLength int) tfsdk.AttributeValidator
LengthBetween returns an AttributeValidator which ensures that any configured attribute value:
- Is a string.
- Is of length greater than the given minimum and less than the given maximum.
Null (unconfigured) and unknown (known after apply) values are skipped.
func NoneOf ¶ added in v0.3.0
func NoneOf(unacceptableStrings ...string) tfsdk.AttributeValidator
NoneOf checks that the string held in the attribute is none of the given `unacceptableStrings`.
func NoneOfCaseInsensitive ¶ added in v0.3.0
func NoneOfCaseInsensitive(unacceptableStrings ...string) tfsdk.AttributeValidator
NoneOfCaseInsensitive checks that the string held in the attribute is none of the given `unacceptableStrings`, irrespective of case sensitivity.
func OneOf ¶ added in v0.3.0
func OneOf(acceptableStrings ...string) tfsdk.AttributeValidator
OneOf checks that the string held in the attribute is one of the given `acceptableStrings`.
func OneOfCaseInsensitive ¶ added in v0.3.0
func OneOfCaseInsensitive(acceptableStrings ...string) tfsdk.AttributeValidator
OneOfCaseInsensitive checks that the string held in the attribute is one of the given `acceptableStrings`, irrespective of case sensitivity.
func RegexMatches ¶
func RegexMatches(regexp *regexp.Regexp, message string) tfsdk.AttributeValidator
RegexMatches returns an AttributeValidator which ensures that any configured attribute value:
- Is a string.
- Matches the given regular expression https://github.com/google/re2/wiki/Syntax.
Null (unconfigured) and unknown (known after apply) values are skipped. Optionally an error message can be provided to return something friendlier than "value must match regular expression 'regexp'".
Types ¶
This section is empty.