/
expression_step_attribute_name_exact.go
46 lines (35 loc) · 1.39 KB
/
expression_step_attribute_name_exact.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package path
// Ensure ExpressionStepAttributeNameExact satisfies the ExpressionStep
// interface.
var _ ExpressionStep = ExpressionStepAttributeNameExact("")
// ExpressionStepAttributeNameExact is an attribute path expression for an
// exact attribute name match within an object.
type ExpressionStepAttributeNameExact string
// Equal returns true if the given ExpressionStep is a
// ExpressionStepAttributeNameExact and the attribute name is equivalent.
func (s ExpressionStepAttributeNameExact) Equal(o ExpressionStep) bool {
other, ok := o.(ExpressionStepAttributeNameExact)
if !ok {
return false
}
return string(s) == string(other)
}
// Matches returns true if the given PathStep is fulfilled by the
// ExpressionStepAttributeNameExact condition.
func (s ExpressionStepAttributeNameExact) Matches(pathStep PathStep) bool {
pathStepAttributeName, ok := pathStep.(PathStepAttributeName)
if !ok {
return false
}
return string(s) == string(pathStepAttributeName)
}
// String returns the human-readable representation of the attribute name
// expression. It is intended for logging and error messages and is not
// protected by compatibility guarantees.
func (s ExpressionStepAttributeNameExact) String() string {
return string(s)
}
// unexported satisfies the Step interface.
func (s ExpressionStepAttributeNameExact) unexported() {}