Documentation
¶
Index ¶
- func ASCIIOnly() validator.String
- func BlockRequiresSetValue(setFieldName, requiredValue, blockFieldName string) validator.Object
- func BoolCanOnlyBeFalseWhen(dependentField string, dependentValue bool, validationMessage string) validator.Bool
- func BoolCanOnlyBeTrueWhen(dependentField string, dependentValue bool, validationMessage string) validator.Bool
- func ConditionalBoolValue(dependentField string, dependentValue bool, allowedValue bool, ...) validator.Bool
- func ExactlyOneOf(attributeNames ...string) validator.Object
- func FutureDateTime() validator.String
- func IllegalCharactersInString(forbiddenChars []rune, description string) validator.String
- func JSONSchemaValidator() validator.String
- func MutuallyExclusiveObjectAndSet(objectFieldName, setFieldName string) validator.String
- func ODataParameterValidator(odataFieldNames ...string) validator.String
- func RegexMatches(regexp *regexp.Regexp, message string) validator.String
- func RequiredOneOfWhen(dependentField string, triggerValue string, allowedValues ...string) validator.String
- func RequiredWhenEquals(dependentField string, requiredValue types.String) validator.String
- func RequiredWhenSetContains(setFieldName, requiredValue string) validator.String
- func RequiredWith(fieldName string, fieldValue string) validator.String
- func RolloutDateTime(minDaysFromNow, maxDaysFromNow int) validator.String
- func SetRequiresBoolValue(boolFieldName string, requiredBoolValue bool, validationMessage string) validator.Set
- func StringLengthAtMost(maxLength int) validator.String
- func StringListAllowedValues(values ...string) validator.List
- func StringSetAllowedValues(allowedValues ...string) validator.Set
- type MutuallyExclusiveAttributesValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ASCIIOnly ¶
ASCIIOnly returns a string validator which ensures that the string contains only ASCII characters (0-127).
func BlockRequiresSetValue ¶
BlockRequiresSetValue returns an Object validator which ensures that a block can only be specified when a specific value exists in a sibling set field.
func BoolCanOnlyBeFalseWhen ¶
func BoolCanOnlyBeFalseWhen(dependentField string, dependentValue bool, validationMessage string) validator.Bool
BoolCanOnlyBeFalseWhen returns a boolean validator which ensures that the current field can only be false when the dependent field has the specified value.
func BoolCanOnlyBeTrueWhen ¶
func BoolCanOnlyBeTrueWhen(dependentField string, dependentValue bool, validationMessage string) validator.Bool
BoolCanOnlyBeTrueWhen returns a boolean validator which ensures that the current field can only be true when the dependent field has the specified value.
func ConditionalBoolValue ¶
func ConditionalBoolValue(dependentField string, dependentValue bool, allowedValue bool, validationMessage string) validator.Bool
ConditionalBoolValue returns a boolean validator which ensures that when a dependent field has a specific boolean value, the current field can only have a specific value.
func ExactlyOneOf ¶
ExactlyOneOf returns a validator that ensures exactly one of the specified attributes is set. This validator works on nested attributes within a block.
func FutureDateTime ¶
FutureDateTime returns a string validator which ensures that the datetime string is in the future relative to the current UTC time (at least 1 day).
func IllegalCharactersInString ¶
IllegalCharactersInString returns a string validator which ensures that the string does not contain any of the specified forbidden characters.
func JSONSchemaValidator ¶
JSONSchemaValidator returns a validator which ensures that a string attribute is a valid JSON and doesn't exceed the maximum allowed nesting depth
func MutuallyExclusiveObjectAndSet ¶
MutuallyExclusiveObjectAndSet returns a string validator which ensures that an Object attribute and a Set attribute cannot both be configured in the same policy.
func ODataParameterValidator ¶
ODataParameterValidator returns a string validator which ensures that OData parameters are only used with filter_type = "odata" and that at least one OData parameter is provided when filter_type = "odata".
func RegexMatches ¶
RegexMatches returns a validator.String that ensures any configured value matches the provided regular expression pattern. Null and unknown values are skipped. An optional message can be provided to customize the error output.
func RequiredOneOfWhen ¶
func RequiredOneOfWhen(dependentField string, triggerValue string, allowedValues ...string) validator.String
RequiredOneOfWhen returns a string validator which ensures that when a dependent field has a specific value, the current field must be one of the allowed values.
func RequiredWhenEquals ¶
RequiredWhenEquals is a factory function that returns a new requiredWhenEqualsValidator. It validates that the attribute is not null or empty when another field in the same object has a specific string value.
func RequiredWhenSetContains ¶
RequiredWhenSetContains returns a string validator which ensures that the field is required when a sibling set field contains a specific value.
func RequiredWith ¶
RequiredWith returns a string validator which ensures that the field is set when another field matches a specific value.
func RolloutDateTime ¶
RolloutDateTime returns a string validator which ensures that the datetime string is within the specified rollout window (minimum and maximum days from current UTC time).
func SetRequiresBoolValue ¶
func SetRequiresBoolValue(boolFieldName string, requiredBoolValue bool, validationMessage string) validator.Set
SetRequiresBoolValue returns a Set validator which ensures that a set can only have elements when a boolean field has a specific value.
func StringLengthAtMost ¶
StringLengthAtMost returns a string validator which ensures that the string does not exceed the specified maximum length.
func StringListAllowedValues ¶
StringListAllowedValues returns a validator that ensures each string in a list matches one of the allowed values.
func StringSetAllowedValues ¶
StringSetAllowedValues returns a Set validator which ensures that any configured string set value matches one of the allowed values exactly.
Types ¶
type MutuallyExclusiveAttributesValidator ¶
type MutuallyExclusiveAttributesValidator struct {
AttributeNames []string
}
MutuallyExclusiveAttributesValidator checks if only one of the specified attributes is set
func (MutuallyExclusiveAttributesValidator) Description ¶
func (v MutuallyExclusiveAttributesValidator) Description(ctx context.Context) string
Description returns the validator's description.
func (MutuallyExclusiveAttributesValidator) MarkdownDescription ¶
func (v MutuallyExclusiveAttributesValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription returns the validator's description in Markdown format.
func (MutuallyExclusiveAttributesValidator) ValidateObject ¶
func (v MutuallyExclusiveAttributesValidator) ValidateObject(ctx context.Context, req validator.ObjectRequest, resp *validator.ObjectResponse)
ValidateObject implements validator logic