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