@scaleway/sdk-s2s-vpn 2.4.1 → 2.5.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,468 +1,322 @@
1
- import { API as API$1, toApiLocality, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
1
  import { VPN_GATEWAY_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalListVpnGatewayTypesResponse, unmarshalListVpnGatewaysResponse, unmarshalVpnGateway, marshalCreateVpnGatewayRequest, marshalUpdateVpnGatewayRequest, unmarshalListConnectionsResponse, unmarshalConnection, marshalCreateConnectionRequest, unmarshalCreateConnectionResponse, marshalUpdateConnectionRequest, unmarshalRenewConnectionPskResponse, marshalSetRoutingPolicyRequest, marshalDetachRoutingPolicyRequest, unmarshalListCustomerGatewaysResponse, unmarshalCustomerGateway, marshalCreateCustomerGatewayRequest, marshalUpdateCustomerGatewayRequest, unmarshalListRoutingPoliciesResponse, unmarshalRoutingPolicy, marshalCreateRoutingPolicyRequest, marshalUpdateRoutingPolicyRequest } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
6
- };
7
- class API extends API$1 {
8
- /**
9
- * Locality of this API.
10
- * type ∈ {'zone','region','global','unspecified'}
11
- */
12
- static LOCALITY = toApiLocality({
13
- regions: [
14
- "fr-par",
15
- "nl-ams",
16
- "pl-waw"
17
- ]
18
- });
19
- pageOfListVpnGatewayTypes = (request = {}) => this.client.fetch(
20
- {
21
- method: "GET",
22
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateway-types`,
23
- urlParams: urlParams(
24
- ["page", request.page],
25
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
26
- )
27
- },
28
- unmarshalListVpnGatewayTypesResponse
29
- );
30
- /**
31
- * List VPN gateway types. List the different VPN gateway commercial offer types available at Scaleway. The response is an array of objects describing the name and technical details of each available VPN gateway type.
32
- *
33
- * @param request - The request {@link ListVpnGatewayTypesRequest}
34
- * @returns A Promise of ListVpnGatewayTypesResponse
35
- */
36
- listVpnGatewayTypes = (request = {}) => enrichForPagination("gatewayTypes", this.pageOfListVpnGatewayTypes, request);
37
- pageOfListVpnGateways = (request = {}) => this.client.fetch(
38
- {
39
- method: "GET",
40
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways`,
41
- urlParams: urlParams(
42
- ["gateway_types", request.gatewayTypes],
43
- ["name", request.name],
44
- ["order_by", request.orderBy],
45
- ["organization_id", request.organizationId],
46
- ["page", request.page],
47
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
48
- ["private_network_ids", request.privateNetworkIds],
49
- ["project_id", request.projectId],
50
- ["statuses", request.statuses],
51
- ["tags", request.tags]
52
- )
53
- },
54
- unmarshalListVpnGatewaysResponse
55
- );
56
- /**
57
- * List VPN gateways. List all your VPN gateways. A number of filters are available, including Project ID, name, tags and status.
58
- *
59
- * @param request - The request {@link ListVpnGatewaysRequest}
60
- * @returns A Promise of ListVpnGatewaysResponse
61
- */
62
- listVpnGateways = (request = {}) => enrichForPagination("gateways", this.pageOfListVpnGateways, request);
63
- /**
64
- * Get a VPN gateway. Get a VPN gateway for the given VPN gateway ID.
65
- *
66
- * @param request - The request {@link GetVpnGatewayRequest}
67
- * @returns A Promise of VpnGateway
68
- */
69
- getVpnGateway = (request) => this.client.fetch(
70
- {
71
- method: "GET",
72
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
73
- },
74
- unmarshalVpnGateway
75
- );
76
- /**
77
- * Waits for {@link VpnGateway} to be in a final state.
78
- *
79
- * @param request - The request {@link GetVpnGatewayRequest}
80
- * @param options - The waiting options
81
- * @returns A Promise of VpnGateway
82
- */
83
- waitForVpnGateway = (request, options) => waitForResource(
84
- options?.stop ?? ((res) => Promise.resolve(!VPN_GATEWAY_TRANSIENT_STATUSES.includes(res.status))),
85
- this.getVpnGateway,
86
- request,
87
- options
88
- );
89
- /**
90
- * Create VPN gateway.
91
- *
92
- * @param request - The request {@link CreateVpnGatewayRequest}
93
- * @returns A Promise of VpnGateway
94
- */
95
- createVpnGateway = (request) => this.client.fetch(
96
- {
97
- body: JSON.stringify(
98
- marshalCreateVpnGatewayRequest(request, this.client.settings)
99
- ),
100
- headers: jsonContentHeaders,
101
- method: "POST",
102
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways`
103
- },
104
- unmarshalVpnGateway
105
- );
106
- /**
107
- * Update a VPN gateway. Update an existing VPN gateway, specified by its VPN gateway ID. Only its name and tags can be updated.
108
- *
109
- * @param request - The request {@link UpdateVpnGatewayRequest}
110
- * @returns A Promise of VpnGateway
111
- */
112
- updateVpnGateway = (request) => this.client.fetch(
113
- {
114
- body: JSON.stringify(
115
- marshalUpdateVpnGatewayRequest(request, this.client.settings)
116
- ),
117
- headers: jsonContentHeaders,
118
- method: "PATCH",
119
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
120
- },
121
- unmarshalVpnGateway
122
- );
123
- /**
124
- * Delete a VPN gateway. Delete an existing VPN gateway, specified by its VPN gateway ID.
125
- *
126
- * @param request - The request {@link DeleteVpnGatewayRequest}
127
- * @returns A Promise of VpnGateway
128
- */
129
- deleteVpnGateway = (request) => this.client.fetch(
130
- {
131
- method: "DELETE",
132
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
133
- },
134
- unmarshalVpnGateway
135
- );
136
- pageOfListConnections = (request = {}) => this.client.fetch(
137
- {
138
- method: "GET",
139
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections`,
140
- urlParams: urlParams(
141
- ["customer_gateway_ids", request.customerGatewayIds],
142
- ["is_ipv6", request.isIpv6],
143
- ["name", request.name],
144
- ["order_by", request.orderBy],
145
- ["organization_id", request.organizationId],
146
- ["page", request.page],
147
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
148
- ["project_id", request.projectId],
149
- ["route_propagation_enabled", request.routePropagationEnabled],
150
- ["routing_policy_ids", request.routingPolicyIds],
151
- ["statuses", request.statuses],
152
- ["tags", request.tags],
153
- ["vpn_gateway_ids", request.vpnGatewayIds]
154
- )
155
- },
156
- unmarshalListConnectionsResponse
157
- );
158
- /**
159
- * List connections. List all your connections. A number of filters are available, including Project ID, name, tags and status.
160
- *
161
- * @param request - The request {@link ListConnectionsRequest}
162
- * @returns A Promise of ListConnectionsResponse
163
- */
164
- listConnections = (request = {}) => enrichForPagination("connections", this.pageOfListConnections, request);
165
- /**
166
- * Get a connection. Get a connection for the given connection ID. The response object includes information about the connection's various configuration details.
167
- *
168
- * @param request - The request {@link GetConnectionRequest}
169
- * @returns A Promise of Connection
170
- */
171
- getConnection = (request) => this.client.fetch(
172
- {
173
- method: "GET",
174
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}`
175
- },
176
- unmarshalConnection
177
- );
178
- /**
179
- * Create a connection.
180
- *
181
- * @param request - The request {@link CreateConnectionRequest}
182
- * @returns A Promise of CreateConnectionResponse
183
- */
184
- createConnection = (request) => this.client.fetch(
185
- {
186
- body: JSON.stringify(
187
- marshalCreateConnectionRequest(request, this.client.settings)
188
- ),
189
- headers: jsonContentHeaders,
190
- method: "POST",
191
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections`
192
- },
193
- unmarshalCreateConnectionResponse
194
- );
195
- /**
196
- * Update a connection. Update an existing connection, specified by its connection ID.
197
- *
198
- * @param request - The request {@link UpdateConnectionRequest}
199
- * @returns A Promise of Connection
200
- */
201
- updateConnection = (request) => this.client.fetch(
202
- {
203
- body: JSON.stringify(
204
- marshalUpdateConnectionRequest(request, this.client.settings)
205
- ),
206
- headers: jsonContentHeaders,
207
- method: "PATCH",
208
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}`
209
- },
210
- unmarshalConnection
211
- );
212
- /**
213
- * Delete a connection. Delete an existing connection, specified by its connection ID.
214
- *
215
- * @param request - The request {@link DeleteConnectionRequest}
216
- */
217
- deleteConnection = (request) => this.client.fetch(
218
- {
219
- method: "DELETE",
220
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}`
221
- }
222
- );
223
- /**
224
- * Renew pre-shared key. Renew pre-shared key for a given connection.
225
- *
226
- * @param request - The request {@link RenewConnectionPskRequest}
227
- * @returns A Promise of RenewConnectionPskResponse
228
- */
229
- renewConnectionPsk = (request) => this.client.fetch(
230
- {
231
- body: "{}",
232
- headers: jsonContentHeaders,
233
- method: "POST",
234
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/renew-psk`
235
- },
236
- unmarshalRenewConnectionPskResponse
237
- );
238
- /**
239
- * Set a new routing policy. Set a new routing policy on a connection, overriding the existing one if present, specified by its connection ID.
240
- *
241
- * @param request - The request {@link SetRoutingPolicyRequest}
242
- * @returns A Promise of Connection
243
- */
244
- setRoutingPolicy = (request) => this.client.fetch(
245
- {
246
- body: JSON.stringify(
247
- marshalSetRoutingPolicyRequest(request, this.client.settings)
248
- ),
249
- headers: jsonContentHeaders,
250
- method: "POST",
251
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/set-routing-policy`
252
- },
253
- unmarshalConnection
254
- );
255
- /**
256
- * Detach a routing policy. Detach an existing routing policy from a connection, specified by its connection ID.
257
- *
258
- * @param request - The request {@link DetachRoutingPolicyRequest}
259
- * @returns A Promise of Connection
260
- */
261
- detachRoutingPolicy = (request) => this.client.fetch(
262
- {
263
- body: JSON.stringify(
264
- marshalDetachRoutingPolicyRequest(request, this.client.settings)
265
- ),
266
- headers: jsonContentHeaders,
267
- method: "POST",
268
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/detach-routing-policy`
269
- },
270
- unmarshalConnection
271
- );
272
- /**
273
- * Enable route propagation. Enable all allowed prefixes (defined in a routing policy) to be announced in the BGP session. This allows traffic to flow between the attached VPC and the on-premises infrastructure along the announced routes. Note that by default, even when route propagation is enabled, all routes are blocked. It is essential to attach a routing policy to define the ranges of routes to announce.
274
- *
275
- * @param request - The request {@link EnableRoutePropagationRequest}
276
- * @returns A Promise of Connection
277
- */
278
- enableRoutePropagation = (request) => this.client.fetch(
279
- {
280
- body: "{}",
281
- headers: jsonContentHeaders,
282
- method: "POST",
283
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/enable-route-propagation`
284
- },
285
- unmarshalConnection
286
- );
287
- /**
288
- * Disable route propagation. Prevent any prefixes from being announced in the BGP session. Traffic will not be able to flow over the VPN Gateway until route propagation is re-enabled.
289
- *
290
- * @param request - The request {@link DisableRoutePropagationRequest}
291
- * @returns A Promise of Connection
292
- */
293
- disableRoutePropagation = (request) => this.client.fetch(
294
- {
295
- body: "{}",
296
- headers: jsonContentHeaders,
297
- method: "POST",
298
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/disable-route-propagation`
299
- },
300
- unmarshalConnection
301
- );
302
- pageOfListCustomerGateways = (request = {}) => this.client.fetch(
303
- {
304
- method: "GET",
305
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways`,
306
- urlParams: urlParams(
307
- ["name", request.name],
308
- ["order_by", request.orderBy],
309
- ["organization_id", request.organizationId],
310
- ["page", request.page],
311
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
312
- ["project_id", request.projectId],
313
- ["tags", request.tags]
314
- )
315
- },
316
- unmarshalListCustomerGatewaysResponse
317
- );
318
- /**
319
- * List customer gateways. List all your customer gateways. A number of filters are available, including Project ID, name, and tags.
320
- *
321
- * @param request - The request {@link ListCustomerGatewaysRequest}
322
- * @returns A Promise of ListCustomerGatewaysResponse
323
- */
324
- listCustomerGateways = (request = {}) => enrichForPagination("gateways", this.pageOfListCustomerGateways, request);
325
- /**
326
- * Get a customer gateway. Get a customer gateway for the given customer gateway ID.
327
- *
328
- * @param request - The request {@link GetCustomerGatewayRequest}
329
- * @returns A Promise of CustomerGateway
330
- */
331
- getCustomerGateway = (request) => this.client.fetch(
332
- {
333
- method: "GET",
334
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
335
- },
336
- unmarshalCustomerGateway
337
- );
338
- /**
339
- * Create a customer gateway.
340
- *
341
- * @param request - The request {@link CreateCustomerGatewayRequest}
342
- * @returns A Promise of CustomerGateway
343
- */
344
- createCustomerGateway = (request) => this.client.fetch(
345
- {
346
- body: JSON.stringify(
347
- marshalCreateCustomerGatewayRequest(request, this.client.settings)
348
- ),
349
- headers: jsonContentHeaders,
350
- method: "POST",
351
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways`
352
- },
353
- unmarshalCustomerGateway
354
- );
355
- /**
356
- * Update a customer gateway. Update an existing customer gateway, specified by its customer gateway ID. You can update its name, tags, public IPv4 & IPv6 address and AS Number.
357
- *
358
- * @param request - The request {@link UpdateCustomerGatewayRequest}
359
- * @returns A Promise of CustomerGateway
360
- */
361
- updateCustomerGateway = (request) => this.client.fetch(
362
- {
363
- body: JSON.stringify(
364
- marshalUpdateCustomerGatewayRequest(request, this.client.settings)
365
- ),
366
- headers: jsonContentHeaders,
367
- method: "PATCH",
368
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
369
- },
370
- unmarshalCustomerGateway
371
- );
372
- /**
373
- * Delete a customer gateway. Delete an existing customer gateway, specified by its customer gateway ID.
374
- *
375
- * @param request - The request {@link DeleteCustomerGatewayRequest}
376
- */
377
- deleteCustomerGateway = (request) => this.client.fetch(
378
- {
379
- method: "DELETE",
380
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
381
- }
382
- );
383
- pageOfListRoutingPolicies = (request = {}) => this.client.fetch(
384
- {
385
- method: "GET",
386
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies`,
387
- urlParams: urlParams(
388
- ["ipv6", request.ipv6],
389
- ["name", request.name],
390
- ["order_by", request.orderBy],
391
- ["organization_id", request.organizationId],
392
- ["page", request.page],
393
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
394
- ["project_id", request.projectId],
395
- ["tags", request.tags]
396
- )
397
- },
398
- unmarshalListRoutingPoliciesResponse
399
- );
400
- /**
401
- * List routing policies. List all routing policies in a given region. A routing policy can be attached to one or multiple connections (S2S VPN connections).
402
- *
403
- * @param request - The request {@link ListRoutingPoliciesRequest}
404
- * @returns A Promise of ListRoutingPoliciesResponse
405
- */
406
- listRoutingPolicies = (request = {}) => enrichForPagination("routingPolicies", this.pageOfListRoutingPolicies, request);
407
- /**
408
- * Get routing policy. Get a routing policy for the given routing policy ID. The response object gives information including the policy's name, tags and prefix filters.
409
- *
410
- * @param request - The request {@link GetRoutingPolicyRequest}
411
- * @returns A Promise of RoutingPolicy
412
- */
413
- getRoutingPolicy = (request) => this.client.fetch(
414
- {
415
- method: "GET",
416
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
417
- },
418
- unmarshalRoutingPolicy
419
- );
420
- /**
421
- * Create a routing policy. Create a routing policy. Routing policies allow you to set IP prefix filters to define the incoming route announcements to accept from the customer gateway, and the outgoing routes to announce to the customer gateway.
422
- *
423
- * @param request - The request {@link CreateRoutingPolicyRequest}
424
- * @returns A Promise of RoutingPolicy
425
- */
426
- createRoutingPolicy = (request) => this.client.fetch(
427
- {
428
- body: JSON.stringify(
429
- marshalCreateRoutingPolicyRequest(request, this.client.settings)
430
- ),
431
- headers: jsonContentHeaders,
432
- method: "POST",
433
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies`
434
- },
435
- unmarshalRoutingPolicy
436
- );
437
- /**
438
- * Update a routing policy. Update an existing routing policy, specified by its routing policy ID. Its name, tags and incoming/outgoing prefix filters can be updated.
439
- *
440
- * @param request - The request {@link UpdateRoutingPolicyRequest}
441
- * @returns A Promise of RoutingPolicy
442
- */
443
- updateRoutingPolicy = (request) => this.client.fetch(
444
- {
445
- body: JSON.stringify(
446
- marshalUpdateRoutingPolicyRequest(request, this.client.settings)
447
- ),
448
- headers: jsonContentHeaders,
449
- method: "PATCH",
450
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
451
- },
452
- unmarshalRoutingPolicy
453
- );
454
- /**
455
- * Delete a routing policy. Delete an existing routing policy, specified by its routing policy ID.
456
- *
457
- * @param request - The request {@link DeleteRoutingPolicyRequest}
458
- */
459
- deleteRoutingPolicy = (request) => this.client.fetch(
460
- {
461
- method: "DELETE",
462
- path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
463
- }
464
- );
465
- }
466
- export {
467
- API
2
+ import { marshalCreateConnectionRequest, marshalCreateCustomerGatewayRequest, marshalCreateRoutingPolicyRequest, marshalCreateVpnGatewayRequest, marshalDetachRoutingPolicyRequest, marshalSetRoutingPolicyRequest, marshalUpdateConnectionRequest, marshalUpdateCustomerGatewayRequest, marshalUpdateRoutingPolicyRequest, marshalUpdateVpnGatewayRequest, unmarshalConnection, unmarshalCreateConnectionResponse, unmarshalCustomerGateway, unmarshalListConnectionsResponse, unmarshalListCustomerGatewaysResponse, unmarshalListRoutingPoliciesResponse, unmarshalListVpnGatewayTypesResponse, unmarshalListVpnGatewaysResponse, unmarshalRenewConnectionPskResponse, unmarshalRoutingPolicy, unmarshalVpnGateway } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Site-to-Site VPN.
7
+
8
+ This API allows you to manage your Site-to-Site VPN.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Locality of this API.
13
+ * type ∈ {'zone','region','global','unspecified'}
14
+ */
15
+ static LOCALITY = toApiLocality({ regions: [
16
+ "fr-par",
17
+ "nl-ams",
18
+ "pl-waw"
19
+ ] });
20
+ pageOfListVpnGatewayTypes = (request = {}) => this.client.fetch({
21
+ method: "GET",
22
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateway-types`,
23
+ urlParams: urlParams(["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
24
+ }, unmarshalListVpnGatewayTypesResponse);
25
+ /**
26
+ * List VPN gateway types. List the different VPN gateway commercial offer types available at Scaleway. The response is an array of objects describing the name and technical details of each available VPN gateway type.
27
+ *
28
+ * @param request - The request {@link ListVpnGatewayTypesRequest}
29
+ * @returns A Promise of ListVpnGatewayTypesResponse
30
+ */
31
+ listVpnGatewayTypes = (request = {}) => enrichForPagination("gatewayTypes", this.pageOfListVpnGatewayTypes, request);
32
+ pageOfListVpnGateways = (request = {}) => this.client.fetch({
33
+ method: "GET",
34
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways`,
35
+ urlParams: urlParams(["gateway_types", request.gatewayTypes], ["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["private_network_ids", request.privateNetworkIds], ["project_id", request.projectId], ["statuses", request.statuses], ["tags", request.tags])
36
+ }, unmarshalListVpnGatewaysResponse);
37
+ /**
38
+ * List VPN gateways. List all your VPN gateways. A number of filters are available, including Project ID, name, tags and status.
39
+ *
40
+ * @param request - The request {@link ListVpnGatewaysRequest}
41
+ * @returns A Promise of ListVpnGatewaysResponse
42
+ */
43
+ listVpnGateways = (request = {}) => enrichForPagination("gateways", this.pageOfListVpnGateways, request);
44
+ /**
45
+ * Get a VPN gateway. Get a VPN gateway for the given VPN gateway ID.
46
+ *
47
+ * @param request - The request {@link GetVpnGatewayRequest}
48
+ * @returns A Promise of VpnGateway
49
+ */
50
+ getVpnGateway = (request) => this.client.fetch({
51
+ method: "GET",
52
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
53
+ }, unmarshalVpnGateway);
54
+ /**
55
+ * Waits for {@link VpnGateway} to be in a final state.
56
+ *
57
+ * @param request - The request {@link GetVpnGatewayRequest}
58
+ * @param options - The waiting options
59
+ * @returns A Promise of VpnGateway
60
+ */
61
+ waitForVpnGateway = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!VPN_GATEWAY_TRANSIENT_STATUSES.includes(res.status))), this.getVpnGateway, request, options);
62
+ /**
63
+ * Create VPN gateway.
64
+ *
65
+ * @param request - The request {@link CreateVpnGatewayRequest}
66
+ * @returns A Promise of VpnGateway
67
+ */
68
+ createVpnGateway = (request) => this.client.fetch({
69
+ body: JSON.stringify(marshalCreateVpnGatewayRequest(request, this.client.settings)),
70
+ headers: jsonContentHeaders,
71
+ method: "POST",
72
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways`
73
+ }, unmarshalVpnGateway);
74
+ /**
75
+ * Update a VPN gateway. Update an existing VPN gateway, specified by its VPN gateway ID. Only its name and tags can be updated.
76
+ *
77
+ * @param request - The request {@link UpdateVpnGatewayRequest}
78
+ * @returns A Promise of VpnGateway
79
+ */
80
+ updateVpnGateway = (request) => this.client.fetch({
81
+ body: JSON.stringify(marshalUpdateVpnGatewayRequest(request, this.client.settings)),
82
+ headers: jsonContentHeaders,
83
+ method: "PATCH",
84
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
85
+ }, unmarshalVpnGateway);
86
+ /**
87
+ * Delete a VPN gateway. Delete an existing VPN gateway, specified by its VPN gateway ID.
88
+ *
89
+ * @param request - The request {@link DeleteVpnGatewayRequest}
90
+ * @returns A Promise of VpnGateway
91
+ */
92
+ deleteVpnGateway = (request) => this.client.fetch({
93
+ method: "DELETE",
94
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/vpn-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
95
+ }, unmarshalVpnGateway);
96
+ pageOfListConnections = (request = {}) => this.client.fetch({
97
+ method: "GET",
98
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections`,
99
+ urlParams: urlParams(["customer_gateway_ids", request.customerGatewayIds], ["is_ipv6", request.isIpv6], ["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["route_propagation_enabled", request.routePropagationEnabled], ["routing_policy_ids", request.routingPolicyIds], ["statuses", request.statuses], ["tags", request.tags], ["vpn_gateway_ids", request.vpnGatewayIds])
100
+ }, unmarshalListConnectionsResponse);
101
+ /**
102
+ * List connections. List all your connections. A number of filters are available, including Project ID, name, tags and status.
103
+ *
104
+ * @param request - The request {@link ListConnectionsRequest}
105
+ * @returns A Promise of ListConnectionsResponse
106
+ */
107
+ listConnections = (request = {}) => enrichForPagination("connections", this.pageOfListConnections, request);
108
+ /**
109
+ * Get a connection. Get a connection for the given connection ID. The response object includes information about the connection's various configuration details.
110
+ *
111
+ * @param request - The request {@link GetConnectionRequest}
112
+ * @returns A Promise of Connection
113
+ */
114
+ getConnection = (request) => this.client.fetch({
115
+ method: "GET",
116
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}`
117
+ }, unmarshalConnection);
118
+ /**
119
+ * Create a connection.
120
+ *
121
+ * @param request - The request {@link CreateConnectionRequest}
122
+ * @returns A Promise of CreateConnectionResponse
123
+ */
124
+ createConnection = (request) => this.client.fetch({
125
+ body: JSON.stringify(marshalCreateConnectionRequest(request, this.client.settings)),
126
+ headers: jsonContentHeaders,
127
+ method: "POST",
128
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections`
129
+ }, unmarshalCreateConnectionResponse);
130
+ /**
131
+ * Update a connection. Update an existing connection, specified by its connection ID.
132
+ *
133
+ * @param request - The request {@link UpdateConnectionRequest}
134
+ * @returns A Promise of Connection
135
+ */
136
+ updateConnection = (request) => this.client.fetch({
137
+ body: JSON.stringify(marshalUpdateConnectionRequest(request, this.client.settings)),
138
+ headers: jsonContentHeaders,
139
+ method: "PATCH",
140
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}`
141
+ }, unmarshalConnection);
142
+ /**
143
+ * Delete a connection. Delete an existing connection, specified by its connection ID.
144
+ *
145
+ * @param request - The request {@link DeleteConnectionRequest}
146
+ */
147
+ deleteConnection = (request) => this.client.fetch({
148
+ method: "DELETE",
149
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}`
150
+ });
151
+ /**
152
+ * Renew pre-shared key. Renew pre-shared key for a given connection.
153
+ *
154
+ * @param request - The request {@link RenewConnectionPskRequest}
155
+ * @returns A Promise of RenewConnectionPskResponse
156
+ */
157
+ renewConnectionPsk = (request) => this.client.fetch({
158
+ body: "{}",
159
+ headers: jsonContentHeaders,
160
+ method: "POST",
161
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/renew-psk`
162
+ }, unmarshalRenewConnectionPskResponse);
163
+ /**
164
+ * Set a new routing policy. Set a new routing policy on a connection, overriding the existing one if present, specified by its connection ID.
165
+ *
166
+ * @param request - The request {@link SetRoutingPolicyRequest}
167
+ * @returns A Promise of Connection
168
+ */
169
+ setRoutingPolicy = (request) => this.client.fetch({
170
+ body: JSON.stringify(marshalSetRoutingPolicyRequest(request, this.client.settings)),
171
+ headers: jsonContentHeaders,
172
+ method: "POST",
173
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/set-routing-policy`
174
+ }, unmarshalConnection);
175
+ /**
176
+ * Detach a routing policy. Detach an existing routing policy from a connection, specified by its connection ID.
177
+ *
178
+ * @param request - The request {@link DetachRoutingPolicyRequest}
179
+ * @returns A Promise of Connection
180
+ */
181
+ detachRoutingPolicy = (request) => this.client.fetch({
182
+ body: JSON.stringify(marshalDetachRoutingPolicyRequest(request, this.client.settings)),
183
+ headers: jsonContentHeaders,
184
+ method: "POST",
185
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/detach-routing-policy`
186
+ }, unmarshalConnection);
187
+ /**
188
+ * Enable route propagation. Enable all allowed prefixes (defined in a routing policy) to be announced in the BGP session. This allows traffic to flow between the attached VPC and the on-premises infrastructure along the announced routes. Note that by default, even when route propagation is enabled, all routes are blocked. It is essential to attach a routing policy to define the ranges of routes to announce.
189
+ *
190
+ * @param request - The request {@link EnableRoutePropagationRequest}
191
+ * @returns A Promise of Connection
192
+ */
193
+ enableRoutePropagation = (request) => this.client.fetch({
194
+ body: "{}",
195
+ headers: jsonContentHeaders,
196
+ method: "POST",
197
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/enable-route-propagation`
198
+ }, unmarshalConnection);
199
+ /**
200
+ * Disable route propagation. Prevent any prefixes from being announced in the BGP session. Traffic will not be able to flow over the VPN Gateway until route propagation is re-enabled.
201
+ *
202
+ * @param request - The request {@link DisableRoutePropagationRequest}
203
+ * @returns A Promise of Connection
204
+ */
205
+ disableRoutePropagation = (request) => this.client.fetch({
206
+ body: "{}",
207
+ headers: jsonContentHeaders,
208
+ method: "POST",
209
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/connections/${validatePathParam("connectionId", request.connectionId)}/disable-route-propagation`
210
+ }, unmarshalConnection);
211
+ pageOfListCustomerGateways = (request = {}) => this.client.fetch({
212
+ method: "GET",
213
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways`,
214
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags])
215
+ }, unmarshalListCustomerGatewaysResponse);
216
+ /**
217
+ * List customer gateways. List all your customer gateways. A number of filters are available, including Project ID, name, and tags.
218
+ *
219
+ * @param request - The request {@link ListCustomerGatewaysRequest}
220
+ * @returns A Promise of ListCustomerGatewaysResponse
221
+ */
222
+ listCustomerGateways = (request = {}) => enrichForPagination("gateways", this.pageOfListCustomerGateways, request);
223
+ /**
224
+ * Get a customer gateway. Get a customer gateway for the given customer gateway ID.
225
+ *
226
+ * @param request - The request {@link GetCustomerGatewayRequest}
227
+ * @returns A Promise of CustomerGateway
228
+ */
229
+ getCustomerGateway = (request) => this.client.fetch({
230
+ method: "GET",
231
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
232
+ }, unmarshalCustomerGateway);
233
+ /**
234
+ * Create a customer gateway.
235
+ *
236
+ * @param request - The request {@link CreateCustomerGatewayRequest}
237
+ * @returns A Promise of CustomerGateway
238
+ */
239
+ createCustomerGateway = (request) => this.client.fetch({
240
+ body: JSON.stringify(marshalCreateCustomerGatewayRequest(request, this.client.settings)),
241
+ headers: jsonContentHeaders,
242
+ method: "POST",
243
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways`
244
+ }, unmarshalCustomerGateway);
245
+ /**
246
+ * Update a customer gateway. Update an existing customer gateway, specified by its customer gateway ID. You can update its name, tags, public IPv4 & IPv6 address and AS Number.
247
+ *
248
+ * @param request - The request {@link UpdateCustomerGatewayRequest}
249
+ * @returns A Promise of CustomerGateway
250
+ */
251
+ updateCustomerGateway = (request) => this.client.fetch({
252
+ body: JSON.stringify(marshalUpdateCustomerGatewayRequest(request, this.client.settings)),
253
+ headers: jsonContentHeaders,
254
+ method: "PATCH",
255
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
256
+ }, unmarshalCustomerGateway);
257
+ /**
258
+ * Delete a customer gateway. Delete an existing customer gateway, specified by its customer gateway ID.
259
+ *
260
+ * @param request - The request {@link DeleteCustomerGatewayRequest}
261
+ */
262
+ deleteCustomerGateway = (request) => this.client.fetch({
263
+ method: "DELETE",
264
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/customer-gateways/${validatePathParam("gatewayId", request.gatewayId)}`
265
+ });
266
+ pageOfListRoutingPolicies = (request = {}) => this.client.fetch({
267
+ method: "GET",
268
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies`,
269
+ urlParams: urlParams(["ipv6", request.ipv6], ["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags])
270
+ }, unmarshalListRoutingPoliciesResponse);
271
+ /**
272
+ * List routing policies. List all routing policies in a given region. A routing policy can be attached to one or multiple connections (S2S VPN connections).
273
+ *
274
+ * @param request - The request {@link ListRoutingPoliciesRequest}
275
+ * @returns A Promise of ListRoutingPoliciesResponse
276
+ */
277
+ listRoutingPolicies = (request = {}) => enrichForPagination("routingPolicies", this.pageOfListRoutingPolicies, request);
278
+ /**
279
+ * Get routing policy. Get a routing policy for the given routing policy ID. The response object gives information including the policy's name, tags and prefix filters.
280
+ *
281
+ * @param request - The request {@link GetRoutingPolicyRequest}
282
+ * @returns A Promise of RoutingPolicy
283
+ */
284
+ getRoutingPolicy = (request) => this.client.fetch({
285
+ method: "GET",
286
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
287
+ }, unmarshalRoutingPolicy);
288
+ /**
289
+ * Create a routing policy. Create a routing policy. Routing policies allow you to set IP prefix filters to define the incoming route announcements to accept from the customer gateway, and the outgoing routes to announce to the customer gateway.
290
+ *
291
+ * @param request - The request {@link CreateRoutingPolicyRequest}
292
+ * @returns A Promise of RoutingPolicy
293
+ */
294
+ createRoutingPolicy = (request) => this.client.fetch({
295
+ body: JSON.stringify(marshalCreateRoutingPolicyRequest(request, this.client.settings)),
296
+ headers: jsonContentHeaders,
297
+ method: "POST",
298
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies`
299
+ }, unmarshalRoutingPolicy);
300
+ /**
301
+ * Update a routing policy. Update an existing routing policy, specified by its routing policy ID. Its name, tags and incoming/outgoing prefix filters can be updated.
302
+ *
303
+ * @param request - The request {@link UpdateRoutingPolicyRequest}
304
+ * @returns A Promise of RoutingPolicy
305
+ */
306
+ updateRoutingPolicy = (request) => this.client.fetch({
307
+ body: JSON.stringify(marshalUpdateRoutingPolicyRequest(request, this.client.settings)),
308
+ headers: jsonContentHeaders,
309
+ method: "PATCH",
310
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
311
+ }, unmarshalRoutingPolicy);
312
+ /**
313
+ * Delete a routing policy. Delete an existing routing policy, specified by its routing policy ID.
314
+ *
315
+ * @param request - The request {@link DeleteRoutingPolicyRequest}
316
+ */
317
+ deleteRoutingPolicy = (request) => this.client.fetch({
318
+ method: "DELETE",
319
+ path: `/s2s-vpn/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
320
+ });
468
321
  };
322
+ export { API$1 as API };