Documentation ¶
Index ¶
- func AlsoRequiresOnBoolValues(onValues []bool, expressions ...path.Expression) validator.Bool
- func AlsoRequiresOnStringValues(onValues []string, expressions ...path.Expression) validator.String
- func AlsoRequiresOneOfOnBoolValues(onValues []bool, expressions ...path.Expression) validator.Bool
- func AlsoRequiresOneOfOnStringValues(onValues []string, expressions ...path.Expression) validator.String
- func ConflictsWithOnBoolValues(onValues []bool, expressions ...path.Expression) validator.Bool
- func ConflictsWithOnStringValues(onValues []string, expressions ...path.Expression) validator.String
- type AlsoRequiresOnValuesValidator
- func (v AlsoRequiresOnValuesValidator) Description(ctx context.Context) string
- func (v AlsoRequiresOnValuesValidator) MarkdownDescription(context.Context) string
- func (v AlsoRequiresOnValuesValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse)
- func (v AlsoRequiresOnValuesValidator) ValidateString(ctx context.Context, req validator.StringRequest, ...)
- type AlsoRequiresOneOfOnValuesValidator
- func (v AlsoRequiresOneOfOnValuesValidator) Description(ctx context.Context) string
- func (v AlsoRequiresOneOfOnValuesValidator) MarkdownDescription(context.Context) string
- func (v AlsoRequiresOneOfOnValuesValidator) Validate(ctx context.Context, req AlsoRequiresOneOfOnValuesValidatorRequest, ...)
- func (v AlsoRequiresOneOfOnValuesValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse)
- func (v AlsoRequiresOneOfOnValuesValidator) ValidateString(ctx context.Context, req validator.StringRequest, ...)
- type AlsoRequiresOneOfOnValuesValidatorRequest
- type AlsoRequiresOneOfOnValuesValidatorResponse
- type ConflictsWithOnValuesValidator
- func (v ConflictsWithOnValuesValidator) Description(ctx context.Context) string
- func (v ConflictsWithOnValuesValidator) MarkdownDescription(context.Context) string
- func (v ConflictsWithOnValuesValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse)
- func (v ConflictsWithOnValuesValidator) ValidateString(ctx context.Context, req validator.StringRequest, ...)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlsoRequiresOnBoolValues ¶ added in v1.0.0
func AlsoRequiresOnBoolValues(onValues []bool, expressions ...path.Expression) validator.Bool
Example ¶
// Used within a Schema method of a DataSource, Provider, or Resource _ = schema.Schema{ Attributes: map[string]schema.Attribute{ "example_bool_attr": schema.BoolAttribute{ Optional: true, Validators: []validator.Bool{ // Validate other_attr must be configured if this attribute is set to one of [true]. AlsoRequiresOnBoolValues( []bool{ true, }, path.Expressions{ path.MatchRoot("other_attr"), }...), }, }, "other_attr": schema.StringAttribute{ Optional: true, }, }, }
Output:
func AlsoRequiresOnStringValues ¶ added in v1.0.0
func AlsoRequiresOnStringValues(onValues []string, expressions ...path.Expression) validator.String
AlsoRequiresOnValues checks that a set of path.Expression has a non-null value, if the current attribute or block is set to one of the values defined in onValues array.
Relative path.Expression will be resolved using the attribute or block being validated.
Example ¶
// Used within a Schema method of a DataSource, Provider, or Resource _ = schema.Schema{ Attributes: map[string]schema.Attribute{ "example_string_attr": schema.StringAttribute{ Optional: true, Validators: []validator.String{ // Validate other_attr must be configured if this attribute is set to one of ["value1", "value2"]. AlsoRequiresOnStringValues( []string{ "value1", "value2", }, path.Expressions{ path.MatchRoot("other_attr"), }...), }, }, "other_attr": schema.StringAttribute{ Optional: true, }, }, }
Output:
func AlsoRequiresOneOfOnBoolValues ¶ added in v1.0.6
func AlsoRequiresOneOfOnBoolValues(onValues []bool, expressions ...path.Expression) validator.Bool
Example ¶
// Used within a Schema method of a DataSource, Provider, or Resource _ = schema.Schema{ Attributes: map[string]schema.Attribute{ "example_bool_attr": schema.BoolAttribute{ Optional: true, Validators: []validator.Bool{ // Validate exactly one of other_attr1 and other_attr2 must be configured if this attribute is set to one of [true]. AlsoRequiresOneOfOnBoolValues( []bool{ true, }, path.Expressions{ path.MatchRoot("other_attr1"), path.MatchRoot("other_attr2"), }...), }, }, "other_attr1": schema.StringAttribute{ Optional: true, }, "other_attr2": schema.StringAttribute{ Optional: true, }, }, }
Output:
func AlsoRequiresOneOfOnStringValues ¶ added in v1.0.6
func AlsoRequiresOneOfOnStringValues(onValues []string, expressions ...path.Expression) validator.String
AlsoRequiresOneOfOnValues checks that a set of path.Expression has a non-null value, if the current attribute or block is set to one of the values defined in onValues array.
Relative path.Expression will be resolved using the attribute or block being validated.
Example ¶
// Used within a Schema method of a DataSource, Provider, or Resource _ = schema.Schema{ Attributes: map[string]schema.Attribute{ "example_string_attr": schema.StringAttribute{ Optional: true, Validators: []validator.String{ // Validate exactly one of other_attr1 and other_attr2 must be configured if this attribute is set to one of ["value1", "value2"]. AlsoRequiresOneOfOnStringValues( []string{ "value1", "value2", }, path.Expressions{ path.MatchRoot("other_attr1"), path.MatchRoot("other_attr2"), }...), }, }, "other_attr1": schema.StringAttribute{ Optional: true, }, "other_attr2": schema.StringAttribute{ Optional: true, }, }, }
Output:
func ConflictsWithOnBoolValues ¶ added in v1.0.6
func ConflictsWithOnBoolValues(onValues []bool, expressions ...path.Expression) validator.Bool
Example ¶
// Used within a Schema method of a DataSource, Provider, or Resource _ = schema.Schema{ Attributes: map[string]schema.Attribute{ "example_bool_attr": schema.BoolAttribute{ Optional: true, Validators: []validator.Bool{ // Validate other_attr cannot be configured if this attribute is set to one of [true]. ConflictsWithOnBoolValues( []bool{ true, }, path.Expressions{ path.MatchRoot("other_attr"), }...), }, }, "other_attr": schema.StringAttribute{ Optional: true, }, }, }
Output:
func ConflictsWithOnStringValues ¶ added in v1.0.6
func ConflictsWithOnStringValues(onValues []string, expressions ...path.Expression) validator.String
ConflictsWithOnValues checks that a set of path.Expression has a non-null value, if the current attribute or block is set to one of the values defined in onValues array.
Relative path.Expression will be resolved using the attribute or block being validated.
Example ¶
// Used within a Schema method of a DataSource, Provider, or Resource _ = schema.Schema{ Attributes: map[string]schema.Attribute{ "example_string_attr": schema.StringAttribute{ Optional: true, Validators: []validator.String{ // Validate other_attr cannot be configured if this attribute is set to one of ["value1", "value2"]. ConflictsWithOnStringValues( []string{ "value1", "value2", }, path.Expressions{ path.MatchRoot("other_attr"), }...), }, }, "other_attr": schema.StringAttribute{ Optional: true, }, }, }
Output:
Types ¶
type AlsoRequiresOnValuesValidator ¶
type AlsoRequiresOnValuesValidator struct { OnStringValues []string OnBoolValues []bool PathExpressions path.Expressions }
AlsoRequiresOnValuesValidator is the underlying struct implementing AlsoRequiresOnValue.
func (AlsoRequiresOnValuesValidator) Description ¶
func (v AlsoRequiresOnValuesValidator) Description(ctx context.Context) string
Description implements validator.String.
func (AlsoRequiresOnValuesValidator) MarkdownDescription ¶
func (v AlsoRequiresOnValuesValidator) MarkdownDescription(context.Context) string
MarkdownDescription implements validator.String.
func (AlsoRequiresOnValuesValidator) ValidateBool ¶ added in v1.0.0
func (v AlsoRequiresOnValuesValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse)
ValidateBool implements validator.Bool.
func (AlsoRequiresOnValuesValidator) ValidateString ¶
func (v AlsoRequiresOnValuesValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString implements validator.String.
type AlsoRequiresOneOfOnValuesValidator ¶ added in v1.0.6
type AlsoRequiresOneOfOnValuesValidator struct { OnStringValues []string OnBoolValues []bool PathExpressions path.Expressions }
AlsoRequiresOneOfOnValuesValidator is the underlying struct implementing AlsoRequiresOnValue.
func (AlsoRequiresOneOfOnValuesValidator) Description ¶ added in v1.0.6
func (v AlsoRequiresOneOfOnValuesValidator) Description(ctx context.Context) string
Description implements validator.String.
func (AlsoRequiresOneOfOnValuesValidator) MarkdownDescription ¶ added in v1.0.6
func (v AlsoRequiresOneOfOnValuesValidator) MarkdownDescription(context.Context) string
MarkdownDescription implements validator.String.
func (AlsoRequiresOneOfOnValuesValidator) Validate ¶ added in v1.0.6
func (v AlsoRequiresOneOfOnValuesValidator) Validate(ctx context.Context, req AlsoRequiresOneOfOnValuesValidatorRequest, res *AlsoRequiresOneOfOnValuesValidatorResponse)
func (AlsoRequiresOneOfOnValuesValidator) ValidateBool ¶ added in v1.0.6
func (v AlsoRequiresOneOfOnValuesValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse)
ValidateBool implements validator.Bool.
func (AlsoRequiresOneOfOnValuesValidator) ValidateString ¶ added in v1.0.6
func (v AlsoRequiresOneOfOnValuesValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString implements validator.String.
type AlsoRequiresOneOfOnValuesValidatorRequest ¶ added in v1.0.6
type AlsoRequiresOneOfOnValuesValidatorResponse ¶ added in v1.0.6
type AlsoRequiresOneOfOnValuesValidatorResponse struct {
Diagnostics diag.Diagnostics
}
type ConflictsWithOnValuesValidator ¶ added in v1.0.6
type ConflictsWithOnValuesValidator struct { OnStringValues []string OnBoolValues []bool PathExpressions path.Expressions }
ConflictsWithOnValuesValidator is the underlying struct implementing AlsoRequiresOnValue.
func (ConflictsWithOnValuesValidator) Description ¶ added in v1.0.6
func (v ConflictsWithOnValuesValidator) Description(ctx context.Context) string
Description implements validator.String.
func (ConflictsWithOnValuesValidator) MarkdownDescription ¶ added in v1.0.6
func (v ConflictsWithOnValuesValidator) MarkdownDescription(context.Context) string
MarkdownDescription implements validator.String.
func (ConflictsWithOnValuesValidator) ValidateBool ¶ added in v1.0.6
func (v ConflictsWithOnValuesValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse)
ValidateBool implements validator.Bool.
func (ConflictsWithOnValuesValidator) ValidateString ¶ added in v1.0.6
func (v ConflictsWithOnValuesValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString implements validator.String.