@scaleway/sdk-s2s-vpn 1.1.0

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.
@@ -0,0 +1,368 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sdkClient = require("@scaleway/sdk-client");
4
+ const unmarshalBgpSession = (data) => {
5
+ if (!sdkClient.isJSONObject(data)) {
6
+ throw new TypeError(
7
+ `Unmarshalling the type 'BgpSession' failed as data isn't a dictionary.`
8
+ );
9
+ }
10
+ return {
11
+ peerPrivateIp: data.peer_private_ip,
12
+ privateIp: data.private_ip,
13
+ routingPolicyId: data.routing_policy_id
14
+ };
15
+ };
16
+ const unmarshalConnectionCipher = (data) => {
17
+ if (!sdkClient.isJSONObject(data)) {
18
+ throw new TypeError(
19
+ `Unmarshalling the type 'ConnectionCipher' failed as data isn't a dictionary.`
20
+ );
21
+ }
22
+ return {
23
+ dhGroup: data.dh_group ? data.dh_group : void 0,
24
+ encryption: data.encryption,
25
+ integrity: data.integrity ? data.integrity : void 0
26
+ };
27
+ };
28
+ const unmarshalConnection = (data) => {
29
+ if (!sdkClient.isJSONObject(data)) {
30
+ throw new TypeError(
31
+ `Unmarshalling the type 'Connection' failed as data isn't a dictionary.`
32
+ );
33
+ }
34
+ return {
35
+ bgpSessionIpv4: data.bgp_session_ipv4 ? unmarshalBgpSession(data.bgp_session_ipv4) : void 0,
36
+ bgpSessionIpv6: data.bgp_session_ipv6 ? unmarshalBgpSession(data.bgp_session_ipv6) : void 0,
37
+ bgpStatusIpv4: data.bgp_status_ipv4,
38
+ bgpStatusIpv6: data.bgp_status_ipv6,
39
+ createdAt: sdkClient.unmarshalDate(data.created_at),
40
+ customerGatewayId: data.customer_gateway_id,
41
+ espCiphers: sdkClient.unmarshalArrayOfObject(
42
+ data.esp_ciphers,
43
+ unmarshalConnectionCipher
44
+ ),
45
+ id: data.id,
46
+ ikev2Ciphers: sdkClient.unmarshalArrayOfObject(
47
+ data.ikev2_ciphers,
48
+ unmarshalConnectionCipher
49
+ ),
50
+ initiationPolicy: data.initiation_policy,
51
+ isIpv6: data.is_ipv6,
52
+ name: data.name,
53
+ organizationId: data.organization_id,
54
+ projectId: data.project_id,
55
+ region: data.region,
56
+ routePropagationEnabled: data.route_propagation_enabled,
57
+ status: data.status,
58
+ tags: data.tags,
59
+ tunnelStatus: data.tunnel_status,
60
+ tunnelStatusIpv4: data.tunnel_status_ipv4 ? data.tunnel_status_ipv4 : void 0,
61
+ tunnelStatusIpv6: data.tunnel_status_ipv6 ? data.tunnel_status_ipv6 : void 0,
62
+ updatedAt: sdkClient.unmarshalDate(data.updated_at),
63
+ vpnGatewayId: data.vpn_gateway_id
64
+ };
65
+ };
66
+ const unmarshalCustomerGateway = (data) => {
67
+ if (!sdkClient.isJSONObject(data)) {
68
+ throw new TypeError(
69
+ `Unmarshalling the type 'CustomerGateway' failed as data isn't a dictionary.`
70
+ );
71
+ }
72
+ return {
73
+ asn: data.asn,
74
+ createdAt: sdkClient.unmarshalDate(data.created_at),
75
+ id: data.id,
76
+ name: data.name,
77
+ organizationId: data.organization_id,
78
+ projectId: data.project_id,
79
+ publicIpv4: data.public_ipv4,
80
+ publicIpv6: data.public_ipv6,
81
+ tags: data.tags,
82
+ updatedAt: sdkClient.unmarshalDate(data.updated_at)
83
+ };
84
+ };
85
+ const unmarshalRoutingPolicy = (data) => {
86
+ if (!sdkClient.isJSONObject(data)) {
87
+ throw new TypeError(
88
+ `Unmarshalling the type 'RoutingPolicy' failed as data isn't a dictionary.`
89
+ );
90
+ }
91
+ return {
92
+ createdAt: sdkClient.unmarshalDate(data.created_at),
93
+ id: data.id,
94
+ isIpv6: data.is_ipv6,
95
+ name: data.name,
96
+ organizationId: data.organization_id,
97
+ prefixFilterIn: data.prefix_filter_in,
98
+ prefixFilterOut: data.prefix_filter_out,
99
+ projectId: data.project_id,
100
+ region: data.region,
101
+ tags: data.tags,
102
+ updatedAt: sdkClient.unmarshalDate(data.updated_at)
103
+ };
104
+ };
105
+ const unmarshalVpnGatewayPrivateConfig = (data) => {
106
+ if (!sdkClient.isJSONObject(data)) {
107
+ throw new TypeError(
108
+ `Unmarshalling the type 'VpnGatewayPrivateConfig' failed as data isn't a dictionary.`
109
+ );
110
+ }
111
+ return {};
112
+ };
113
+ const unmarshalVpnGatewayPublicConfig = (data) => {
114
+ if (!sdkClient.isJSONObject(data)) {
115
+ throw new TypeError(
116
+ `Unmarshalling the type 'VpnGatewayPublicConfig' failed as data isn't a dictionary.`
117
+ );
118
+ }
119
+ return {
120
+ ipamIpv4Id: data.ipam_ipv4_id,
121
+ ipamIpv6Id: data.ipam_ipv6_id
122
+ };
123
+ };
124
+ const unmarshalVpnGateway = (data) => {
125
+ if (!sdkClient.isJSONObject(data)) {
126
+ throw new TypeError(
127
+ `Unmarshalling the type 'VpnGateway' failed as data isn't a dictionary.`
128
+ );
129
+ }
130
+ return {
131
+ asn: data.asn,
132
+ createdAt: sdkClient.unmarshalDate(data.created_at),
133
+ gatewayType: data.gateway_type,
134
+ id: data.id,
135
+ ipamPrivateIpv4Id: data.ipam_private_ipv4_id,
136
+ ipamPrivateIpv6Id: data.ipam_private_ipv6_id,
137
+ name: data.name,
138
+ organizationId: data.organization_id,
139
+ privateConfig: data.private_config ? unmarshalVpnGatewayPrivateConfig(data.private_config) : void 0,
140
+ privateNetworkId: data.private_network_id,
141
+ projectId: data.project_id,
142
+ publicConfig: data.public_config ? unmarshalVpnGatewayPublicConfig(data.public_config) : void 0,
143
+ region: data.region,
144
+ status: data.status,
145
+ tags: data.tags,
146
+ updatedAt: sdkClient.unmarshalDate(data.updated_at),
147
+ zone: data.zone
148
+ };
149
+ };
150
+ const unmarshalCreateConnectionResponse = (data) => {
151
+ if (!sdkClient.isJSONObject(data)) {
152
+ throw new TypeError(
153
+ `Unmarshalling the type 'CreateConnectionResponse' failed as data isn't a dictionary.`
154
+ );
155
+ }
156
+ return {
157
+ connection: data.connection ? unmarshalConnection(data.connection) : void 0,
158
+ preSharedKey: data.pre_shared_key
159
+ };
160
+ };
161
+ const unmarshalListConnectionsResponse = (data) => {
162
+ if (!sdkClient.isJSONObject(data)) {
163
+ throw new TypeError(
164
+ `Unmarshalling the type 'ListConnectionsResponse' failed as data isn't a dictionary.`
165
+ );
166
+ }
167
+ return {
168
+ connections: sdkClient.unmarshalArrayOfObject(data.connections, unmarshalConnection),
169
+ totalCount: data.total_count
170
+ };
171
+ };
172
+ const unmarshalListCustomerGatewaysResponse = (data) => {
173
+ if (!sdkClient.isJSONObject(data)) {
174
+ throw new TypeError(
175
+ `Unmarshalling the type 'ListCustomerGatewaysResponse' failed as data isn't a dictionary.`
176
+ );
177
+ }
178
+ return {
179
+ gateways: sdkClient.unmarshalArrayOfObject(data.gateways, unmarshalCustomerGateway),
180
+ totalCount: data.total_count
181
+ };
182
+ };
183
+ const unmarshalListRoutingPoliciesResponse = (data) => {
184
+ if (!sdkClient.isJSONObject(data)) {
185
+ throw new TypeError(
186
+ `Unmarshalling the type 'ListRoutingPoliciesResponse' failed as data isn't a dictionary.`
187
+ );
188
+ }
189
+ return {
190
+ routingPolicies: sdkClient.unmarshalArrayOfObject(
191
+ data.routing_policies,
192
+ unmarshalRoutingPolicy
193
+ ),
194
+ totalCount: data.total_count
195
+ };
196
+ };
197
+ const unmarshalGatewayType = (data) => {
198
+ if (!sdkClient.isJSONObject(data)) {
199
+ throw new TypeError(
200
+ `Unmarshalling the type 'GatewayType' failed as data isn't a dictionary.`
201
+ );
202
+ }
203
+ return {
204
+ allowedConnections: data.allowed_connections,
205
+ bandwidth: data.bandwidth,
206
+ name: data.name,
207
+ region: data.region
208
+ };
209
+ };
210
+ const unmarshalListVpnGatewayTypesResponse = (data) => {
211
+ if (!sdkClient.isJSONObject(data)) {
212
+ throw new TypeError(
213
+ `Unmarshalling the type 'ListVpnGatewayTypesResponse' failed as data isn't a dictionary.`
214
+ );
215
+ }
216
+ return {
217
+ gatewayTypes: sdkClient.unmarshalArrayOfObject(
218
+ data.gateway_types,
219
+ unmarshalGatewayType
220
+ ),
221
+ totalCount: data.total_count
222
+ };
223
+ };
224
+ const unmarshalListVpnGatewaysResponse = (data) => {
225
+ if (!sdkClient.isJSONObject(data)) {
226
+ throw new TypeError(
227
+ `Unmarshalling the type 'ListVpnGatewaysResponse' failed as data isn't a dictionary.`
228
+ );
229
+ }
230
+ return {
231
+ gateways: sdkClient.unmarshalArrayOfObject(data.gateways, unmarshalVpnGateway),
232
+ totalCount: data.total_count
233
+ };
234
+ };
235
+ const unmarshalRenewConnectionPskResponse = (data) => {
236
+ if (!sdkClient.isJSONObject(data)) {
237
+ throw new TypeError(
238
+ `Unmarshalling the type 'RenewConnectionPskResponse' failed as data isn't a dictionary.`
239
+ );
240
+ }
241
+ return {
242
+ connection: data.connection ? unmarshalConnection(data.connection) : void 0,
243
+ preSharedKey: data.pre_shared_key
244
+ };
245
+ };
246
+ const marshalConnectionCipher = (request, defaults) => ({
247
+ dh_group: request.dhGroup,
248
+ encryption: request.encryption,
249
+ integrity: request.integrity
250
+ });
251
+ const marshalCreateConnectionRequestBgpConfig = (request, defaults) => ({
252
+ peer_private_ip: request.peerPrivateIp,
253
+ private_ip: request.privateIp,
254
+ routing_policy_id: request.routingPolicyId
255
+ });
256
+ const marshalCreateConnectionRequest = (request, defaults) => ({
257
+ bgp_config_ipv4: request.bgpConfigIpv4 !== void 0 ? marshalCreateConnectionRequestBgpConfig(request.bgpConfigIpv4) : void 0,
258
+ bgp_config_ipv6: request.bgpConfigIpv6 !== void 0 ? marshalCreateConnectionRequestBgpConfig(request.bgpConfigIpv6) : void 0,
259
+ customer_gateway_id: request.customerGatewayId,
260
+ enable_route_propagation: request.enableRoutePropagation,
261
+ esp_ciphers: request.espCiphers.map(
262
+ (elt) => marshalConnectionCipher(elt)
263
+ ),
264
+ ikev2_ciphers: request.ikev2Ciphers.map(
265
+ (elt) => marshalConnectionCipher(elt)
266
+ ),
267
+ initiation_policy: request.initiationPolicy,
268
+ is_ipv6: request.isIpv6,
269
+ name: request.name,
270
+ project_id: request.projectId ?? defaults.defaultProjectId,
271
+ tags: request.tags,
272
+ vpn_gateway_id: request.vpnGatewayId
273
+ });
274
+ const marshalCreateCustomerGatewayRequest = (request, defaults) => ({
275
+ asn: request.asn,
276
+ ipv4_public: request.ipv4Public,
277
+ ipv6_public: request.ipv6Public,
278
+ name: request.name,
279
+ project_id: request.projectId ?? defaults.defaultProjectId,
280
+ tags: request.tags
281
+ });
282
+ const marshalCreateRoutingPolicyRequest = (request, defaults) => ({
283
+ is_ipv6: request.isIpv6,
284
+ name: request.name,
285
+ prefix_filter_in: request.prefixFilterIn,
286
+ prefix_filter_out: request.prefixFilterOut,
287
+ project_id: request.projectId ?? defaults.defaultProjectId,
288
+ tags: request.tags
289
+ });
290
+ const marshalCreateVpnGatewayRequestPublicConfig = (request, defaults) => ({
291
+ ipam_ipv4_id: request.ipamIpv4Id,
292
+ ipam_ipv6_id: request.ipamIpv6Id
293
+ });
294
+ const marshalCreateVpnGatewayRequest = (request, defaults) => ({
295
+ gateway_type: request.gatewayType,
296
+ ipam_private_ipv4_id: request.ipamPrivateIpv4Id,
297
+ ipam_private_ipv6_id: request.ipamPrivateIpv6Id,
298
+ name: request.name,
299
+ private_network_id: request.privateNetworkId,
300
+ project_id: request.projectId ?? defaults.defaultProjectId,
301
+ tags: request.tags,
302
+ zone: request.zone ?? defaults.defaultZone,
303
+ ...sdkClient.resolveOneOf([
304
+ {
305
+ param: "public_config",
306
+ value: request.publicConfig !== void 0 ? marshalCreateVpnGatewayRequestPublicConfig(
307
+ request.publicConfig
308
+ ) : void 0
309
+ }
310
+ ])
311
+ });
312
+ const marshalDetachRoutingPolicyRequest = (request, defaults) => ({
313
+ ...sdkClient.resolveOneOf([
314
+ { param: "routing_policy_v4", value: request.routingPolicyV4 },
315
+ { param: "routing_policy_v6", value: request.routingPolicyV6 }
316
+ ])
317
+ });
318
+ const marshalSetRoutingPolicyRequest = (request, defaults) => ({
319
+ ...sdkClient.resolveOneOf([
320
+ { param: "routing_policy_v4", value: request.routingPolicyV4 },
321
+ { param: "routing_policy_v6", value: request.routingPolicyV6 }
322
+ ])
323
+ });
324
+ const marshalUpdateConnectionRequest = (request, defaults) => ({
325
+ esp_ciphers: request.espCiphers !== void 0 ? request.espCiphers.map((elt) => marshalConnectionCipher(elt)) : void 0,
326
+ ikev2_ciphers: request.ikev2Ciphers !== void 0 ? request.ikev2Ciphers.map((elt) => marshalConnectionCipher(elt)) : void 0,
327
+ initiation_policy: request.initiationPolicy,
328
+ name: request.name,
329
+ tags: request.tags
330
+ });
331
+ const marshalUpdateCustomerGatewayRequest = (request, defaults) => ({
332
+ asn: request.asn,
333
+ ipv4_public: request.ipv4Public,
334
+ ipv6_public: request.ipv6Public,
335
+ name: request.name,
336
+ tags: request.tags
337
+ });
338
+ const marshalUpdateRoutingPolicyRequest = (request, defaults) => ({
339
+ name: request.name,
340
+ prefix_filter_in: request.prefixFilterIn,
341
+ prefix_filter_out: request.prefixFilterOut,
342
+ tags: request.tags
343
+ });
344
+ const marshalUpdateVpnGatewayRequest = (request, defaults) => ({
345
+ name: request.name,
346
+ tags: request.tags
347
+ });
348
+ exports.marshalCreateConnectionRequest = marshalCreateConnectionRequest;
349
+ exports.marshalCreateCustomerGatewayRequest = marshalCreateCustomerGatewayRequest;
350
+ exports.marshalCreateRoutingPolicyRequest = marshalCreateRoutingPolicyRequest;
351
+ exports.marshalCreateVpnGatewayRequest = marshalCreateVpnGatewayRequest;
352
+ exports.marshalDetachRoutingPolicyRequest = marshalDetachRoutingPolicyRequest;
353
+ exports.marshalSetRoutingPolicyRequest = marshalSetRoutingPolicyRequest;
354
+ exports.marshalUpdateConnectionRequest = marshalUpdateConnectionRequest;
355
+ exports.marshalUpdateCustomerGatewayRequest = marshalUpdateCustomerGatewayRequest;
356
+ exports.marshalUpdateRoutingPolicyRequest = marshalUpdateRoutingPolicyRequest;
357
+ exports.marshalUpdateVpnGatewayRequest = marshalUpdateVpnGatewayRequest;
358
+ exports.unmarshalConnection = unmarshalConnection;
359
+ exports.unmarshalCreateConnectionResponse = unmarshalCreateConnectionResponse;
360
+ exports.unmarshalCustomerGateway = unmarshalCustomerGateway;
361
+ exports.unmarshalListConnectionsResponse = unmarshalListConnectionsResponse;
362
+ exports.unmarshalListCustomerGatewaysResponse = unmarshalListCustomerGatewaysResponse;
363
+ exports.unmarshalListRoutingPoliciesResponse = unmarshalListRoutingPoliciesResponse;
364
+ exports.unmarshalListVpnGatewayTypesResponse = unmarshalListVpnGatewayTypesResponse;
365
+ exports.unmarshalListVpnGatewaysResponse = unmarshalListVpnGatewaysResponse;
366
+ exports.unmarshalRenewConnectionPskResponse = unmarshalRenewConnectionPskResponse;
367
+ exports.unmarshalRoutingPolicy = unmarshalRoutingPolicy;
368
+ exports.unmarshalVpnGateway = unmarshalVpnGateway;
@@ -0,0 +1,23 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { Connection, CreateConnectionRequest, CreateConnectionResponse, CreateCustomerGatewayRequest, CreateRoutingPolicyRequest, CreateVpnGatewayRequest, CustomerGateway, DetachRoutingPolicyRequest, ListConnectionsResponse, ListCustomerGatewaysResponse, ListRoutingPoliciesResponse, ListVpnGatewayTypesResponse, ListVpnGatewaysResponse, RenewConnectionPskResponse, RoutingPolicy, SetRoutingPolicyRequest, UpdateConnectionRequest, UpdateCustomerGatewayRequest, UpdateRoutingPolicyRequest, UpdateVpnGatewayRequest, VpnGateway } from './types.gen.js';
3
+ export declare const unmarshalConnection: (data: unknown) => Connection;
4
+ export declare const unmarshalCustomerGateway: (data: unknown) => CustomerGateway;
5
+ export declare const unmarshalRoutingPolicy: (data: unknown) => RoutingPolicy;
6
+ export declare const unmarshalVpnGateway: (data: unknown) => VpnGateway;
7
+ export declare const unmarshalCreateConnectionResponse: (data: unknown) => CreateConnectionResponse;
8
+ export declare const unmarshalListConnectionsResponse: (data: unknown) => ListConnectionsResponse;
9
+ export declare const unmarshalListCustomerGatewaysResponse: (data: unknown) => ListCustomerGatewaysResponse;
10
+ export declare const unmarshalListRoutingPoliciesResponse: (data: unknown) => ListRoutingPoliciesResponse;
11
+ export declare const unmarshalListVpnGatewayTypesResponse: (data: unknown) => ListVpnGatewayTypesResponse;
12
+ export declare const unmarshalListVpnGatewaysResponse: (data: unknown) => ListVpnGatewaysResponse;
13
+ export declare const unmarshalRenewConnectionPskResponse: (data: unknown) => RenewConnectionPskResponse;
14
+ export declare const marshalCreateConnectionRequest: (request: CreateConnectionRequest, defaults: DefaultValues) => Record<string, unknown>;
15
+ export declare const marshalCreateCustomerGatewayRequest: (request: CreateCustomerGatewayRequest, defaults: DefaultValues) => Record<string, unknown>;
16
+ export declare const marshalCreateRoutingPolicyRequest: (request: CreateRoutingPolicyRequest, defaults: DefaultValues) => Record<string, unknown>;
17
+ export declare const marshalCreateVpnGatewayRequest: (request: CreateVpnGatewayRequest, defaults: DefaultValues) => Record<string, unknown>;
18
+ export declare const marshalDetachRoutingPolicyRequest: (request: DetachRoutingPolicyRequest, defaults: DefaultValues) => Record<string, unknown>;
19
+ export declare const marshalSetRoutingPolicyRequest: (request: SetRoutingPolicyRequest, defaults: DefaultValues) => Record<string, unknown>;
20
+ export declare const marshalUpdateConnectionRequest: (request: UpdateConnectionRequest, defaults: DefaultValues) => Record<string, unknown>;
21
+ export declare const marshalUpdateCustomerGatewayRequest: (request: UpdateCustomerGatewayRequest, defaults: DefaultValues) => Record<string, unknown>;
22
+ export declare const marshalUpdateRoutingPolicyRequest: (request: UpdateRoutingPolicyRequest, defaults: DefaultValues) => Record<string, unknown>;
23
+ export declare const marshalUpdateVpnGatewayRequest: (request: UpdateVpnGatewayRequest, defaults: DefaultValues) => Record<string, unknown>;