@scaleway/sdk-vpcgw 1.1.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,288 +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 unmarshalGatewayNetwork = (data) => {
6
- if (!sdkClient.isJSONObject(data)) {
7
- throw new TypeError(
8
- `Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary.`
9
- );
10
- }
11
- return {
12
- createdAt: sdkClient.unmarshalDate(data.created_at),
13
- gatewayId: data.gateway_id,
14
- id: data.id,
15
- ipamIpId: data.ipam_ip_id,
16
- macAddress: data.mac_address,
17
- masqueradeEnabled: data.masquerade_enabled,
18
- privateNetworkId: data.private_network_id,
19
- pushDefaultRoute: data.push_default_route,
20
- status: data.status,
21
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
22
- zone: data.zone
23
- };
24
- };
25
- const unmarshalIP = (data) => {
26
- if (!sdkClient.isJSONObject(data)) {
27
- throw new TypeError(
28
- `Unmarshalling the type 'IP' failed as data isn't a dictionary.`
29
- );
30
- }
31
- return {
32
- address: data.address,
33
- createdAt: sdkClient.unmarshalDate(data.created_at),
34
- gatewayId: data.gateway_id,
35
- id: data.id,
36
- organizationId: data.organization_id,
37
- projectId: data.project_id,
38
- reverse: data.reverse,
39
- tags: data.tags,
40
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
41
- zone: data.zone
42
- };
43
- };
44
- const unmarshalGateway = (data) => {
45
- if (!sdkClient.isJSONObject(data)) {
46
- throw new TypeError(
47
- `Unmarshalling the type 'Gateway' failed as data isn't a dictionary.`
48
- );
49
- }
50
- return {
51
- bandwidth: data.bandwidth,
52
- bastionAllowedIps: data.bastion_allowed_ips,
53
- bastionEnabled: data.bastion_enabled,
54
- bastionPort: data.bastion_port,
55
- canUpgradeTo: data.can_upgrade_to,
56
- createdAt: sdkClient.unmarshalDate(data.created_at),
57
- gatewayNetworks: sdkClient.unmarshalArrayOfObject(
58
- data.gateway_networks,
59
- unmarshalGatewayNetwork
60
- ),
61
- id: data.id,
62
- ipv4: data.ipv4 ? unmarshalIP(data.ipv4) : void 0,
63
- isLegacy: data.is_legacy,
64
- name: data.name,
65
- organizationId: data.organization_id,
66
- projectId: data.project_id,
67
- smtpEnabled: data.smtp_enabled,
68
- status: data.status,
69
- tags: data.tags,
70
- type: data.type,
71
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
72
- version: data.version,
73
- zone: data.zone
74
- };
75
- };
76
- const unmarshalPatRule = (data) => {
77
- if (!sdkClient.isJSONObject(data)) {
78
- throw new TypeError(
79
- `Unmarshalling the type 'PatRule' failed as data isn't a dictionary.`
80
- );
81
- }
82
- return {
83
- createdAt: sdkClient.unmarshalDate(data.created_at),
84
- gatewayId: data.gateway_id,
85
- id: data.id,
86
- privateIp: data.private_ip,
87
- privatePort: data.private_port,
88
- protocol: data.protocol,
89
- publicPort: data.public_port,
90
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
91
- zone: data.zone
92
- };
93
- };
94
- const unmarshalAddBastionAllowedIPsResponse = (data) => {
95
- if (!sdkClient.isJSONObject(data)) {
96
- throw new TypeError(
97
- `Unmarshalling the type 'AddBastionAllowedIPsResponse' failed as data isn't a dictionary.`
98
- );
99
- }
100
- return {
101
- ipRanges: data.ip_ranges
102
- };
103
- };
104
- const unmarshalListGatewayNetworksResponse = (data) => {
105
- if (!sdkClient.isJSONObject(data)) {
106
- throw new TypeError(
107
- `Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary.`
108
- );
109
- }
110
- return {
111
- gatewayNetworks: sdkClient.unmarshalArrayOfObject(
112
- data.gateway_networks,
113
- unmarshalGatewayNetwork
114
- ),
115
- totalCount: data.total_count
116
- };
117
- };
118
- const unmarshalGatewayType = (data) => {
119
- if (!sdkClient.isJSONObject(data)) {
120
- throw new TypeError(
121
- `Unmarshalling the type 'GatewayType' failed as data isn't a dictionary.`
122
- );
123
- }
124
- return {
125
- bandwidth: data.bandwidth,
126
- name: data.name,
127
- zone: data.zone
128
- };
129
- };
130
- const unmarshalListGatewayTypesResponse = (data) => {
131
- if (!sdkClient.isJSONObject(data)) {
132
- throw new TypeError(
133
- `Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary.`
134
- );
135
- }
136
- return {
137
- types: sdkClient.unmarshalArrayOfObject(data.types, unmarshalGatewayType)
138
- };
139
- };
140
- const unmarshalListGatewaysResponse = (data) => {
141
- if (!sdkClient.isJSONObject(data)) {
142
- throw new TypeError(
143
- `Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary.`
144
- );
145
- }
146
- return {
147
- gateways: sdkClient.unmarshalArrayOfObject(data.gateways, unmarshalGateway),
148
- totalCount: data.total_count
149
- };
150
- };
151
- const unmarshalListIPsResponse = (data) => {
152
- if (!sdkClient.isJSONObject(data)) {
153
- throw new TypeError(
154
- `Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`
155
- );
156
- }
157
- return {
158
- ips: sdkClient.unmarshalArrayOfObject(data.ips, unmarshalIP),
159
- totalCount: data.total_count
160
- };
161
- };
162
- const unmarshalListPatRulesResponse = (data) => {
163
- if (!sdkClient.isJSONObject(data)) {
164
- throw new TypeError(
165
- `Unmarshalling the type 'ListPatRulesResponse' failed as data isn't a dictionary.`
166
- );
167
- }
168
- return {
169
- patRules: sdkClient.unmarshalArrayOfObject(data.pat_rules, unmarshalPatRule),
170
- totalCount: data.total_count
171
- };
172
- };
173
- const unmarshalSetBastionAllowedIPsResponse = (data) => {
174
- if (!sdkClient.isJSONObject(data)) {
175
- throw new TypeError(
176
- `Unmarshalling the type 'SetBastionAllowedIPsResponse' failed as data isn't a dictionary.`
177
- );
178
- }
179
- return {
180
- ipRanges: data.ip_ranges
181
- };
182
- };
183
- const unmarshalSetPatRulesResponse = (data) => {
184
- if (!sdkClient.isJSONObject(data)) {
185
- throw new TypeError(
186
- `Unmarshalling the type 'SetPatRulesResponse' failed as data isn't a dictionary.`
187
- );
188
- }
189
- return {
190
- patRules: sdkClient.unmarshalArrayOfObject(data.pat_rules, unmarshalPatRule)
191
- };
192
- };
193
- const marshalAddBastionAllowedIPsRequest = (request, defaults) => ({
194
- ip_range: request.ipRange
195
- });
196
- const marshalCreateGatewayNetworkRequest = (request, defaults) => ({
197
- enable_masquerade: request.enableMasquerade,
198
- gateway_id: request.gatewayId,
199
- ipam_ip_id: request.ipamIpId,
200
- private_network_id: request.privateNetworkId,
201
- push_default_route: request.pushDefaultRoute
202
- });
203
- const marshalCreateGatewayRequest = (request, defaults) => ({
204
- bastion_port: request.bastionPort,
205
- enable_bastion: request.enableBastion,
206
- enable_smtp: request.enableSmtp,
207
- ip_id: request.ipId,
208
- name: request.name || randomName("gw"),
209
- project_id: request.projectId ?? defaults.defaultProjectId,
210
- tags: request.tags,
211
- type: request.type
212
- });
213
- const marshalCreateIPRequest = (request, defaults) => ({
214
- project_id: request.projectId ?? defaults.defaultProjectId,
215
- tags: request.tags
216
- });
217
- const marshalCreatePatRuleRequest = (request, defaults) => ({
218
- gateway_id: request.gatewayId,
219
- private_ip: request.privateIp,
220
- private_port: request.privatePort,
221
- protocol: request.protocol,
222
- public_port: request.publicPort
223
- });
224
- const marshalSetBastionAllowedIPsRequest = (request, defaults) => ({
225
- ip_ranges: request.ipRanges
226
- });
227
- const marshalSetPatRulesRequestRule = (request, defaults) => ({
228
- private_ip: request.privateIp,
229
- private_port: request.privatePort,
230
- protocol: request.protocol,
231
- public_port: request.publicPort
232
- });
233
- const marshalSetPatRulesRequest = (request, defaults) => ({
234
- gateway_id: request.gatewayId,
235
- pat_rules: request.patRules.map(
236
- (elt) => marshalSetPatRulesRequestRule(elt)
237
- )
238
- });
239
- const marshalUpdateGatewayNetworkRequest = (request, defaults) => ({
240
- enable_masquerade: request.enableMasquerade,
241
- ipam_ip_id: request.ipamIpId,
242
- push_default_route: request.pushDefaultRoute
243
- });
244
- const marshalUpdateGatewayRequest = (request, defaults) => ({
245
- bastion_port: request.bastionPort,
246
- enable_bastion: request.enableBastion,
247
- enable_smtp: request.enableSmtp,
248
- name: request.name,
249
- tags: request.tags
250
- });
251
- const marshalUpdateIPRequest = (request, defaults) => ({
252
- gateway_id: request.gatewayId,
253
- reverse: request.reverse,
254
- tags: request.tags
255
- });
256
- const marshalUpdatePatRuleRequest = (request, defaults) => ({
257
- private_ip: request.privateIp,
258
- private_port: request.privatePort,
259
- protocol: request.protocol,
260
- public_port: request.publicPort
261
- });
262
- const marshalUpgradeGatewayRequest = (request, defaults) => ({
263
- type: request.type
264
- });
265
- exports.marshalAddBastionAllowedIPsRequest = marshalAddBastionAllowedIPsRequest;
266
- exports.marshalCreateGatewayNetworkRequest = marshalCreateGatewayNetworkRequest;
267
- exports.marshalCreateGatewayRequest = marshalCreateGatewayRequest;
268
- exports.marshalCreateIPRequest = marshalCreateIPRequest;
269
- exports.marshalCreatePatRuleRequest = marshalCreatePatRuleRequest;
270
- exports.marshalSetBastionAllowedIPsRequest = marshalSetBastionAllowedIPsRequest;
271
- exports.marshalSetPatRulesRequest = marshalSetPatRulesRequest;
272
- exports.marshalUpdateGatewayNetworkRequest = marshalUpdateGatewayNetworkRequest;
273
- exports.marshalUpdateGatewayRequest = marshalUpdateGatewayRequest;
274
- exports.marshalUpdateIPRequest = marshalUpdateIPRequest;
275
- exports.marshalUpdatePatRuleRequest = marshalUpdatePatRuleRequest;
276
- exports.marshalUpgradeGatewayRequest = marshalUpgradeGatewayRequest;
277
- exports.unmarshalAddBastionAllowedIPsResponse = unmarshalAddBastionAllowedIPsResponse;
278
- exports.unmarshalGateway = unmarshalGateway;
279
- exports.unmarshalGatewayNetwork = unmarshalGatewayNetwork;
280
- exports.unmarshalIP = unmarshalIP;
281
- exports.unmarshalListGatewayNetworksResponse = unmarshalListGatewayNetworksResponse;
282
- exports.unmarshalListGatewayTypesResponse = unmarshalListGatewayTypesResponse;
283
- exports.unmarshalListGatewaysResponse = unmarshalListGatewaysResponse;
284
- exports.unmarshalListIPsResponse = unmarshalListIPsResponse;
285
- exports.unmarshalListPatRulesResponse = unmarshalListPatRulesResponse;
286
- exports.unmarshalPatRule = unmarshalPatRule;
287
- exports.unmarshalSetBastionAllowedIPsResponse = unmarshalSetBastionAllowedIPsResponse;
288
- exports.unmarshalSetPatRulesResponse = unmarshalSetPatRulesResponse;