/
subnetwork_schema.go
executable file
·309 lines (307 loc) · 12.8 KB
/
subnetwork_schema.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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// Copyright 2024 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beta
import (
"github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
)
func DCLSubnetworkSchema() *dcl.Schema {
return &dcl.Schema{
Info: &dcl.Info{
Title: "Compute/Subnetwork",
Description: "The Compute Subnetwork resource",
StructName: "Subnetwork",
},
Paths: &dcl.Paths{
Get: &dcl.Path{
Description: "The function used to get information about a Subnetwork",
Parameters: []dcl.PathParameters{
dcl.PathParameters{
Name: "subnetwork",
Required: true,
Description: "A full instance of a Subnetwork",
},
},
},
Apply: &dcl.Path{
Description: "The function used to apply information about a Subnetwork",
Parameters: []dcl.PathParameters{
dcl.PathParameters{
Name: "subnetwork",
Required: true,
Description: "A full instance of a Subnetwork",
},
},
},
Delete: &dcl.Path{
Description: "The function used to delete a Subnetwork",
Parameters: []dcl.PathParameters{
dcl.PathParameters{
Name: "subnetwork",
Required: true,
Description: "A full instance of a Subnetwork",
},
},
},
DeleteAll: &dcl.Path{
Description: "The function used to delete all Subnetwork",
Parameters: []dcl.PathParameters{
dcl.PathParameters{
Name: "project",
Required: true,
Schema: &dcl.PathParametersSchema{
Type: "string",
},
},
dcl.PathParameters{
Name: "region",
Required: true,
Schema: &dcl.PathParametersSchema{
Type: "string",
},
},
},
},
List: &dcl.Path{
Description: "The function used to list information about many Subnetwork",
Parameters: []dcl.PathParameters{
dcl.PathParameters{
Name: "project",
Required: true,
Schema: &dcl.PathParametersSchema{
Type: "string",
},
},
dcl.PathParameters{
Name: "region",
Required: true,
Schema: &dcl.PathParametersSchema{
Type: "string",
},
},
},
},
},
Components: &dcl.Components{
Schemas: map[string]*dcl.Component{
"Subnetwork": &dcl.Component{
Title: "Subnetwork",
ID: "projects/{{project}}/regions/{{region}}/subnetworks/{{name}}",
Locations: []string{
"region",
},
ParentContainer: "project",
HasCreate: true,
SchemaProperty: dcl.Property{
Type: "object",
Required: []string{
"ipCidrRange",
"name",
"network",
"region",
"project",
},
Properties: map[string]*dcl.Property{
"creationTimestamp": &dcl.Property{
Type: "string",
Format: "date-time",
GoName: "CreationTimestamp",
ReadOnly: true,
Description: "Creation timestamp in RFC3339 text format.",
Immutable: true,
},
"description": &dcl.Property{
Type: "string",
GoName: "Description",
Description: "An optional description of this resource. Provide this property when you create the resource. This field can be set only at resource creation time. ",
Immutable: true,
},
"enableFlowLogs": &dcl.Property{
Type: "boolean",
GoName: "EnableFlowLogs",
Description: "Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in `get` listings. If not set the default behavior is to disable flow logging. This field isn't supported with the `purpose` field set to `INTERNAL_HTTPS_LOAD_BALANCER`.",
Immutable: true,
ServerDefault: true,
},
"fingerprint": &dcl.Property{
Type: "string",
GoName: "Fingerprint",
ReadOnly: true,
Description: "Fingerprint of this resource. This field is used internally during updates of this resource. ",
Immutable: true,
},
"gatewayAddress": &dcl.Property{
Type: "string",
GoName: "GatewayAddress",
ReadOnly: true,
Description: "The gateway address for default routes to reach destination addresses outside this subnetwork. ",
Immutable: true,
},
"ipCidrRange": &dcl.Property{
Type: "string",
GoName: "IPCidrRange",
Description: "The range of internal addresses that are owned by this subnetwork. Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only IPv4 is supported. ",
},
"logConfig": &dcl.Property{
Type: "object",
GoName: "LogConfig",
GoType: "SubnetworkLogConfig",
Description: "Denotes the logging options for the subnetwork flow logs. If logging is enabled logs will be exported to Cloud Logging. ",
Properties: map[string]*dcl.Property{
"aggregationInterval": &dcl.Property{
Type: "string",
GoName: "AggregationInterval",
GoType: "SubnetworkLogConfigAggregationIntervalEnum",
Description: "Can only be specified if VPC flow logging for this subnetwork is enabled. Toggles the aggregation interval for collecting flow logs. Increasing the interval time will reduce the amount of generated flow logs for long lasting connections. Default is an interval of 5 seconds per connection. Possible values are INTERVAL_5_SEC, INTERVAL_30_SEC, INTERVAL_1_MIN, INTERVAL_5_MIN, INTERVAL_10_MIN, INTERVAL_15_MIN ",
Default: "INTERVAL_5_SEC",
Enum: []string{
"INTERVAL_5_SEC",
"INTERVAL_30_SEC",
"INTERVAL_1_MIN",
"INTERVAL_5_MIN",
"INTERVAL_10_MIN",
"INTERVAL_15_MIN",
},
},
"flowSampling": &dcl.Property{
Type: "number",
Format: "double",
GoName: "FlowSampling",
Description: "Can only be specified if VPC flow logging for this subnetwork is enabled. The value of the field must be in [0, 1]. Set the sampling rate of VPC flow logs within the subnetwork where 1.0 means all collected logs are reported and 0.0 means no logs are reported. Default is 0.5 which means half of all collected logs are reported. ",
Default: 0.5,
},
"metadata": &dcl.Property{
Type: "string",
GoName: "Metadata",
GoType: "SubnetworkLogConfigMetadataEnum",
Description: "Can only be specified if VPC flow logging for this subnetwork is enabled. Configures whether metadata fields should be added to the reported VPC flow logs. Default is `INCLUDE_ALL_METADATA`. Possible values: EXCLUDE_ALL_METADATA, INCLUDE_ALL_METADATA",
Default: "INCLUDE_ALL_METADATA",
Enum: []string{
"EXCLUDE_ALL_METADATA",
"INCLUDE_ALL_METADATA",
},
},
},
},
"name": &dcl.Property{
Type: "string",
GoName: "Name",
Description: "The name of the resource, provided by the client when initially creating the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. ",
Immutable: true,
},
"network": &dcl.Property{
Type: "string",
GoName: "Network",
Description: "The network this subnet belongs to. Only networks that are in the distributed mode can have subnetworks. ",
Immutable: true,
ResourceReferences: []*dcl.PropertyResourceReference{
&dcl.PropertyResourceReference{
Resource: "Compute/Network",
Field: "selfLink",
},
},
},
"privateIPGoogleAccess": &dcl.Property{
Type: "boolean",
GoName: "PrivateIPGoogleAccess",
Description: "When enabled, VMs in this subnetwork without external IP addresses can access Google APIs and services by using Private Google Access. ",
},
"project": &dcl.Property{
Type: "string",
GoName: "Project",
Description: "The project id of the resource.",
Immutable: true,
ResourceReferences: []*dcl.PropertyResourceReference{
&dcl.PropertyResourceReference{
Resource: "Cloudresourcemanager/Project",
Field: "name",
Parent: true,
},
},
Parameter: true,
},
"purpose": &dcl.Property{
Type: "string",
GoName: "Purpose",
GoType: "SubnetworkPurposeEnum",
Description: "The purpose of the resource. This field can be either PRIVATE or INTERNAL_HTTPS_LOAD_BALANCER. A subnetwork with purpose set to INTERNAL_HTTPS_LOAD_BALANCER is a user-created subnetwork that is reserved for Internal HTTP(S) Load Balancing. If unspecified, the purpose defaults to PRIVATE. If set to INTERNAL_HTTPS_LOAD_BALANCER you must also set the role. ",
Immutable: true,
ServerDefault: true,
Enum: []string{
"INTERNAL_HTTPS_LOAD_BALANCER",
"PRIVATE",
"AGGREGATE",
"PRIVATE_SERVICE_CONNECT",
"CLOUD_EXTENSION",
"PRIVATE_NAT",
},
},
"region": &dcl.Property{
Type: "string",
GoName: "Region",
Description: "The GCP region for this subnetwork. ",
Immutable: true,
Parameter: true,
},
"role": &dcl.Property{
Type: "string",
GoName: "Role",
GoType: "SubnetworkRoleEnum",
Description: "The role of subnetwork. Currenly, this field is only used when purpose = INTERNAL_HTTPS_LOAD_BALANCER. The value can be set to ACTIVE or BACKUP. An ACTIVE subnetwork is one that is currently being used for Internal HTTP(S) Load Balancing. A BACKUP subnetwork is one that is ready to be promoted to ACTIVE or is currently draining. ",
Enum: []string{
"ACTIVE",
"BACKUP",
},
},
"secondaryIPRanges": &dcl.Property{
Type: "array",
GoName: "SecondaryIPRanges",
Description: "An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange of the subnetwork. The alias IPs may belong to either primary or secondary ranges. This field uses attr-as-block mode to avoid breaking users during the 0.12 upgrade. See [the Attr-as-Block page](https://www.terraform.io/docs/configuration/attr-as-blocks.html) for more details. ",
ServerDefault: true,
SendEmpty: true,
ListType: "list",
Items: &dcl.Property{
Type: "object",
GoType: "SubnetworkSecondaryIPRanges",
Required: []string{
"rangeName",
"ipCidrRange",
},
Properties: map[string]*dcl.Property{
"ipCidrRange": &dcl.Property{
Type: "string",
GoName: "IPCidrRange",
Description: "The range of IP addresses belonging to this subnetwork secondary range. Provide this property when you create the subnetwork. Ranges must be unique and non-overlapping with all primary and secondary IP ranges within a network. Only IPv4 is supported. ",
},
"rangeName": &dcl.Property{
Type: "string",
GoName: "RangeName",
Description: "The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance. The name must be 1-63 characters long, and comply with RFC1035. The name must be unique within the subnetwork. ",
},
},
},
},
"selfLink": &dcl.Property{
Type: "string",
GoName: "SelfLink",
ReadOnly: true,
Description: "[Output Only] Server-defined URL for the resource.",
Immutable: true,
},
},
},
},
},
},
}
}