stringvalidator

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MPL-2.0 Imports: 9 Imported by: 320

Documentation

Overview

Package stringvalidator provides validators for types.String attributes.

Index

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:

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.

Jump to

Keyboard shortcuts

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