Documentation ¶
Overview ¶
Package frameworkvalidators contains functionality for mapping validations onto specification that uses terraform-plugin-framework-validators.
Currently, the specification requires all schema validations to be written as "custom" validations. Over time, the specification may begin to support "native" validations for very common use cases as specific properties, which would alleviate some of the need of this package.
Index ¶
- Constants
- Variables
- func CodeImport(packagePath string) code.Import
- func Float64ValidatorOneOf(values []float64) *schema.CustomValidator
- func Int64ValidatorAtLeast(minimum int64) *schema.CustomValidator
- func Int64ValidatorAtMost(maximum int64) *schema.CustomValidator
- func Int64ValidatorBetween(minimum, maximum int64) *schema.CustomValidator
- func Int64ValidatorOneOf(values []int64) *schema.CustomValidator
- func ListValidatorSizeAtLeast(minimum int64) *schema.CustomValidator
- func ListValidatorSizeAtMost(maximum int64) *schema.CustomValidator
- func ListValidatorSizeBetween(minimum, maximum int64) *schema.CustomValidator
- func ListValidatorUniqueValues() *schema.CustomValidator
- func MapValidatorSizeAtLeast(minimum int64) *schema.CustomValidator
- func MapValidatorSizeAtMost(maximum int64) *schema.CustomValidator
- func MapValidatorSizeBetween(minimum, maximum int64) *schema.CustomValidator
- func SetValidatorSizeAtLeast(minimum int64) *schema.CustomValidator
- func SetValidatorSizeAtMost(maximum int64) *schema.CustomValidator
- func SetValidatorSizeBetween(minimum, maximum int64) *schema.CustomValidator
- func StringValidatorLengthAtLeast(minimum int64) *schema.CustomValidator
- func StringValidatorLengthAtMost(maximum int64) *schema.CustomValidator
- func StringValidatorLengthBetween(minimum, maximum int64) *schema.CustomValidator
- func StringValidatorOneOf(values []string) *schema.CustomValidator
- func StringValidatorRegexMatches(pattern, message string) *schema.CustomValidator
Constants ¶
const (
// CodeImportBasePath is the base code import path for framework validators.
CodeImportBasePath = "github.com/hashicorp/terraform-plugin-framework-validators"
)
const ( // Float64ValidatorPackage is the name of the float64 validation package in // the framework validators module. Float64ValidatorPackage = "float64validator" )
const ( // Int64ValidatorPackage is the name of the int64 validation package in // the framework validators module. Int64ValidatorPackage = "int64validator" )
const ( // ListValidatorPackage is the name of the list validation package in // the framework validators module. ListValidatorPackage = "listvalidator" )
const ( // MapValidatorPackage is the name of the set validation package in // the framework validators module. MapValidatorPackage = "mapvalidator" )
const ( // SetValidatorPackage is the name of the set validation package in // the framework validators module. SetValidatorPackage = "setvalidator" )
const ( // StringValidatorPackage is the name of the string validation package in // the framework validators module. StringValidatorPackage = "stringvalidator" )
Variables ¶
var ( // Float64ValidatorCodeImport is a single allocation of the framework // validators module float64validator package import. Float64ValidatorCodeImport code.Import = CodeImport(Float64ValidatorPackage) )
var ( // Int64ValidatorCodeImport is a single allocation of the framework // validators module int64validator package import. Int64ValidatorCodeImport code.Import = CodeImport(Int64ValidatorPackage) )
var ( // ListValidatorCodeImport is a single allocation of the framework // validators module listvalidator package import. ListValidatorCodeImport code.Import = CodeImport(ListValidatorPackage) )
var ( // MapValidatorCodeImport is a single allocation of the framework // validators module mapvalidator package import. MapValidatorCodeImport code.Import = CodeImport(MapValidatorPackage) )
var ( // SetValidatorCodeImport is a single allocation of the framework // validators module setvalidator package import. SetValidatorCodeImport code.Import = CodeImport(SetValidatorPackage) )
var ( // StringValidatorCodeImport is a single allocation of the framework // validators module stringvalidator package import. StringValidatorCodeImport code.Import = CodeImport(StringValidatorPackage) )
Functions ¶
func CodeImport ¶
CodeImport returns the framework validators code import for the given path.
func Float64ValidatorOneOf ¶
func Float64ValidatorOneOf(values []float64) *schema.CustomValidator
Float64ValidatorOneOf returns a custom validator mapped to the Float64validator package OneOf function. If the values are nil or empty, nil is returned.
func Int64ValidatorAtLeast ¶
func Int64ValidatorAtLeast(minimum int64) *schema.CustomValidator
Int64ValidatorAtLeast returns a custom validator mapped to the int64validator package AtLeast function.
func Int64ValidatorAtMost ¶
func Int64ValidatorAtMost(maximum int64) *schema.CustomValidator
Int64ValidatorAtMost returns a custom validator mapped to the int64validator package AtMost function.
func Int64ValidatorBetween ¶
func Int64ValidatorBetween(minimum, maximum int64) *schema.CustomValidator
Int64ValidatorBetween returns a custom validator mapped to the int64validator package Between function.
func Int64ValidatorOneOf ¶
func Int64ValidatorOneOf(values []int64) *schema.CustomValidator
Int64ValidatorOneOf returns a custom validator mapped to the int64validator package OneOf function. If the values are nil or empty, nil is returned.
func ListValidatorSizeAtLeast ¶
func ListValidatorSizeAtLeast(minimum int64) *schema.CustomValidator
ListValidatorSizeAtLeast returns a custom validator mapped to the listvalidator package SizeAtLeast function.
func ListValidatorSizeAtMost ¶
func ListValidatorSizeAtMost(maximum int64) *schema.CustomValidator
ListValidatorSizeAtMost returns a custom validator mapped to the listvalidator package SizeAtMost function.
func ListValidatorSizeBetween ¶
func ListValidatorSizeBetween(minimum, maximum int64) *schema.CustomValidator
ListValidatorSizeBetween returns a custom validator mapped to the listvalidator package SizeBetween function.
func ListValidatorUniqueValues ¶
func ListValidatorUniqueValues() *schema.CustomValidator
ListValidatorUniqueValues returns a custom validator mapped to the listvalidator package UniqueValues function.
func MapValidatorSizeAtLeast ¶
func MapValidatorSizeAtLeast(minimum int64) *schema.CustomValidator
MapValidatorSizeAtLeast returns a custom validator mapped to the Mapvalidator package SizeAtLeast function.
func MapValidatorSizeAtMost ¶
func MapValidatorSizeAtMost(maximum int64) *schema.CustomValidator
MapValidatorSizeAtMost returns a custom validator mapped to the Mapvalidator package SizeAtMost function.
func MapValidatorSizeBetween ¶
func MapValidatorSizeBetween(minimum, maximum int64) *schema.CustomValidator
MapValidatorSizeBetween returns a custom validator mapped to the Mapvalidator package SizeBetween function.
func SetValidatorSizeAtLeast ¶
func SetValidatorSizeAtLeast(minimum int64) *schema.CustomValidator
SetValidatorSizeAtLeast returns a custom validator mapped to the Setvalidator package SizeAtLeast function.
func SetValidatorSizeAtMost ¶
func SetValidatorSizeAtMost(maximum int64) *schema.CustomValidator
SetValidatorSizeAtMost returns a custom validator mapped to the Setvalidator package SizeAtMost function.
func SetValidatorSizeBetween ¶
func SetValidatorSizeBetween(minimum, maximum int64) *schema.CustomValidator
SetValidatorSizeBetween returns a custom validator mapped to the Setvalidator package SizeBetween function.
func StringValidatorLengthAtLeast ¶
func StringValidatorLengthAtLeast(minimum int64) *schema.CustomValidator
StringValidatorLengthAtLeast returns a custom validator mapped to the stringvalidator package LengthAtLeast function.
func StringValidatorLengthAtMost ¶
func StringValidatorLengthAtMost(maximum int64) *schema.CustomValidator
StringValidatorLengthAtMost returns a custom validator mapped to the stringvalidator package LengthAtMost function.
func StringValidatorLengthBetween ¶
func StringValidatorLengthBetween(minimum, maximum int64) *schema.CustomValidator
StringValidatorLengthBetween returns a custom validator mapped to the stringvalidator package LengthBetween function.
func StringValidatorOneOf ¶
func StringValidatorOneOf(values []string) *schema.CustomValidator
StringValidatorOneOf returns a custom validator mapped to the stringvalidator package OneOf function. If the values are nil or empty, nil is returned.
func StringValidatorRegexMatches ¶
func StringValidatorRegexMatches(pattern, message string) *schema.CustomValidator
StringValidatorRegexMatches returns a custom validator mapped to the stringvalidator package RegexMatches function.
Types ¶
This section is empty.