@scaleway/sdk-vpcgw 1.2.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const GATEWAY_NETWORK_TRANSIENT_STATUSES = [
4
- "attaching",
5
- "configuring",
6
- "detaching"
7
- ];
8
- const GATEWAY_TRANSIENT_STATUSES = [
9
- "allocating",
10
- "configuring",
11
- "stopping",
12
- "deleting"
13
- ];
14
- exports.GATEWAY_NETWORK_TRANSIENT_STATUSES = GATEWAY_NETWORK_TRANSIENT_STATUSES;
15
- exports.GATEWAY_TRANSIENT_STATUSES = GATEWAY_TRANSIENT_STATUSES;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api_gen = require("./api.gen.cjs");
4
- const content_gen = require("./content.gen.cjs");
5
- const marshalling_gen = require("./marshalling.gen.cjs");
6
- exports.API = api_gen.API;
7
- exports.GATEWAY_NETWORK_TRANSIENT_STATUSES = content_gen.GATEWAY_NETWORK_TRANSIENT_STATUSES;
8
- exports.GATEWAY_TRANSIENT_STATUSES = content_gen.GATEWAY_TRANSIENT_STATUSES;
9
- exports.marshalCreateDHCPEntryRequest = marshalling_gen.marshalCreateDHCPEntryRequest;
10
- exports.marshalCreateDHCPRequest = marshalling_gen.marshalCreateDHCPRequest;
11
- exports.marshalCreateGatewayNetworkRequest = marshalling_gen.marshalCreateGatewayNetworkRequest;
12
- exports.marshalCreateGatewayRequest = marshalling_gen.marshalCreateGatewayRequest;
13
- exports.marshalCreateIPRequest = marshalling_gen.marshalCreateIPRequest;
14
- exports.marshalCreatePATRuleRequest = marshalling_gen.marshalCreatePATRuleRequest;
15
- exports.marshalSetDHCPEntriesRequest = marshalling_gen.marshalSetDHCPEntriesRequest;
16
- exports.marshalSetPATRulesRequest = marshalling_gen.marshalSetPATRulesRequest;
17
- exports.marshalUpdateDHCPEntryRequest = marshalling_gen.marshalUpdateDHCPEntryRequest;
18
- exports.marshalUpdateDHCPRequest = marshalling_gen.marshalUpdateDHCPRequest;
19
- exports.marshalUpdateGatewayNetworkRequest = marshalling_gen.marshalUpdateGatewayNetworkRequest;
20
- exports.marshalUpdateGatewayRequest = marshalling_gen.marshalUpdateGatewayRequest;
21
- exports.marshalUpdateIPRequest = marshalling_gen.marshalUpdateIPRequest;
22
- exports.marshalUpdatePATRuleRequest = marshalling_gen.marshalUpdatePATRuleRequest;
23
- exports.marshalUpgradeGatewayRequest = marshalling_gen.marshalUpgradeGatewayRequest;
24
- exports.unmarshalDHCP = marshalling_gen.unmarshalDHCP;
25
- exports.unmarshalDHCPEntry = marshalling_gen.unmarshalDHCPEntry;
26
- exports.unmarshalGateway = marshalling_gen.unmarshalGateway;
27
- exports.unmarshalGatewayNetwork = marshalling_gen.unmarshalGatewayNetwork;
28
- exports.unmarshalIP = marshalling_gen.unmarshalIP;
29
- exports.unmarshalListDHCPEntriesResponse = marshalling_gen.unmarshalListDHCPEntriesResponse;
30
- exports.unmarshalListDHCPsResponse = marshalling_gen.unmarshalListDHCPsResponse;
31
- exports.unmarshalListGatewayNetworksResponse = marshalling_gen.unmarshalListGatewayNetworksResponse;
32
- exports.unmarshalListGatewayTypesResponse = marshalling_gen.unmarshalListGatewayTypesResponse;
33
- exports.unmarshalListGatewaysResponse = marshalling_gen.unmarshalListGatewaysResponse;
34
- exports.unmarshalListIPsResponse = marshalling_gen.unmarshalListIPsResponse;
35
- exports.unmarshalListPATRulesResponse = marshalling_gen.unmarshalListPATRulesResponse;
36
- exports.unmarshalPATRule = marshalling_gen.unmarshalPATRule;
37
- exports.unmarshalSetDHCPEntriesResponse = marshalling_gen.unmarshalSetDHCPEntriesResponse;
38
- exports.unmarshalSetPATRulesResponse = marshalling_gen.unmarshalSetPATRulesResponse;
@@ -1,440 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const randomName = require("@scaleway/random-name");
4
- const sdkClient = require("@scaleway/sdk-client");
5
- const unmarshalDHCP = (data) => {
6
- if (!sdkClient.isJSONObject(data)) {
7
- throw new TypeError(
8
- `Unmarshalling the type 'DHCP' failed as data isn't a dictionary.`
9
- );
10
- }
11
- return {
12
- address: data.address,
13
- createdAt: sdkClient.unmarshalDate(data.created_at),
14
- dnsLocalName: data.dns_local_name,
15
- dnsSearch: data.dns_search,
16
- dnsServersOverride: data.dns_servers_override,
17
- enableDynamic: data.enable_dynamic,
18
- id: data.id,
19
- organizationId: data.organization_id,
20
- poolHigh: data.pool_high,
21
- poolLow: data.pool_low,
22
- projectId: data.project_id,
23
- pushDefaultRoute: data.push_default_route,
24
- pushDnsServer: data.push_dns_server,
25
- rebindTimer: data.rebind_timer,
26
- renewTimer: data.renew_timer,
27
- subnet: data.subnet,
28
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
29
- validLifetime: data.valid_lifetime,
30
- zone: data.zone
31
- };
32
- };
33
- const unmarshalIpamConfig = (data) => {
34
- if (!sdkClient.isJSONObject(data)) {
35
- throw new TypeError(
36
- `Unmarshalling the type 'IpamConfig' failed as data isn't a dictionary.`
37
- );
38
- }
39
- return {
40
- ipamIpId: data.ipam_ip_id,
41
- pushDefaultRoute: data.push_default_route
42
- };
43
- };
44
- const unmarshalGatewayNetwork = (data) => {
45
- if (!sdkClient.isJSONObject(data)) {
46
- throw new TypeError(
47
- `Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary.`
48
- );
49
- }
50
- return {
51
- address: data.address,
52
- createdAt: sdkClient.unmarshalDate(data.created_at),
53
- dhcp: data.dhcp ? unmarshalDHCP(data.dhcp) : void 0,
54
- enableDhcp: data.enable_dhcp,
55
- enableMasquerade: data.enable_masquerade,
56
- gatewayId: data.gateway_id,
57
- id: data.id,
58
- ipamConfig: data.ipam_config ? unmarshalIpamConfig(data.ipam_config) : void 0,
59
- macAddress: data.mac_address,
60
- privateNetworkId: data.private_network_id,
61
- status: data.status,
62
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
63
- zone: data.zone
64
- };
65
- };
66
- const unmarshalIP = (data) => {
67
- if (!sdkClient.isJSONObject(data)) {
68
- throw new TypeError(
69
- `Unmarshalling the type 'IP' failed as data isn't a dictionary.`
70
- );
71
- }
72
- return {
73
- address: data.address,
74
- createdAt: sdkClient.unmarshalDate(data.created_at),
75
- gatewayId: data.gateway_id,
76
- id: data.id,
77
- organizationId: data.organization_id,
78
- projectId: data.project_id,
79
- reverse: data.reverse,
80
- tags: data.tags,
81
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
82
- zone: data.zone
83
- };
84
- };
85
- const unmarshalDHCPEntry = (data) => {
86
- if (!sdkClient.isJSONObject(data)) {
87
- throw new TypeError(
88
- `Unmarshalling the type 'DHCPEntry' failed as data isn't a dictionary.`
89
- );
90
- }
91
- return {
92
- createdAt: sdkClient.unmarshalDate(data.created_at),
93
- gatewayNetworkId: data.gateway_network_id,
94
- hostname: data.hostname,
95
- id: data.id,
96
- ipAddress: data.ip_address,
97
- macAddress: data.mac_address,
98
- type: data.type,
99
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
100
- zone: data.zone
101
- };
102
- };
103
- const unmarshalGatewayType = (data) => {
104
- if (!sdkClient.isJSONObject(data)) {
105
- throw new TypeError(
106
- `Unmarshalling the type 'GatewayType' failed as data isn't a dictionary.`
107
- );
108
- }
109
- return {
110
- bandwidth: data.bandwidth,
111
- name: data.name,
112
- zone: data.zone
113
- };
114
- };
115
- const unmarshalGateway = (data) => {
116
- if (!sdkClient.isJSONObject(data)) {
117
- throw new TypeError(
118
- `Unmarshalling the type 'Gateway' failed as data isn't a dictionary.`
119
- );
120
- }
121
- return {
122
- bastionEnabled: data.bastion_enabled,
123
- bastionPort: data.bastion_port,
124
- canUpgradeTo: data.can_upgrade_to,
125
- createdAt: sdkClient.unmarshalDate(data.created_at),
126
- gatewayNetworks: sdkClient.unmarshalArrayOfObject(
127
- data.gateway_networks,
128
- unmarshalGatewayNetwork
129
- ),
130
- id: data.id,
131
- ip: data.ip ? unmarshalIP(data.ip) : void 0,
132
- ipMobilityEnabled: data.ip_mobility_enabled,
133
- isLegacy: data.is_legacy,
134
- name: data.name,
135
- organizationId: data.organization_id,
136
- projectId: data.project_id,
137
- smtpEnabled: data.smtp_enabled,
138
- status: data.status,
139
- tags: data.tags,
140
- type: data.type ? unmarshalGatewayType(data.type) : void 0,
141
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
142
- upstreamDnsServers: data.upstream_dns_servers,
143
- version: data.version,
144
- zone: data.zone
145
- };
146
- };
147
- const unmarshalPATRule = (data) => {
148
- if (!sdkClient.isJSONObject(data)) {
149
- throw new TypeError(
150
- `Unmarshalling the type 'PATRule' failed as data isn't a dictionary.`
151
- );
152
- }
153
- return {
154
- createdAt: sdkClient.unmarshalDate(data.created_at),
155
- gatewayId: data.gateway_id,
156
- id: data.id,
157
- privateIp: data.private_ip,
158
- privatePort: data.private_port,
159
- protocol: data.protocol,
160
- publicPort: data.public_port,
161
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
162
- zone: data.zone
163
- };
164
- };
165
- const unmarshalListDHCPEntriesResponse = (data) => {
166
- if (!sdkClient.isJSONObject(data)) {
167
- throw new TypeError(
168
- `Unmarshalling the type 'ListDHCPEntriesResponse' failed as data isn't a dictionary.`
169
- );
170
- }
171
- return {
172
- dhcpEntries: sdkClient.unmarshalArrayOfObject(data.dhcp_entries, unmarshalDHCPEntry),
173
- totalCount: data.total_count
174
- };
175
- };
176
- const unmarshalListDHCPsResponse = (data) => {
177
- if (!sdkClient.isJSONObject(data)) {
178
- throw new TypeError(
179
- `Unmarshalling the type 'ListDHCPsResponse' failed as data isn't a dictionary.`
180
- );
181
- }
182
- return {
183
- dhcps: sdkClient.unmarshalArrayOfObject(data.dhcps, unmarshalDHCP),
184
- totalCount: data.total_count
185
- };
186
- };
187
- const unmarshalListGatewayNetworksResponse = (data) => {
188
- if (!sdkClient.isJSONObject(data)) {
189
- throw new TypeError(
190
- `Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary.`
191
- );
192
- }
193
- return {
194
- gatewayNetworks: sdkClient.unmarshalArrayOfObject(
195
- data.gateway_networks,
196
- unmarshalGatewayNetwork
197
- ),
198
- totalCount: data.total_count
199
- };
200
- };
201
- const unmarshalListGatewayTypesResponse = (data) => {
202
- if (!sdkClient.isJSONObject(data)) {
203
- throw new TypeError(
204
- `Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary.`
205
- );
206
- }
207
- return {
208
- types: sdkClient.unmarshalArrayOfObject(data.types, unmarshalGatewayType)
209
- };
210
- };
211
- const unmarshalListGatewaysResponse = (data) => {
212
- if (!sdkClient.isJSONObject(data)) {
213
- throw new TypeError(
214
- `Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary.`
215
- );
216
- }
217
- return {
218
- gateways: sdkClient.unmarshalArrayOfObject(data.gateways, unmarshalGateway),
219
- totalCount: data.total_count
220
- };
221
- };
222
- const unmarshalListIPsResponse = (data) => {
223
- if (!sdkClient.isJSONObject(data)) {
224
- throw new TypeError(
225
- `Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`
226
- );
227
- }
228
- return {
229
- ips: sdkClient.unmarshalArrayOfObject(data.ips, unmarshalIP),
230
- totalCount: data.total_count
231
- };
232
- };
233
- const unmarshalListPATRulesResponse = (data) => {
234
- if (!sdkClient.isJSONObject(data)) {
235
- throw new TypeError(
236
- `Unmarshalling the type 'ListPATRulesResponse' failed as data isn't a dictionary.`
237
- );
238
- }
239
- return {
240
- patRules: sdkClient.unmarshalArrayOfObject(data.pat_rules, unmarshalPATRule),
241
- totalCount: data.total_count
242
- };
243
- };
244
- const unmarshalSetDHCPEntriesResponse = (data) => {
245
- if (!sdkClient.isJSONObject(data)) {
246
- throw new TypeError(
247
- `Unmarshalling the type 'SetDHCPEntriesResponse' failed as data isn't a dictionary.`
248
- );
249
- }
250
- return {
251
- dhcpEntries: sdkClient.unmarshalArrayOfObject(data.dhcp_entries, unmarshalDHCPEntry)
252
- };
253
- };
254
- const unmarshalSetPATRulesResponse = (data) => {
255
- if (!sdkClient.isJSONObject(data)) {
256
- throw new TypeError(
257
- `Unmarshalling the type 'SetPATRulesResponse' failed as data isn't a dictionary.`
258
- );
259
- }
260
- return {
261
- patRules: sdkClient.unmarshalArrayOfObject(data.pat_rules, unmarshalPATRule)
262
- };
263
- };
264
- const marshalCreateDHCPRequest = (request, defaults) => ({
265
- address: request.address,
266
- dns_local_name: request.dnsLocalName,
267
- dns_search: request.dnsSearch,
268
- dns_servers_override: request.dnsServersOverride,
269
- enable_dynamic: request.enableDynamic,
270
- pool_high: request.poolHigh,
271
- pool_low: request.poolLow,
272
- project_id: request.projectId ?? defaults.defaultProjectId,
273
- push_default_route: request.pushDefaultRoute,
274
- push_dns_server: request.pushDnsServer,
275
- rebind_timer: request.rebindTimer,
276
- renew_timer: request.renewTimer,
277
- subnet: request.subnet,
278
- valid_lifetime: request.validLifetime
279
- });
280
- const marshalCreateDHCPEntryRequest = (request, defaults) => ({
281
- gateway_network_id: request.gatewayNetworkId,
282
- ip_address: request.ipAddress,
283
- mac_address: request.macAddress
284
- });
285
- const marshalCreateGatewayNetworkRequestIpamConfig = (request, defaults) => ({
286
- ipam_ip_id: request.ipamIpId,
287
- push_default_route: request.pushDefaultRoute
288
- });
289
- const marshalCreateGatewayNetworkRequest = (request, defaults) => ({
290
- enable_dhcp: request.enableDhcp,
291
- enable_masquerade: request.enableMasquerade,
292
- gateway_id: request.gatewayId,
293
- private_network_id: request.privateNetworkId,
294
- ...sdkClient.resolveOneOf([
295
- { param: "dhcp_id", value: request.dhcpId },
296
- {
297
- param: "dhcp",
298
- value: request.dhcp !== void 0 ? marshalCreateDHCPRequest(request.dhcp, defaults) : void 0
299
- },
300
- { param: "address", value: request.address },
301
- {
302
- param: "ipam_config",
303
- value: request.ipamConfig !== void 0 ? marshalCreateGatewayNetworkRequestIpamConfig(
304
- request.ipamConfig
305
- ) : void 0
306
- }
307
- ])
308
- });
309
- const marshalCreateGatewayRequest = (request, defaults) => ({
310
- bastion_port: request.bastionPort,
311
- enable_bastion: request.enableBastion,
312
- enable_smtp: request.enableSmtp,
313
- ip_id: request.ipId,
314
- name: request.name || randomName("gw"),
315
- project_id: request.projectId ?? defaults.defaultProjectId,
316
- tags: request.tags,
317
- type: request.type,
318
- upstream_dns_servers: request.upstreamDnsServers
319
- });
320
- const marshalCreateIPRequest = (request, defaults) => ({
321
- project_id: request.projectId ?? defaults.defaultProjectId,
322
- tags: request.tags
323
- });
324
- const marshalCreatePATRuleRequest = (request, defaults) => ({
325
- gateway_id: request.gatewayId,
326
- private_ip: request.privateIp,
327
- private_port: request.privatePort,
328
- protocol: request.protocol,
329
- public_port: request.publicPort
330
- });
331
- const marshalSetDHCPEntriesRequestEntry = (request, defaults) => ({
332
- ip_address: request.ipAddress,
333
- mac_address: request.macAddress
334
- });
335
- const marshalSetDHCPEntriesRequest = (request, defaults) => ({
336
- dhcp_entries: request.dhcpEntries !== void 0 ? request.dhcpEntries.map(
337
- (elt) => marshalSetDHCPEntriesRequestEntry(elt)
338
- ) : void 0,
339
- gateway_network_id: request.gatewayNetworkId
340
- });
341
- const marshalSetPATRulesRequestRule = (request, defaults) => ({
342
- private_ip: request.privateIp,
343
- private_port: request.privatePort,
344
- protocol: request.protocol,
345
- public_port: request.publicPort
346
- });
347
- const marshalSetPATRulesRequest = (request, defaults) => ({
348
- gateway_id: request.gatewayId,
349
- pat_rules: request.patRules.map(
350
- (elt) => marshalSetPATRulesRequestRule(elt)
351
- )
352
- });
353
- const marshalUpdateDHCPEntryRequest = (request, defaults) => ({
354
- ip_address: request.ipAddress
355
- });
356
- const marshalUpdateDHCPRequest = (request, defaults) => ({
357
- address: request.address,
358
- dns_local_name: request.dnsLocalName,
359
- dns_search: request.dnsSearch,
360
- dns_servers_override: request.dnsServersOverride,
361
- enable_dynamic: request.enableDynamic,
362
- pool_high: request.poolHigh,
363
- pool_low: request.poolLow,
364
- push_default_route: request.pushDefaultRoute,
365
- push_dns_server: request.pushDnsServer,
366
- rebind_timer: request.rebindTimer,
367
- renew_timer: request.renewTimer,
368
- subnet: request.subnet,
369
- valid_lifetime: request.validLifetime
370
- });
371
- const marshalUpdateGatewayNetworkRequestIpamConfig = (request, defaults) => ({
372
- ipam_ip_id: request.ipamIpId,
373
- push_default_route: request.pushDefaultRoute
374
- });
375
- const marshalUpdateGatewayNetworkRequest = (request, defaults) => ({
376
- enable_dhcp: request.enableDhcp,
377
- enable_masquerade: request.enableMasquerade,
378
- ...sdkClient.resolveOneOf([
379
- { param: "dhcp_id", value: request.dhcpId },
380
- { param: "address", value: request.address },
381
- {
382
- param: "ipam_config",
383
- value: request.ipamConfig !== void 0 ? marshalUpdateGatewayNetworkRequestIpamConfig(
384
- request.ipamConfig
385
- ) : void 0
386
- }
387
- ])
388
- });
389
- const marshalUpdateGatewayRequest = (request, defaults) => ({
390
- bastion_port: request.bastionPort,
391
- enable_bastion: request.enableBastion,
392
- enable_smtp: request.enableSmtp,
393
- name: request.name,
394
- tags: request.tags,
395
- upstream_dns_servers: request.upstreamDnsServers
396
- });
397
- const marshalUpdateIPRequest = (request, defaults) => ({
398
- gateway_id: request.gatewayId,
399
- reverse: request.reverse,
400
- tags: request.tags
401
- });
402
- const marshalUpdatePATRuleRequest = (request, defaults) => ({
403
- private_ip: request.privateIp,
404
- private_port: request.privatePort,
405
- protocol: request.protocol,
406
- public_port: request.publicPort
407
- });
408
- const marshalUpgradeGatewayRequest = (request, defaults) => ({
409
- type: request.type
410
- });
411
- exports.marshalCreateDHCPEntryRequest = marshalCreateDHCPEntryRequest;
412
- exports.marshalCreateDHCPRequest = marshalCreateDHCPRequest;
413
- exports.marshalCreateGatewayNetworkRequest = marshalCreateGatewayNetworkRequest;
414
- exports.marshalCreateGatewayRequest = marshalCreateGatewayRequest;
415
- exports.marshalCreateIPRequest = marshalCreateIPRequest;
416
- exports.marshalCreatePATRuleRequest = marshalCreatePATRuleRequest;
417
- exports.marshalSetDHCPEntriesRequest = marshalSetDHCPEntriesRequest;
418
- exports.marshalSetPATRulesRequest = marshalSetPATRulesRequest;
419
- exports.marshalUpdateDHCPEntryRequest = marshalUpdateDHCPEntryRequest;
420
- exports.marshalUpdateDHCPRequest = marshalUpdateDHCPRequest;
421
- exports.marshalUpdateGatewayNetworkRequest = marshalUpdateGatewayNetworkRequest;
422
- exports.marshalUpdateGatewayRequest = marshalUpdateGatewayRequest;
423
- exports.marshalUpdateIPRequest = marshalUpdateIPRequest;
424
- exports.marshalUpdatePATRuleRequest = marshalUpdatePATRuleRequest;
425
- exports.marshalUpgradeGatewayRequest = marshalUpgradeGatewayRequest;
426
- exports.unmarshalDHCP = unmarshalDHCP;
427
- exports.unmarshalDHCPEntry = unmarshalDHCPEntry;
428
- exports.unmarshalGateway = unmarshalGateway;
429
- exports.unmarshalGatewayNetwork = unmarshalGatewayNetwork;
430
- exports.unmarshalIP = unmarshalIP;
431
- exports.unmarshalListDHCPEntriesResponse = unmarshalListDHCPEntriesResponse;
432
- exports.unmarshalListDHCPsResponse = unmarshalListDHCPsResponse;
433
- exports.unmarshalListGatewayNetworksResponse = unmarshalListGatewayNetworksResponse;
434
- exports.unmarshalListGatewayTypesResponse = unmarshalListGatewayTypesResponse;
435
- exports.unmarshalListGatewaysResponse = unmarshalListGatewaysResponse;
436
- exports.unmarshalListIPsResponse = unmarshalListIPsResponse;
437
- exports.unmarshalListPATRulesResponse = unmarshalListPATRulesResponse;
438
- exports.unmarshalPATRule = unmarshalPATRule;
439
- exports.unmarshalSetDHCPEntriesResponse = unmarshalSetDHCPEntriesResponse;
440
- exports.unmarshalSetPATRulesResponse = unmarshalSetPATRulesResponse;