/
attributes.go
42 lines (36 loc) · 1.09 KB
/
attributes.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
package actions
import (
"github.com/hashicorp/hcl/v2"
)
const (
// ArgDesc contains the name of the argument used in the plugins block.
ArgDesc = "description"
// ArgWhen contains the name of the argument used in the plugins block.
ArgWhen = "when"
// ArgWhile contains the name of the argument used in the plugins block.
ArgWhile = "while"
// ArgCount contains the name of the argument used in the plugins block.
ArgCount = "count"
// ArgItems contains the name of the slice to be iterated over.
ArgItems = "items"
)
// BaseArguments contain the list of common attributes.
var BaseArguments = []hcl.AttributeSchema{
{Name: ArgDesc, Required: false},
{Name: ArgWhen, Required: false},
{Name: ArgWhile, Required: false},
{Name: ArgCount, Required: false},
{Name: ArgItems, Required: false},
}
var baseArgumentsNames = map[string]struct{}{
ArgDesc: {},
ArgWhen: {},
ArgWhile: {},
ArgCount: {},
ArgItems: {},
}
// IsPluginBaseArgument returns true if the name is common for all the plugins.
func IsPluginBaseArgument(name string) bool {
_, ok := baseArgumentsNames[name]
return ok
}