-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec_schema.json
246 lines (245 loc) · 8.04 KB
/
spec_schema.json
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
{
"title": "Spec",
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "https://github.com/np-guard/vpc-network-synthesis/v0.1",
"$defs": {
"any-protocol": {
"type": "object",
"properties": {
"protocol": {
"description": "Necessarily ANY",
"enum": [
"ANY"
]
}
},
"required": [
"protocol"
],
"additionalProperties": false
},
"tcp-udp": {
"type": "object",
"properties": {
"protocol": {
"description": "Is it TCP or UDP",
"enum": [
"TCP",
"UDP"
]
},
"min_destination_port": {
"description": "Minimal destination port; default is 1",
"type": "integer",
"minimum": 1,
"maximum": 65535,
"default": 1
},
"max_destination_port": {
"description": "Maximal destination port; default is 65535",
"type": "integer",
"minimum": 1,
"maximum": 65535,
"default": 65535
},
"min_source_port": {
"description": "Minimal source port; default is 1. Unsupported in vpc synthesis",
"type": "integer",
"minimum": 1,
"maximum": 65535,
"default": 1
},
"max_source_port": {
"description": "Maximal source port; default is 65535. Unsupported in vpc synthesis",
"type": "integer",
"minimum": 1,
"maximum": 65535,
"default": 65535
}
},
"required": [
"protocol"
],
"additionalProperties": false
},
"icmp": {
"type": "object",
"properties": {
"protocol": {
"description": "Necessarily ICMP",
"enum": [
"ICMP"
]
},
"type": {
"description": "ICMP type allowed. If omitted, any type is allowed",
"type": "integer",
"minimum": 0,
"maximum": 16
},
"code": {
"description": "ICMP code allowed. If omitted, any code is allowed",
"type": "integer",
"minimum": 0,
"maximum": 5
}
},
"required": [
"protocol"
],
"additionalProperties": false
},
"protocol": {
"oneOf": [
{
"$ref": "#/$defs/tcp-udp"
},
{
"$ref": "#/$defs/icmp"
},
{
"$ref": "#/$defs/any-protocol"
}
]
},
"protocol-list": {
"type": "array",
"items": {
"$ref": "#/$defs/protocol"
}
},
"segment": {
"description": "A segment is a named collection of resources of the same type (subnet, cidr, instance, or nif)",
"type": "object",
"additionalProperties": false,
"required": [
"type",
"items"
],
"properties": {
"type": {
"description": "The type of the elements inside the segment",
"enum": [
"subnet",
"cidr",
"instance",
"nif",
"vpe"
]
},
"items": {
"description": "All items are of the type specified in the type property, identified by name",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"resource": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "Name of resource",
"type": "string"
},
"type": {
"description": "Type of resource",
"enum": [
"external",
"segment",
"subnet",
"instance",
"nif",
"cidr",
"vpe"
]
}
},
"required": [
"name",
"type"
]
}
},
"type": "object",
"additionalProperties": false,
"properties": {
"segments": {
"description": "Segments are a way for users to create aggregations. These can later be used in src/dst fields",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/segment"
}
},
"subnets": {
"type": "object",
"description": "Lightweight way to define subnets.",
"additionalProperties": {
"type": "string",
"pattern": "^\\d{1,3}(\\.\\d{1,3}){3}/([1-2]?[0-9]|3[0-2])$"
}
},
"nifs": {
"type": "object",
"description": "Lightweight way to define network interfaces.",
"additionalProperties": {
"type": "string",
"pattern": "^\\d{1,3}(\\.\\d{1,3}){3}$"
}
},
"instances": {
"type": "object",
"description": "Lightweight way to define instance as a list of interfaces.",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"externals": {
"type": "object",
"description": "Externals are a way for users to name CIDRs external to the VPC. These are later used in src/dst definitions",
"additionalProperties": {
"type": "string",
"pattern": "^\\d{1,3}(\\.\\d{1,3}){3}(/([1-2]?[0-9]|3[0-2]))?$"
}
},
"required-connections": {
"type": "array",
"description": "A list of required connections",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"src",
"dst"
],
"properties": {
"src": {
"description": "In unidirectional connection, this is the egress resource",
"$ref": "#/$defs/resource"
},
"dst": {
"description": "In unidirectional connection, this is the ingress resource",
"$ref": "#/$defs/resource"
},
"bidirectional": {
"description": "If true, allow both connections from src to dst and connections from dst to src",
"type": "boolean",
"default": false
},
"allowed-protocols": {
"description": "List of allowed protocols",
"$ref": "#/$defs/protocol-list"
}
}
}
}
},
"required": [
"required-connections"
]
}