Documentation
¶
Index ¶
- func AllOf(validators ...func(string, *core.ScalarValue) []*core.Diagnostic) func(string, *core.ScalarValue) []*core.Diagnostic
- func ConflictsWithPluginConfig(conflictsWithKey string, conflictOptions *ConflictOptions) func(string, *core.ScalarValue, core.PluginConfig) []*core.Diagnostic
- func ConflictsWithResourceDefinition(conflictsWithFieldPath string, conflictOptions *ConflictOptions) func(string, *core.MappingNode, *schema.Resource) []*core.Diagnostic
- func FloatRange(minValue float64, maxValue float64) func(string, *core.ScalarValue) []*core.Diagnostic
- func IntRange(minValue int, maxValue int) func(string, *core.ScalarValue) []*core.Diagnostic
- func IsCIDR() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsCIDRNetwork(minValue int, maxValue int) func(string, *core.ScalarValue) []*core.Diagnostic
- func IsDayOfTheWeek(ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
- func IsHTTPSURL() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsHTTPURL() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsIPAddress() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsIPv4Address() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsIPv4Range() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsIPv6Address() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsMACAddress() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsMonth(ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
- func IsPortNumber() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsPortNumberOrZero() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsRFC3339() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsShortMonth(ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
- func IsURL(allowedSchemes []string) func(string, *core.ScalarValue) []*core.Diagnostic
- func IsUUID() func(string, *core.ScalarValue) []*core.Diagnostic
- func IsWebURL() func(string, *core.ScalarValue) []*core.Diagnostic
- func MaxFloat(maxValue float64) func(string, *core.ScalarValue) []*core.Diagnostic
- func MaxInt(maxValue int) func(string, *core.ScalarValue) []*core.Diagnostic
- func MaxStringLength(maxLength int) func(string, *core.ScalarValue) []*core.Diagnostic
- func MinFloat(minValue float64) func(string, *core.ScalarValue) []*core.Diagnostic
- func MinInt(minValue int) func(string, *core.ScalarValue) []*core.Diagnostic
- func MinStringLength(minLength int) func(string, *core.ScalarValue) []*core.Diagnostic
- func OneOf(validators ...func(string, *core.ScalarValue) []*core.Diagnostic) func(string, *core.ScalarValue) []*core.Diagnostic
- func StringDoesNotContainChars(disallowedChars string) func(string, *core.ScalarValue) []*core.Diagnostic
- func StringDoesNotMatchPattern(patternRegexp *regexp.Regexp) func(string, *core.ScalarValue) []*core.Diagnostic
- func StringInList(allowedValues []string, ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
- func StringIsBase64() func(string, *core.ScalarValue) []*core.Diagnostic
- func StringIsJSON() func(string, *core.ScalarValue) []*core.Diagnostic
- func StringLengthRange(minLength int, maxLength int) func(string, *core.ScalarValue) []*core.Diagnostic
- func StringMatchesPattern(patternRegexp *regexp.Regexp) func(string, *core.ScalarValue) []*core.Diagnostic
- func StringNotInList(disallowedValues []string, ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
- func WrapForPluginConfig(validationFunc func(string, *core.ScalarValue) []*core.Diagnostic) func(string, *core.ScalarValue, core.PluginConfig) []*core.Diagnostic
- func WrapForResourceDefinition(validationFunc func(string, *core.ScalarValue) []*core.Diagnostic) func(string, *core.MappingNode, *schema.Resource) []*core.Diagnostic
- type ConflictOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllOf ¶
func AllOf( validators ...func(string, *core.ScalarValue) []*core.Diagnostic, ) func(string, *core.ScalarValue) []*core.Diagnostic
AllOf validates that a value passes all provided validation functions, if there is at least one error returned in the given diagnostics, validation will fail.
func ConflictsWithPluginConfig ¶
func ConflictsWithPluginConfig( conflictsWithKey string, conflictOptions *ConflictOptions, ) func(string, *core.ScalarValue, core.PluginConfig) []*core.Diagnostic
ConflictsWithPluginConfig returns a validation function that checks if a given field conflicts with a specified plugin configuration key.
func ConflictsWithResourceDefinition ¶
func ConflictsWithResourceDefinition( conflictsWithFieldPath string, conflictOptions *ConflictOptions, ) func(string, *core.MappingNode, *schema.Resource) []*core.Diagnostic
ConflictsWithResourceDefinition returns a validation function that checks if a given field conflicts with a specified resource spec field path. The path notation used in the blueprint framework's `core.GetPathValue` package should be used to specify the path to the conflicting field, such as $[\"cluster.v1\"].config.endpoints[0], where "$" is the root of the resource `spec` field.
func FloatRange ¶
func FloatRange( minValue float64, maxValue float64, ) func(string, *core.ScalarValue) []*core.Diagnostic
FloatRange validates that a float value is within a specified range.
func IntRange ¶
func IntRange( minValue int, maxValue int, ) func(string, *core.ScalarValue) []*core.Diagnostic
IntRange validates that an integer value is within a specified range.
func IsCIDR ¶
func IsCIDR() func(string, *core.ScalarValue) []*core.Diagnostic
IsCIDR validates that a string is in valid CIDR notation.
func IsCIDRNetwork ¶
func IsCIDRNetwork( minValue int, maxValue int, ) func(string, *core.ScalarValue) []*core.Diagnostic
IsCIDRNetwork validates that a string is in valid CIDR notation and has significant bits between minValue and maxValue (inclusive).
func IsDayOfTheWeek ¶
func IsDayOfTheWeek(ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
IsDayOfTheWeek validates that a string is a valid day of the week. The `ignoreCase` parameter determines whether the validation is case-insensitive.
func IsHTTPSURL ¶
func IsHTTPSURL() func(string, *core.ScalarValue) []*core.Diagnostic
IsHTTPSURL validates that a string is a valid HTTPS URL.
func IsHTTPURL ¶
func IsHTTPURL() func(string, *core.ScalarValue) []*core.Diagnostic
IsHTTPURL validates that a string is a valid HTTP URL.
func IsIPAddress ¶
func IsIPAddress() func(string, *core.ScalarValue) []*core.Diagnostic
IsIPAddress validates that a string is a valid IPv4 or IPv6 address.
func IsIPv4Address ¶
func IsIPv4Address() func(string, *core.ScalarValue) []*core.Diagnostic
IsIPv4Address validates that a string is a valid IPv4 address.
func IsIPv4Range ¶
func IsIPv4Range() func(string, *core.ScalarValue) []*core.Diagnostic
IsIPv4Range validates that a string is a valid IPv4 address range.
func IsIPv6Address ¶
func IsIPv6Address() func(string, *core.ScalarValue) []*core.Diagnostic
IsIPv6Address validates that a string is a valid IPv6 address.
func IsMACAddress ¶
func IsMACAddress() func(string, *core.ScalarValue) []*core.Diagnostic
IsMACAddress validates that a string is a valid MAC address.
func IsMonth ¶
func IsMonth(ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
IsMonth validates that a string is a valid month of the year. The `ignoreCase` parameter determines whether the validation is case-insensitive.
func IsPortNumber ¶
func IsPortNumber() func(string, *core.ScalarValue) []*core.Diagnostic
IsPortNumber validates that a string is a valid port number (0-65535).
func IsPortNumberOrZero ¶
func IsPortNumberOrZero() func(string, *core.ScalarValue) []*core.Diagnostic
IsPortNumberOrZero validates that a string is a valid port number (0-65535) or zero.
func IsRFC3339 ¶
func IsRFC3339() func(string, *core.ScalarValue) []*core.Diagnostic
IsRFC3339 validates that a string is a valid RFC3339 date-time format.
func IsShortMonth ¶
func IsShortMonth(ignoreCase bool) func(string, *core.ScalarValue) []*core.Diagnostic
IsShortMonth validates that a string is a valid short month of the year.
func IsURL ¶
func IsURL( allowedSchemes []string, ) func(string, *core.ScalarValue) []*core.Diagnostic
IsURL validates that a string is a valid URL with one of the allowed schemes.
func IsUUID ¶
func IsUUID() func(string, *core.ScalarValue) []*core.Diagnostic
IsUUID validates that a string is a valid UUID.
func IsWebURL ¶
func IsWebURL() func(string, *core.ScalarValue) []*core.Diagnostic
IsWebURL validates that a string is a valid HTTP or HTTPS URL.
func MaxFloat ¶
func MaxFloat( maxValue float64, ) func(string, *core.ScalarValue) []*core.Diagnostic
MaxFloat validates that a float value does not exceed a specified maximum value.
func MaxInt ¶
func MaxInt( maxValue int, ) func(string, *core.ScalarValue) []*core.Diagnostic
MaxInt validates that an integer value does not exceed a specified maximum value.
func MaxStringLength ¶
func MaxStringLength( maxLength int, ) func(string, *core.ScalarValue) []*core.Diagnostic
MaxStringLength validates that a string value does not exceed a specified maximum length. This counts characters, not bytes.
func MinFloat ¶
func MinFloat( minValue float64, ) func(string, *core.ScalarValue) []*core.Diagnostic
MinFloat validates that a float value is at least a specified minimum value.
func MinInt ¶
func MinInt( minValue int, ) func(string, *core.ScalarValue) []*core.Diagnostic
MinInt validates that an integer value is at least a specified minimum value.
func MinStringLength ¶
func MinStringLength( minLength int, ) func(string, *core.ScalarValue) []*core.Diagnostic
MinStringLength validates that a string value is at least a specified minimum length. This counts characters, not bytes.
func OneOf ¶
func OneOf( validators ...func(string, *core.ScalarValue) []*core.Diagnostic, ) func(string, *core.ScalarValue) []*core.Diagnostic
OneOf validates that a value passes for at least one of the provided validators.
func StringDoesNotContainChars ¶
func StringDoesNotContainChars( disallowedChars string, ) func(string, *core.ScalarValue) []*core.Diagnostic
StringDoesNotContainChars validates that a string value does not contain any of the specified unicode code points in the provided string.
func StringDoesNotMatchPattern ¶
func StringDoesNotMatchPattern( patternRegexp *regexp.Regexp, ) func(string, *core.ScalarValue) []*core.Diagnostic
StringDoesNotMatchPattern validates that a string value does not match a specified regular expression pattern.
func StringInList ¶
func StringInList( allowedValues []string, ignoreCase bool, ) func(string, *core.ScalarValue) []*core.Diagnostic
StringInList validates that a string value is one of the specified allowed values.
func StringIsBase64 ¶
func StringIsBase64() func(string, *core.ScalarValue) []*core.Diagnostic
StringIsBase64 validates that a string value is a valid Base64-encoded string.
func StringIsJSON ¶
func StringIsJSON() func(string, *core.ScalarValue) []*core.Diagnostic
StringIsJSON validates that a string value is valid JSON.
func StringLengthRange ¶
func StringLengthRange( minLength int, maxLength int, ) func(string, *core.ScalarValue) []*core.Diagnostic
StringLengthRange validates that a string value is within a specified length range. This counts characters, not bytes.
func StringMatchesPattern ¶
func StringMatchesPattern( patternRegexp *regexp.Regexp, ) func(string, *core.ScalarValue) []*core.Diagnostic
StringMatchesPattern validates that a string value matches a specified regular expression pattern.
func StringNotInList ¶
func StringNotInList( disallowedValues []string, ignoreCase bool, ) func(string, *core.ScalarValue) []*core.Diagnostic
StringNotInList validates that a string value is not one of the specified disallowed values.
func WrapForPluginConfig ¶
func WrapForPluginConfig( validationFunc func(string, *core.ScalarValue) []*core.Diagnostic, ) func(string, *core.ScalarValue, core.PluginConfig) []*core.Diagnostic
WrapForPluginConfig wraps a general validation function so it can be used with plugin config definition fields.
func WrapForResourceDefinition ¶
func WrapForResourceDefinition( validationFunc func(string, *core.ScalarValue) []*core.Diagnostic, ) func(string, *core.MappingNode, *schema.Resource) []*core.Diagnostic
WrapForResourceDefinition wraps a general validation function so it can be used with blueprint resource definition schema fields. The validation helpers package provides helpers for scalar values only, this should not be used with complex resource definition schema types such as arrays, objects, or mappings.
Types ¶
type ConflictOptions ¶
type ConflictOptions struct {
// ConflictsOnValue is the value in an another field that this field
// conflicts with.
ConflictsOnValue *core.ScalarValue
}
ConflictOptions defines additional options for field conflict validation.