-
Notifications
You must be signed in to change notification settings - Fork 265
/
block_type.go
126 lines (117 loc) · 2.96 KB
/
block_type.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package modconfig
import "github.com/turbot/go-kit/helpers"
// NOTE: when adding a block type, be sure to update QueryProviderBlocks/ReferenceBlocks/AllBlockTypes as needed
const (
BlockTypeMod = "mod"
BlockTypeQuery = "query"
BlockTypeControl = "control"
BlockTypeBenchmark = "benchmark"
BlockTypeDashboard = "dashboard"
BlockTypeContainer = "container"
BlockTypeChart = "chart"
BlockTypeCard = "card"
BlockTypeFlow = "flow"
BlockTypeGraph = "graph"
BlockTypeHierarchy = "hierarchy"
BlockTypeImage = "image"
BlockTypeInput = "input"
BlockTypeTable = "table"
BlockTypeText = "text"
BlockTypeLocals = "locals"
BlockTypeVariable = "variable"
BlockTypeParam = "param"
BlockTypeRequire = "require"
BlockTypeNode = "node"
BlockTypeEdge = "edge"
BlockTypeLegacyRequires = "requires"
BlockTypeCategory = "category"
BlockTypeWith = "with"
// config blocks
BlockTypeConnection = "connection"
BlockTypeOptions = "options"
BlockTypeWorkspaceProfile = "workspace"
ResourceTypeSnapshot = "snapshot"
AttributeArgs = "args"
AttributeQuery = "query"
)
// QueryProviderBlocks is a list of block types which implement QueryProvider
var QueryProviderBlocks = []string{
BlockTypeCard,
BlockTypeChart,
BlockTypeControl,
BlockTypeEdge,
BlockTypeFlow,
BlockTypeGraph,
BlockTypeHierarchy,
BlockTypeImage,
BlockTypeInput,
BlockTypeQuery,
BlockTypeNode,
BlockTypeTable,
BlockTypeWith,
}
// NodeAndEdgeProviderBlocks is a list of block types which implementnodeAndEdgeProvider
var NodeAndEdgeProviderBlocks = []string{
BlockTypeHierarchy,
BlockTypeFlow,
BlockTypeGraph,
}
// ReferenceBlocks is a list of block types we store references for
var ReferenceBlocks = []string{
BlockTypeMod,
BlockTypeQuery,
BlockTypeControl,
BlockTypeBenchmark,
BlockTypeDashboard,
BlockTypeContainer,
BlockTypeCard,
BlockTypeChart,
BlockTypeFlow,
BlockTypeGraph,
BlockTypeHierarchy,
BlockTypeImage,
BlockTypeInput,
BlockTypeTable,
BlockTypeText,
BlockTypeParam,
BlockTypeCategory,
BlockTypeWith,
}
var ValidResourceItemTypes = []string{
BlockTypeMod,
BlockTypeQuery,
BlockTypeControl,
BlockTypeBenchmark,
BlockTypeDashboard,
BlockTypeContainer,
BlockTypeChart,
BlockTypeCard,
BlockTypeFlow,
BlockTypeGraph,
BlockTypeHierarchy,
BlockTypeImage,
BlockTypeInput,
BlockTypeTable,
BlockTypeText,
BlockTypeLocals,
BlockTypeVariable,
BlockTypeParam,
BlockTypeRequire,
BlockTypeNode,
BlockTypeEdge,
BlockTypeLegacyRequires,
BlockTypeCategory,
BlockTypeConnection,
BlockTypeOptions,
BlockTypeWorkspaceProfile,
BlockTypeWith,
// local is not an actual block name but is a resource type
"local",
// references
"ref",
// variables
"var",
}
func IsValidResourceItemType(blockType string) bool {
return helpers.StringSliceContains(ValidResourceItemTypes, blockType)
}