validators

package
v0.11.18 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64ConditionalRequirement

func Int64ConditionalRequirement(dependentPath path.Path, allowedValues []string) validator.Int64

func Int64ConditionalRequirementSingle

func Int64ConditionalRequirementSingle(dependentPath path.Path, requiredValue string) validator.Int64

Int64ConditionalRequirementSingle is a convenience function for when there's only one allowed value.

func IsUUID

func IsUUID() validator.String

func StringConditionalRequirement

func StringConditionalRequirement(dependentPath path.Path, allowedValues []string) validator.String

StringConditionalRequirement returns a validator which ensures that a string attribute can only be set if another attribute at the specified path equals one of the specified values.

The dependentPath parameter should use path.Root() to specify the attribute path. For example: path.Root("auth_type")

Example usage:

"connection_type": schema.StringAttribute{
	Optional: true,
	Validators: []validator.String{
		validators.StringConditionalRequirement(
			path.Root("auth_type"),
			[]string{"none"},
			"connection_type can only be set when auth_type is 'none'",
		),
	},
},

func StringConditionalRequirementSingle

func StringConditionalRequirementSingle(dependentPath path.Path, requiredValue string) validator.String

StringConditionalRequirementSingle is a convenience function for when there's only one allowed value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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