-
Notifications
You must be signed in to change notification settings - Fork 10
/
conflicts_with.go
27 lines (24 loc) · 973 Bytes
/
conflicts_with.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package boolvalidator
import (
"github.com/hashicorp/terraform-plugin-framework-validators/internal/schemavalidator"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
)
// ConflictsWith checks that a set of path.Expression,
// including the attribute the validator is applied to,
// do not have a value simultaneously.
//
// This implements the validation logic declaratively within the schema.
// Refer to [datasourcevalidator.Conflicting],
// [providervalidator.Conflicting], or [resourcevalidator.Conflicting]
// for declaring this type of validation outside the schema definition.
//
// Relative path.Expression will be resolved using the attribute being
// validated.
func ConflictsWith(expressions ...path.Expression) validator.Bool {
return schemavalidator.ConflictsWithValidator{
PathExpressions: expressions,
}
}