@scaleway/sdk-lb 1.0.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.
@@ -0,0 +1,1874 @@
1
+ import { API as API$1, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
+ import { LB_TRANSIENT_STATUSES, CERTIFICATE_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { unmarshalListLbsResponse, marshalCreateLbRequest, unmarshalLb, marshalUpdateLbRequest, marshalMigrateLbRequest, unmarshalListIpsResponse, marshalCreateIpRequest, unmarshalIp, marshalUpdateIpRequest, unmarshalListBackendsResponse, marshalCreateBackendRequest, unmarshalBackend, marshalUpdateBackendRequest, marshalAddBackendServersRequest, marshalRemoveBackendServersRequest, marshalSetBackendServersRequest, marshalUpdateHealthCheckRequest, unmarshalHealthCheck, unmarshalListFrontendsResponse, marshalCreateFrontendRequest, unmarshalFrontend, marshalUpdateFrontendRequest, unmarshalListRoutesResponse, marshalCreateRouteRequest, unmarshalRoute, marshalUpdateRouteRequest, unmarshalLbStats, unmarshalListBackendStatsResponse, unmarshalListAclResponse, marshalCreateAclRequest, unmarshalAcl, marshalUpdateAclRequest, marshalCreateCertificateRequest, unmarshalCertificate, unmarshalListCertificatesResponse, marshalUpdateCertificateRequest, unmarshalListLbTypesResponse, marshalCreateSubscriberRequest, unmarshalSubscriber, unmarshalListSubscriberResponse, marshalUpdateSubscriberRequest, marshalSubscribeToLbRequest, unmarshalListLbPrivateNetworksResponse, marshalAttachPrivateNetworkRequest, unmarshalPrivateNetwork, marshalZonedApiCreateLbRequest, marshalZonedApiUpdateLbRequest, marshalZonedApiMigrateLbRequest, marshalZonedApiCreateIpRequest, marshalZonedApiUpdateIpRequest, marshalZonedApiCreateBackendRequest, marshalZonedApiUpdateBackendRequest, marshalZonedApiAddBackendServersRequest, marshalZonedApiRemoveBackendServersRequest, marshalZonedApiSetBackendServersRequest, marshalZonedApiUpdateHealthCheckRequest, marshalZonedApiCreateFrontendRequest, marshalZonedApiUpdateFrontendRequest, marshalZonedApiCreateRouteRequest, marshalZonedApiUpdateRouteRequest, marshalZonedApiCreateAclRequest, marshalZonedApiUpdateAclRequest, marshalZonedApiSetAclsRequest, unmarshalSetAclsResponse, marshalZonedApiCreateCertificateRequest, marshalZonedApiUpdateCertificateRequest, marshalZonedApiCreateSubscriberRequest, marshalZonedApiUpdateSubscriberRequest, marshalZonedApiSubscribeToLbRequest, marshalZonedApiAttachPrivateNetworkRequest, marshalZonedApiDetachPrivateNetworkRequest } from "./marshalling.gen.js";
4
+ const jsonContentHeaders = {
5
+ "Content-Type": "application/json; charset=utf-8"
6
+ };
7
+ class ZonedAPI extends API$1 {
8
+ /** Lists the available zones of the API. */
9
+ static LOCALITIES = [
10
+ "fr-par-1",
11
+ "fr-par-2",
12
+ "nl-ams-1",
13
+ "nl-ams-2",
14
+ "nl-ams-3",
15
+ "pl-waw-1",
16
+ "pl-waw-2",
17
+ "pl-waw-3"
18
+ ];
19
+ pageOfListLbs = (request = {}) => this.client.fetch(
20
+ {
21
+ method: "GET",
22
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs`,
23
+ urlParams: urlParams(
24
+ ["name", request.name],
25
+ ["order_by", request.orderBy],
26
+ ["organization_id", request.organizationId],
27
+ ["page", request.page],
28
+ [
29
+ "page_size",
30
+ request.pageSize ?? this.client.settings.defaultPageSize
31
+ ],
32
+ ["project_id", request.projectId],
33
+ ["tags", request.tags]
34
+ )
35
+ },
36
+ unmarshalListLbsResponse
37
+ );
38
+ /**
39
+ * List Load Balancers. List all Load Balancers in the specified zone, for a Scaleway Organization or Scaleway Project. By default, the Load Balancers returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
40
+ *
41
+ * @param request - The request {@link ZonedApiListLbsRequest}
42
+ * @returns A Promise of ListLbsResponse
43
+ */
44
+ listLbs = (request = {}) => enrichForPagination("lbs", this.pageOfListLbs, request);
45
+ /**
46
+ * Create a Load Balancer. Create a new Load Balancer. Note that the Load Balancer will be created without frontends or backends; these must be created separately via the dedicated endpoints.
47
+ *
48
+ * @param request - The request {@link ZonedApiCreateLbRequest}
49
+ * @returns A Promise of Lb
50
+ */
51
+ createLb = (request) => this.client.fetch(
52
+ {
53
+ body: JSON.stringify(
54
+ marshalZonedApiCreateLbRequest(request, this.client.settings)
55
+ ),
56
+ headers: jsonContentHeaders,
57
+ method: "POST",
58
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs`
59
+ },
60
+ unmarshalLb
61
+ );
62
+ /**
63
+ * Get a Load Balancer. Retrieve information about an existing Load Balancer, specified by its Load Balancer ID. Its full details, including name, status and IP address, are returned in the response object.
64
+ *
65
+ * @param request - The request {@link ZonedApiGetLbRequest}
66
+ * @returns A Promise of Lb
67
+ */
68
+ getLb = (request) => this.client.fetch(
69
+ {
70
+ method: "GET",
71
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}`
72
+ },
73
+ unmarshalLb
74
+ );
75
+ /**
76
+ * Waits for {@link Lb} to be in a final state.
77
+ *
78
+ * @param request - The request {@link ZonedApiGetLbRequest}
79
+ * @param options - The waiting options
80
+ * @returns A Promise of Lb
81
+ */
82
+ waitForLb = (request, options) => waitForResource(
83
+ options?.stop ?? ((res) => Promise.resolve(!LB_TRANSIENT_STATUSES.includes(res.status))),
84
+ this.getLb,
85
+ request,
86
+ options
87
+ );
88
+ /**
89
+ * Update a Load Balancer. Update the parameters of an existing Load Balancer, specified by its Load Balancer ID. Note that the request type is PUT and not PATCH. You must set all parameters.
90
+ *
91
+ * @param request - The request {@link ZonedApiUpdateLbRequest}
92
+ * @returns A Promise of Lb
93
+ */
94
+ updateLb = (request) => this.client.fetch(
95
+ {
96
+ body: JSON.stringify(
97
+ marshalZonedApiUpdateLbRequest(request, this.client.settings)
98
+ ),
99
+ headers: jsonContentHeaders,
100
+ method: "PUT",
101
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}`
102
+ },
103
+ unmarshalLb
104
+ );
105
+ /**
106
+ * Delete a Load Balancer. Delete an existing Load Balancer, specified by its Load Balancer ID. Deleting a Load Balancer is permanent, and cannot be undone. The Load Balancer's flexible IP address can either be deleted with the Load Balancer, or kept in your account for future use.
107
+ *
108
+ * @param request - The request {@link ZonedApiDeleteLbRequest}
109
+ */
110
+ deleteLb = (request) => this.client.fetch({
111
+ method: "DELETE",
112
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}`,
113
+ urlParams: urlParams(["release_ip", request.releaseIp])
114
+ });
115
+ /**
116
+ * Migrate a Load Balancer. Migrate an existing Load Balancer from one commercial type to another. Allows you to scale your Load Balancer up or down in terms of bandwidth or multi-cloud provision.
117
+ *
118
+ * @param request - The request {@link ZonedApiMigrateLbRequest}
119
+ * @returns A Promise of Lb
120
+ */
121
+ migrateLb = (request) => this.client.fetch(
122
+ {
123
+ body: JSON.stringify(
124
+ marshalZonedApiMigrateLbRequest(request, this.client.settings)
125
+ ),
126
+ headers: jsonContentHeaders,
127
+ method: "POST",
128
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/migrate`
129
+ },
130
+ unmarshalLb
131
+ );
132
+ pageOfListIPs = (request = {}) => this.client.fetch(
133
+ {
134
+ method: "GET",
135
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips`,
136
+ urlParams: urlParams(
137
+ ["ip_address", request.ipAddress],
138
+ ["ip_type", request.ipType],
139
+ ["organization_id", request.organizationId],
140
+ ["page", request.page],
141
+ [
142
+ "page_size",
143
+ request.pageSize ?? this.client.settings.defaultPageSize
144
+ ],
145
+ ["project_id", request.projectId],
146
+ ["tags", request.tags]
147
+ )
148
+ },
149
+ unmarshalListIpsResponse
150
+ );
151
+ /**
152
+ * List IP addresses. List the Load Balancer flexible IP addresses held in the account (filtered by Organization ID or Project ID). It is also possible to search for a specific IP address.
153
+ *
154
+ * @param request - The request {@link ZonedApiListIPsRequest}
155
+ * @returns A Promise of ListIpsResponse
156
+ */
157
+ listIPs = (request = {}) => enrichForPagination("ips", this.pageOfListIPs, request);
158
+ /**
159
+ * Create an IP address. Create a new Load Balancer flexible IP address, in the specified Scaleway Project. This can be attached to new Load Balancers created in the future.
160
+ *
161
+ * @param request - The request {@link ZonedApiCreateIpRequest}
162
+ * @returns A Promise of Ip
163
+ */
164
+ createIp = (request) => this.client.fetch(
165
+ {
166
+ body: JSON.stringify(
167
+ marshalZonedApiCreateIpRequest(request, this.client.settings)
168
+ ),
169
+ headers: jsonContentHeaders,
170
+ method: "POST",
171
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips`
172
+ },
173
+ unmarshalIp
174
+ );
175
+ /**
176
+ * Get an IP address. Retrieve the full details of a Load Balancer flexible IP address.
177
+ *
178
+ * @param request - The request {@link ZonedApiGetIpRequest}
179
+ * @returns A Promise of Ip
180
+ */
181
+ getIp = (request) => this.client.fetch(
182
+ {
183
+ method: "GET",
184
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam("ipId", request.ipId)}`
185
+ },
186
+ unmarshalIp
187
+ );
188
+ /**
189
+ * Delete an IP address. Delete a Load Balancer flexible IP address. This action is irreversible, and cannot be undone.
190
+ *
191
+ * @param request - The request {@link ZonedApiReleaseIpRequest}
192
+ */
193
+ releaseIp = (request) => this.client.fetch({
194
+ method: "DELETE",
195
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam("ipId", request.ipId)}`
196
+ });
197
+ /**
198
+ * Update an IP address. Update the reverse DNS of a Load Balancer flexible IP address.
199
+ *
200
+ * @param request - The request {@link ZonedApiUpdateIpRequest}
201
+ * @returns A Promise of Ip
202
+ */
203
+ updateIp = (request) => this.client.fetch(
204
+ {
205
+ body: JSON.stringify(
206
+ marshalZonedApiUpdateIpRequest(request, this.client.settings)
207
+ ),
208
+ headers: jsonContentHeaders,
209
+ method: "PATCH",
210
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam("ipId", request.ipId)}`
211
+ },
212
+ unmarshalIp
213
+ );
214
+ pageOfListBackends = (request) => this.client.fetch(
215
+ {
216
+ method: "GET",
217
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/backends`,
218
+ urlParams: urlParams(
219
+ ["name", request.name],
220
+ ["order_by", request.orderBy],
221
+ ["page", request.page],
222
+ [
223
+ "page_size",
224
+ request.pageSize ?? this.client.settings.defaultPageSize
225
+ ]
226
+ )
227
+ },
228
+ unmarshalListBackendsResponse
229
+ );
230
+ /**
231
+ * List the backends of a given Load Balancer. List all the backends of a Load Balancer, specified by its Load Balancer ID. By default, results are returned in ascending order by the creation date of each backend. The response is an array of backend objects, containing full details of each one including their configuration parameters such as protocol, port and forwarding algorithm.
232
+ *
233
+ * @param request - The request {@link ZonedApiListBackendsRequest}
234
+ * @returns A Promise of ListBackendsResponse
235
+ */
236
+ listBackends = (request) => enrichForPagination("backends", this.pageOfListBackends, request);
237
+ /**
238
+ * Create a backend for a given Load Balancer. Create a new backend for a given Load Balancer, specifying its full configuration including protocol, port and forwarding algorithm.
239
+ *
240
+ * @param request - The request {@link ZonedApiCreateBackendRequest}
241
+ * @returns A Promise of Backend
242
+ */
243
+ createBackend = (request) => this.client.fetch(
244
+ {
245
+ body: JSON.stringify(
246
+ marshalZonedApiCreateBackendRequest(request, this.client.settings)
247
+ ),
248
+ headers: jsonContentHeaders,
249
+ method: "POST",
250
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/backends`
251
+ },
252
+ unmarshalBackend
253
+ );
254
+ /**
255
+ * Get a backend of a given Load Balancer. Get the full details of a given backend, specified by its backend ID. The response contains the backend's full configuration parameters including protocol, port and forwarding algorithm.
256
+ *
257
+ * @param request - The request {@link ZonedApiGetBackendRequest}
258
+ * @returns A Promise of Backend
259
+ */
260
+ getBackend = (request) => this.client.fetch(
261
+ {
262
+ method: "GET",
263
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/backends/${validatePathParam("backendId", request.backendId)}`
264
+ },
265
+ unmarshalBackend
266
+ );
267
+ /**
268
+ * Update a backend of a given Load Balancer. Update a backend of a given Load Balancer, specified by its backend ID. Note that the request type is PUT and not PATCH. You must set all parameters.
269
+ *
270
+ * @param request - The request {@link ZonedApiUpdateBackendRequest}
271
+ * @returns A Promise of Backend
272
+ */
273
+ updateBackend = (request) => this.client.fetch(
274
+ {
275
+ body: JSON.stringify(
276
+ marshalZonedApiUpdateBackendRequest(request, this.client.settings)
277
+ ),
278
+ headers: jsonContentHeaders,
279
+ method: "PUT",
280
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/backends/${validatePathParam("backendId", request.backendId)}`
281
+ },
282
+ unmarshalBackend
283
+ );
284
+ /**
285
+ * Delete a backend of a given Load Balancer. Delete a backend of a given Load Balancer, specified by its backend ID. This action is irreversible and cannot be undone.
286
+ *
287
+ * @param request - The request {@link ZonedApiDeleteBackendRequest}
288
+ */
289
+ deleteBackend = (request) => this.client.fetch({
290
+ method: "DELETE",
291
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/backends/${validatePathParam("backendId", request.backendId)}`
292
+ });
293
+ /**
294
+ * Add a set of backend servers to a given backend. For a given backend specified by its backend ID, add a set of backend servers (identified by their IP addresses) it should forward traffic to. These will be appended to any existing set of backend servers for this backend.
295
+ *
296
+ * @param request - The request {@link ZonedApiAddBackendServersRequest}
297
+ * @returns A Promise of Backend
298
+ */
299
+ addBackendServers = (request) => this.client.fetch(
300
+ {
301
+ body: JSON.stringify(
302
+ marshalZonedApiAddBackendServersRequest(
303
+ request,
304
+ this.client.settings
305
+ )
306
+ ),
307
+ headers: jsonContentHeaders,
308
+ method: "POST",
309
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/backends/${validatePathParam("backendId", request.backendId)}/servers`
310
+ },
311
+ unmarshalBackend
312
+ );
313
+ /**
314
+ * Remove a set of servers for a given backend. For a given backend specified by its backend ID, remove the specified backend servers (identified by their IP addresses) so that it no longer forwards traffic to them.
315
+ *
316
+ * @param request - The request {@link ZonedApiRemoveBackendServersRequest}
317
+ * @returns A Promise of Backend
318
+ */
319
+ removeBackendServers = (request) => this.client.fetch(
320
+ {
321
+ body: JSON.stringify(
322
+ marshalZonedApiRemoveBackendServersRequest(
323
+ request,
324
+ this.client.settings
325
+ )
326
+ ),
327
+ headers: jsonContentHeaders,
328
+ method: "DELETE",
329
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/backends/${validatePathParam("backendId", request.backendId)}/servers`
330
+ },
331
+ unmarshalBackend
332
+ );
333
+ /**
334
+ * Define all backend servers for a given backend. For a given backend specified by its backend ID, define the set of backend servers (identified by their IP addresses) that it should forward traffic to. Any existing backend servers configured for this backend will be removed.
335
+ *
336
+ * @param request - The request {@link ZonedApiSetBackendServersRequest}
337
+ * @returns A Promise of Backend
338
+ */
339
+ setBackendServers = (request) => this.client.fetch(
340
+ {
341
+ body: JSON.stringify(
342
+ marshalZonedApiSetBackendServersRequest(
343
+ request,
344
+ this.client.settings
345
+ )
346
+ ),
347
+ headers: jsonContentHeaders,
348
+ method: "PUT",
349
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/backends/${validatePathParam("backendId", request.backendId)}/servers`
350
+ },
351
+ unmarshalBackend
352
+ );
353
+ /**
354
+ * Update a health check for a given backend. Update the configuration of the health check performed by a given backend to verify the health of its backend servers, identified by its backend ID. Note that the request type is PUT and not PATCH. You must set all parameters.
355
+ *
356
+ * @param request - The request {@link ZonedApiUpdateHealthCheckRequest}
357
+ * @returns A Promise of HealthCheck
358
+ */
359
+ updateHealthCheck = (request) => this.client.fetch(
360
+ {
361
+ body: JSON.stringify(
362
+ marshalZonedApiUpdateHealthCheckRequest(
363
+ request,
364
+ this.client.settings
365
+ )
366
+ ),
367
+ headers: jsonContentHeaders,
368
+ method: "PUT",
369
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/backends/${validatePathParam("backendId", request.backendId)}/healthcheck`
370
+ },
371
+ unmarshalHealthCheck
372
+ );
373
+ pageOfListFrontends = (request) => this.client.fetch(
374
+ {
375
+ method: "GET",
376
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/frontends`,
377
+ urlParams: urlParams(
378
+ ["name", request.name],
379
+ ["order_by", request.orderBy],
380
+ ["page", request.page],
381
+ [
382
+ "page_size",
383
+ request.pageSize ?? this.client.settings.defaultPageSize
384
+ ]
385
+ )
386
+ },
387
+ unmarshalListFrontendsResponse
388
+ );
389
+ /**
390
+ * List frontends of a given Load Balancer. List all the frontends of a Load Balancer, specified by its Load Balancer ID. By default, results are returned in ascending order by the creation date of each frontend. The response is an array of frontend objects, containing full details of each one including the port they listen on and the backend they are attached to.
391
+ *
392
+ * @param request - The request {@link ZonedApiListFrontendsRequest}
393
+ * @returns A Promise of ListFrontendsResponse
394
+ */
395
+ listFrontends = (request) => enrichForPagination("frontends", this.pageOfListFrontends, request);
396
+ /**
397
+ * Create a frontend in a given Load Balancer. Create a new frontend for a given Load Balancer, specifying its configuration including the port it should listen on and the backend to attach it to.
398
+ *
399
+ * @param request - The request {@link ZonedApiCreateFrontendRequest}
400
+ * @returns A Promise of Frontend
401
+ */
402
+ createFrontend = (request) => this.client.fetch(
403
+ {
404
+ body: JSON.stringify(
405
+ marshalZonedApiCreateFrontendRequest(request, this.client.settings)
406
+ ),
407
+ headers: jsonContentHeaders,
408
+ method: "POST",
409
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/frontends`
410
+ },
411
+ unmarshalFrontend
412
+ );
413
+ /**
414
+ * Get a frontend. Get the full details of a given frontend, specified by its frontend ID. The response contains the frontend's full configuration parameters including the backend it is attached to, the port it listens on, and any certificates it has.
415
+ *
416
+ * @param request - The request {@link ZonedApiGetFrontendRequest}
417
+ * @returns A Promise of Frontend
418
+ */
419
+ getFrontend = (request) => this.client.fetch(
420
+ {
421
+ method: "GET",
422
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/frontends/${validatePathParam("frontendId", request.frontendId)}`
423
+ },
424
+ unmarshalFrontend
425
+ );
426
+ /**
427
+ * Update a frontend. Update a given frontend, specified by its frontend ID. You can update configuration parameters including its name and the port it listens on. Note that the request type is PUT and not PATCH. You must set all parameters.
428
+ *
429
+ * @param request - The request {@link ZonedApiUpdateFrontendRequest}
430
+ * @returns A Promise of Frontend
431
+ */
432
+ updateFrontend = (request) => this.client.fetch(
433
+ {
434
+ body: JSON.stringify(
435
+ marshalZonedApiUpdateFrontendRequest(request, this.client.settings)
436
+ ),
437
+ headers: jsonContentHeaders,
438
+ method: "PUT",
439
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/frontends/${validatePathParam("frontendId", request.frontendId)}`
440
+ },
441
+ unmarshalFrontend
442
+ );
443
+ /**
444
+ * Delete a frontend. Delete a given frontend, specified by its frontend ID. This action is irreversible and cannot be undone.
445
+ *
446
+ * @param request - The request {@link ZonedApiDeleteFrontendRequest}
447
+ */
448
+ deleteFrontend = (request) => this.client.fetch({
449
+ method: "DELETE",
450
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/frontends/${validatePathParam("frontendId", request.frontendId)}`
451
+ });
452
+ pageOfListRoutes = (request = {}) => this.client.fetch(
453
+ {
454
+ method: "GET",
455
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/routes`,
456
+ urlParams: urlParams(
457
+ ["frontend_id", request.frontendId],
458
+ ["order_by", request.orderBy],
459
+ ["page", request.page],
460
+ [
461
+ "page_size",
462
+ request.pageSize ?? this.client.settings.defaultPageSize
463
+ ]
464
+ )
465
+ },
466
+ unmarshalListRoutesResponse
467
+ );
468
+ /**
469
+ * List all routes. List all routes for a given frontend. The response is an array of routes, each one with a specified backend to direct to if a certain condition is matched (based on the value of the SNI field or HTTP Host header).
470
+ *
471
+ * @param request - The request {@link ZonedApiListRoutesRequest}
472
+ * @returns A Promise of ListRoutesResponse
473
+ */
474
+ listRoutes = (request = {}) => enrichForPagination("routes", this.pageOfListRoutes, request);
475
+ /**
476
+ * Create a route. Create a new route on a given frontend. To configure a route, specify the backend to direct to if a certain condition is matched (based on the value of the SNI field or HTTP Host header).
477
+ *
478
+ * @param request - The request {@link ZonedApiCreateRouteRequest}
479
+ * @returns A Promise of Route
480
+ */
481
+ createRoute = (request) => this.client.fetch(
482
+ {
483
+ body: JSON.stringify(
484
+ marshalZonedApiCreateRouteRequest(request, this.client.settings)
485
+ ),
486
+ headers: jsonContentHeaders,
487
+ method: "POST",
488
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/routes`
489
+ },
490
+ unmarshalRoute
491
+ );
492
+ /**
493
+ * Get a route. Retrieve information about an existing route, specified by its route ID. Its full details, origin frontend, target backend and match condition, are returned in the response object.
494
+ *
495
+ * @param request - The request {@link ZonedApiGetRouteRequest}
496
+ * @returns A Promise of Route
497
+ */
498
+ getRoute = (request) => this.client.fetch(
499
+ {
500
+ method: "GET",
501
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/routes/${validatePathParam("routeId", request.routeId)}`
502
+ },
503
+ unmarshalRoute
504
+ );
505
+ /**
506
+ * Update a route. Update the configuration of an existing route, specified by its route ID.
507
+ *
508
+ * @param request - The request {@link ZonedApiUpdateRouteRequest}
509
+ * @returns A Promise of Route
510
+ */
511
+ updateRoute = (request) => this.client.fetch(
512
+ {
513
+ body: JSON.stringify(
514
+ marshalZonedApiUpdateRouteRequest(request, this.client.settings)
515
+ ),
516
+ headers: jsonContentHeaders,
517
+ method: "PUT",
518
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/routes/${validatePathParam("routeId", request.routeId)}`
519
+ },
520
+ unmarshalRoute
521
+ );
522
+ /**
523
+ * Delete a route. Delete an existing route, specified by its route ID. Deleting a route is permanent, and cannot be undone.
524
+ *
525
+ * @param request - The request {@link ZonedApiDeleteRouteRequest}
526
+ */
527
+ deleteRoute = (request) => this.client.fetch({
528
+ method: "DELETE",
529
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/routes/${validatePathParam("routeId", request.routeId)}`
530
+ });
531
+ /**
532
+ * Get usage statistics of a given Load Balancer.
533
+ *
534
+ * @deprecated
535
+ * @param request - The request {@link ZonedApiGetLbStatsRequest}
536
+ * @returns A Promise of LbStats
537
+ */
538
+ getLbStats = (request) => this.client.fetch(
539
+ {
540
+ method: "GET",
541
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/stats`,
542
+ urlParams: urlParams(["backend_id", request.backendId])
543
+ },
544
+ unmarshalLbStats
545
+ );
546
+ pageOfListBackendStats = (request) => this.client.fetch(
547
+ {
548
+ method: "GET",
549
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/backend-stats`,
550
+ urlParams: urlParams(
551
+ ["backend_id", request.backendId],
552
+ ["page", request.page],
553
+ [
554
+ "page_size",
555
+ request.pageSize ?? this.client.settings.defaultPageSize
556
+ ]
557
+ )
558
+ },
559
+ unmarshalListBackendStatsResponse
560
+ );
561
+ /**
562
+ * List backend server statistics. List information about your backend servers, including their state and the result of their last health check.
563
+ *
564
+ * @param request - The request {@link ZonedApiListBackendStatsRequest}
565
+ * @returns A Promise of ListBackendStatsResponse
566
+ */
567
+ listBackendStats = (request) => enrichForPagination(
568
+ "backendServersStats",
569
+ this.pageOfListBackendStats,
570
+ request
571
+ );
572
+ pageOfListAcls = (request) => this.client.fetch(
573
+ {
574
+ method: "GET",
575
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/frontends/${validatePathParam("frontendId", request.frontendId)}/acls`,
576
+ urlParams: urlParams(
577
+ ["name", request.name],
578
+ ["order_by", request.orderBy],
579
+ ["page", request.page],
580
+ [
581
+ "page_size",
582
+ request.pageSize ?? this.client.settings.defaultPageSize
583
+ ]
584
+ )
585
+ },
586
+ unmarshalListAclResponse
587
+ );
588
+ /**
589
+ * List ACLs for a given frontend. List the ACLs for a given frontend, specified by its frontend ID. The response is an array of ACL objects, each one representing an ACL that denies or allows traffic based on certain conditions.
590
+ *
591
+ * @param request - The request {@link ZonedApiListAclsRequest}
592
+ * @returns A Promise of ListAclResponse
593
+ */
594
+ listAcls = (request) => enrichForPagination("acls", this.pageOfListAcls, request);
595
+ /**
596
+ * Create an ACL for a given frontend. Create a new ACL for a given frontend. Each ACL must have a name, an action to perform (allow or deny), and a match rule (the action is carried out when the incoming traffic matches the rule).
597
+ *
598
+ * @param request - The request {@link ZonedApiCreateAclRequest}
599
+ * @returns A Promise of Acl
600
+ */
601
+ createAcl = (request) => this.client.fetch(
602
+ {
603
+ body: JSON.stringify(
604
+ marshalZonedApiCreateAclRequest(request, this.client.settings)
605
+ ),
606
+ headers: jsonContentHeaders,
607
+ method: "POST",
608
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/frontends/${validatePathParam("frontendId", request.frontendId)}/acls`
609
+ },
610
+ unmarshalAcl
611
+ );
612
+ /**
613
+ * Get an ACL. Get information for a particular ACL, specified by its ACL ID. The response returns full details of the ACL, including its name, action, match rule and frontend.
614
+ *
615
+ * @param request - The request {@link ZonedApiGetAclRequest}
616
+ * @returns A Promise of Acl
617
+ */
618
+ getAcl = (request) => this.client.fetch(
619
+ {
620
+ method: "GET",
621
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam("aclId", request.aclId)}`
622
+ },
623
+ unmarshalAcl
624
+ );
625
+ /**
626
+ * Update an ACL. Update a particular ACL, specified by its ACL ID. You can update details including its name, action and match rule.
627
+ *
628
+ * @param request - The request {@link ZonedApiUpdateAclRequest}
629
+ * @returns A Promise of Acl
630
+ */
631
+ updateAcl = (request) => this.client.fetch(
632
+ {
633
+ body: JSON.stringify(
634
+ marshalZonedApiUpdateAclRequest(request, this.client.settings)
635
+ ),
636
+ headers: jsonContentHeaders,
637
+ method: "PUT",
638
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam("aclId", request.aclId)}`
639
+ },
640
+ unmarshalAcl
641
+ );
642
+ /**
643
+ * Delete an ACL. Delete an ACL, specified by its ACL ID. Deleting an ACL is irreversible and cannot be undone.
644
+ *
645
+ * @param request - The request {@link ZonedApiDeleteAclRequest}
646
+ */
647
+ deleteAcl = (request) => this.client.fetch({
648
+ method: "DELETE",
649
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam("aclId", request.aclId)}`
650
+ });
651
+ /**
652
+ * Define all ACLs for a given frontend. For a given frontend specified by its frontend ID, define and add the complete set of ACLS for that frontend. Any existing ACLs on this frontend will be removed.
653
+ *
654
+ * @param request - The request {@link ZonedApiSetAclsRequest}
655
+ * @returns A Promise of SetAclsResponse
656
+ */
657
+ setAcls = (request) => this.client.fetch(
658
+ {
659
+ body: JSON.stringify(
660
+ marshalZonedApiSetAclsRequest(request, this.client.settings)
661
+ ),
662
+ headers: jsonContentHeaders,
663
+ method: "PUT",
664
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/frontends/${validatePathParam("frontendId", request.frontendId)}/acls`
665
+ },
666
+ unmarshalSetAclsResponse
667
+ );
668
+ /**
669
+ * Create an SSL/TLS certificate. Generate a new SSL/TLS certificate for a given Load Balancer. You can choose to create a Let's Encrypt certificate, or import a custom certificate.
670
+ *
671
+ * @param request - The request {@link ZonedApiCreateCertificateRequest}
672
+ * @returns A Promise of Certificate
673
+ */
674
+ createCertificate = (request) => this.client.fetch(
675
+ {
676
+ body: JSON.stringify(
677
+ marshalZonedApiCreateCertificateRequest(
678
+ request,
679
+ this.client.settings
680
+ )
681
+ ),
682
+ headers: jsonContentHeaders,
683
+ method: "POST",
684
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/certificates`
685
+ },
686
+ unmarshalCertificate
687
+ );
688
+ pageOfListCertificates = (request) => this.client.fetch(
689
+ {
690
+ method: "GET",
691
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/certificates`,
692
+ urlParams: urlParams(
693
+ ["name", request.name],
694
+ ["order_by", request.orderBy],
695
+ ["page", request.page],
696
+ [
697
+ "page_size",
698
+ request.pageSize ?? this.client.settings.defaultPageSize
699
+ ]
700
+ )
701
+ },
702
+ unmarshalListCertificatesResponse
703
+ );
704
+ /**
705
+ * List all SSL/TLS certificates on a given Load Balancer. List all the SSL/TLS certificates on a given Load Balancer. The response is an array of certificate objects, which are by default listed in ascending order of creation date.
706
+ *
707
+ * @param request - The request {@link ZonedApiListCertificatesRequest}
708
+ * @returns A Promise of ListCertificatesResponse
709
+ */
710
+ listCertificates = (request) => enrichForPagination("certificates", this.pageOfListCertificates, request);
711
+ /**
712
+ * Get an SSL/TLS certificate. Get information for a particular SSL/TLS certificate, specified by its certificate ID. The response returns full details of the certificate, including its type, main domain name, and alternative domain names.
713
+ *
714
+ * @param request - The request {@link ZonedApiGetCertificateRequest}
715
+ * @returns A Promise of Certificate
716
+ */
717
+ getCertificate = (request) => this.client.fetch(
718
+ {
719
+ method: "GET",
720
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/certificates/${validatePathParam("certificateId", request.certificateId)}`
721
+ },
722
+ unmarshalCertificate
723
+ );
724
+ /**
725
+ * Waits for {@link Certificate} to be in a final state.
726
+ *
727
+ * @param request - The request {@link ZonedApiGetCertificateRequest}
728
+ * @param options - The waiting options
729
+ * @returns A Promise of Certificate
730
+ */
731
+ waitForCertificate = (request, options) => waitForResource(
732
+ options?.stop ?? ((res) => Promise.resolve(
733
+ !CERTIFICATE_TRANSIENT_STATUSES.includes(res.status)
734
+ )),
735
+ this.getCertificate,
736
+ request,
737
+ options
738
+ );
739
+ /**
740
+ * Update an SSL/TLS certificate. Update the name of a particular SSL/TLS certificate, specified by its certificate ID.
741
+ *
742
+ * @param request - The request {@link ZonedApiUpdateCertificateRequest}
743
+ * @returns A Promise of Certificate
744
+ */
745
+ updateCertificate = (request) => this.client.fetch(
746
+ {
747
+ body: JSON.stringify(
748
+ marshalZonedApiUpdateCertificateRequest(
749
+ request,
750
+ this.client.settings
751
+ )
752
+ ),
753
+ headers: jsonContentHeaders,
754
+ method: "PUT",
755
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/certificates/${validatePathParam("certificateId", request.certificateId)}`
756
+ },
757
+ unmarshalCertificate
758
+ );
759
+ /**
760
+ * Delete an SSL/TLS certificate. Delete an SSL/TLS certificate, specified by its certificate ID. Deleting a certificate is irreversible and cannot be undone.
761
+ *
762
+ * @param request - The request {@link ZonedApiDeleteCertificateRequest}
763
+ */
764
+ deleteCertificate = (request) => this.client.fetch({
765
+ method: "DELETE",
766
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/certificates/${validatePathParam("certificateId", request.certificateId)}`
767
+ });
768
+ pageOfListLbTypes = (request = {}) => this.client.fetch(
769
+ {
770
+ method: "GET",
771
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lb-types`,
772
+ urlParams: urlParams(
773
+ ["page", request.page],
774
+ [
775
+ "page_size",
776
+ request.pageSize ?? this.client.settings.defaultPageSize
777
+ ]
778
+ )
779
+ },
780
+ unmarshalListLbTypesResponse
781
+ );
782
+ /**
783
+ * List all Load Balancer offer types. List all the different commercial Load Balancer types. The response includes an array of offer types, each with a name, description, and information about its stock availability.
784
+ *
785
+ * @param request - The request {@link ZonedApiListLbTypesRequest}
786
+ * @returns A Promise of ListLbTypesResponse
787
+ */
788
+ listLbTypes = (request = {}) => enrichForPagination("lbTypes", this.pageOfListLbTypes, request);
789
+ /**
790
+ * Create a subscriber. Create a new subscriber, either with an email configuration or a webhook configuration, for a specified Scaleway Project.
791
+ *
792
+ * @param request - The request {@link ZonedApiCreateSubscriberRequest}
793
+ * @returns A Promise of Subscriber
794
+ */
795
+ createSubscriber = (request) => this.client.fetch(
796
+ {
797
+ body: JSON.stringify(
798
+ marshalZonedApiCreateSubscriberRequest(request, this.client.settings)
799
+ ),
800
+ headers: jsonContentHeaders,
801
+ method: "POST",
802
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/subscribers`
803
+ },
804
+ unmarshalSubscriber
805
+ );
806
+ /**
807
+ * Get a subscriber. Retrieve information about an existing subscriber, specified by its subscriber ID. Its full details, including name and email/webhook configuration, are returned in the response object.
808
+ *
809
+ * @param request - The request {@link ZonedApiGetSubscriberRequest}
810
+ * @returns A Promise of Subscriber
811
+ */
812
+ getSubscriber = (request) => this.client.fetch(
813
+ {
814
+ method: "GET",
815
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/subscribers/${validatePathParam("subscriberId", request.subscriberId)}`
816
+ },
817
+ unmarshalSubscriber
818
+ );
819
+ pageOfListSubscriber = (request = {}) => this.client.fetch(
820
+ {
821
+ method: "GET",
822
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/subscribers`,
823
+ urlParams: urlParams(
824
+ ["name", request.name],
825
+ ["order_by", request.orderBy],
826
+ ["organization_id", request.organizationId],
827
+ ["page", request.page],
828
+ [
829
+ "page_size",
830
+ request.pageSize ?? this.client.settings.defaultPageSize
831
+ ],
832
+ ["project_id", request.projectId]
833
+ )
834
+ },
835
+ unmarshalListSubscriberResponse
836
+ );
837
+ /**
838
+ * List all subscribers. List all subscribers to Load Balancer alerts. By default, returns all subscribers to Load Balancer alerts for the Organization associated with the authentication token used for the request.
839
+ *
840
+ * @param request - The request {@link ZonedApiListSubscriberRequest}
841
+ * @returns A Promise of ListSubscriberResponse
842
+ */
843
+ listSubscriber = (request = {}) => enrichForPagination("subscribers", this.pageOfListSubscriber, request);
844
+ /**
845
+ * Update a subscriber. Update the parameters of a given subscriber (e.g. name, webhook configuration, email configuration), specified by its subscriber ID.
846
+ *
847
+ * @param request - The request {@link ZonedApiUpdateSubscriberRequest}
848
+ * @returns A Promise of Subscriber
849
+ */
850
+ updateSubscriber = (request) => this.client.fetch(
851
+ {
852
+ body: JSON.stringify(
853
+ marshalZonedApiUpdateSubscriberRequest(request, this.client.settings)
854
+ ),
855
+ headers: jsonContentHeaders,
856
+ method: "PUT",
857
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/subscribers/${validatePathParam("subscriberId", request.subscriberId)}`
858
+ },
859
+ unmarshalSubscriber
860
+ );
861
+ /**
862
+ * Delete a subscriber. Delete an existing subscriber, specified by its subscriber ID. Deleting a subscriber is permanent, and cannot be undone.
863
+ *
864
+ * @param request - The request {@link ZonedApiDeleteSubscriberRequest}
865
+ */
866
+ deleteSubscriber = (request) => this.client.fetch({
867
+ method: "DELETE",
868
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lb/subscription/${validatePathParam("subscriberId", request.subscriberId)}`
869
+ });
870
+ /**
871
+ * Subscribe a subscriber to alerts for a given Load Balancer. Subscribe an existing subscriber to alerts for a given Load Balancer.
872
+ *
873
+ * @param request - The request {@link ZonedApiSubscribeToLbRequest}
874
+ * @returns A Promise of Lb
875
+ */
876
+ subscribeToLb = (request) => this.client.fetch(
877
+ {
878
+ body: JSON.stringify(
879
+ marshalZonedApiSubscribeToLbRequest(request, this.client.settings)
880
+ ),
881
+ headers: jsonContentHeaders,
882
+ method: "POST",
883
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lb/${validatePathParam("lbId", request.lbId)}/subscribe`
884
+ },
885
+ unmarshalLb
886
+ );
887
+ /**
888
+ * Unsubscribe a subscriber from alerts for a given Load Balancer. Unsubscribe a subscriber from alerts for a given Load Balancer. The subscriber is not deleted, and can be resubscribed in the future if necessary.
889
+ *
890
+ * @param request - The request {@link ZonedApiUnsubscribeFromLbRequest}
891
+ * @returns A Promise of Lb
892
+ */
893
+ unsubscribeFromLb = (request) => this.client.fetch(
894
+ {
895
+ method: "DELETE",
896
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lb/${validatePathParam("lbId", request.lbId)}/unsubscribe`
897
+ },
898
+ unmarshalLb
899
+ );
900
+ pageOfListLbPrivateNetworks = (request) => this.client.fetch(
901
+ {
902
+ method: "GET",
903
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/private-networks`,
904
+ urlParams: urlParams(
905
+ ["order_by", request.orderBy],
906
+ ["page", request.page],
907
+ [
908
+ "page_size",
909
+ request.pageSize ?? this.client.settings.defaultPageSize
910
+ ]
911
+ )
912
+ },
913
+ unmarshalListLbPrivateNetworksResponse
914
+ );
915
+ /**
916
+ * List Private Networks attached to a Load Balancer. List the Private Networks attached to a given Load Balancer, specified by its Load Balancer ID. The response is an array of Private Network objects, giving information including the status, configuration, name and creation date of each Private Network.
917
+ *
918
+ * @param request - The request {@link ZonedApiListLbPrivateNetworksRequest}
919
+ * @returns A Promise of ListLbPrivateNetworksResponse
920
+ */
921
+ listLbPrivateNetworks = (request) => enrichForPagination(
922
+ "privateNetwork",
923
+ this.pageOfListLbPrivateNetworks,
924
+ request
925
+ );
926
+ /**
927
+ * Attach a Load Balancer to a Private Network. Attach a specified Load Balancer to a specified Private Network, defining a static or DHCP configuration for the Load Balancer on the network.
928
+ *
929
+ * @param request - The request {@link ZonedApiAttachPrivateNetworkRequest}
930
+ * @returns A Promise of PrivateNetwork
931
+ */
932
+ attachPrivateNetwork = (request) => this.client.fetch(
933
+ {
934
+ body: JSON.stringify(
935
+ marshalZonedApiAttachPrivateNetworkRequest(
936
+ request,
937
+ this.client.settings
938
+ )
939
+ ),
940
+ headers: jsonContentHeaders,
941
+ method: "POST",
942
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/attach-private-network`
943
+ },
944
+ unmarshalPrivateNetwork
945
+ );
946
+ /**
947
+ * Detach Load Balancer from Private Network. Detach a specified Load Balancer from a specified Private Network.
948
+ *
949
+ * @param request - The request {@link ZonedApiDetachPrivateNetworkRequest}
950
+ */
951
+ detachPrivateNetwork = (request) => this.client.fetch({
952
+ body: JSON.stringify(
953
+ marshalZonedApiDetachPrivateNetworkRequest(
954
+ request,
955
+ this.client.settings
956
+ )
957
+ ),
958
+ headers: jsonContentHeaders,
959
+ method: "POST",
960
+ path: `/lb/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/lbs/${validatePathParam("lbId", request.lbId)}/detach-private-network`
961
+ });
962
+ }
963
+ class API extends API$1 {
964
+ /** Lists the available regions of the API. */
965
+ static LOCALITIES = [
966
+ "fr-par",
967
+ "nl-ams",
968
+ "pl-waw"
969
+ ];
970
+ pageOfListLbs = (request = {}) => this.client.fetch(
971
+ {
972
+ method: "GET",
973
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs`,
974
+ urlParams: urlParams(
975
+ ["name", request.name],
976
+ ["order_by", request.orderBy],
977
+ ["organization_id", request.organizationId],
978
+ ["page", request.page],
979
+ [
980
+ "page_size",
981
+ request.pageSize ?? this.client.settings.defaultPageSize
982
+ ],
983
+ ["project_id", request.projectId],
984
+ ["tags", request.tags]
985
+ )
986
+ },
987
+ unmarshalListLbsResponse
988
+ );
989
+ /**
990
+ * List load balancers.
991
+ *
992
+ * @param request - The request {@link ListLbsRequest}
993
+ * @returns A Promise of ListLbsResponse
994
+ */
995
+ listLbs = (request = {}) => enrichForPagination("lbs", this.pageOfListLbs, request);
996
+ /**
997
+ * Create a load balancer.
998
+ *
999
+ * @param request - The request {@link CreateLbRequest}
1000
+ * @returns A Promise of Lb
1001
+ */
1002
+ createLb = (request) => this.client.fetch(
1003
+ {
1004
+ body: JSON.stringify(
1005
+ marshalCreateLbRequest(request, this.client.settings)
1006
+ ),
1007
+ headers: jsonContentHeaders,
1008
+ method: "POST",
1009
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs`
1010
+ },
1011
+ unmarshalLb
1012
+ );
1013
+ /**
1014
+ * Get a load balancer.
1015
+ *
1016
+ * @param request - The request {@link GetLbRequest}
1017
+ * @returns A Promise of Lb
1018
+ */
1019
+ getLb = (request) => this.client.fetch(
1020
+ {
1021
+ method: "GET",
1022
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}`
1023
+ },
1024
+ unmarshalLb
1025
+ );
1026
+ /**
1027
+ * Waits for {@link Lb} to be in a final state.
1028
+ *
1029
+ * @param request - The request {@link GetLbRequest}
1030
+ * @param options - The waiting options
1031
+ * @returns A Promise of Lb
1032
+ */
1033
+ waitForLb = (request, options) => waitForResource(
1034
+ options?.stop ?? ((res) => Promise.resolve(!LB_TRANSIENT_STATUSES.includes(res.status))),
1035
+ this.getLb,
1036
+ request,
1037
+ options
1038
+ );
1039
+ /**
1040
+ * Update a load balancer.
1041
+ *
1042
+ * @param request - The request {@link UpdateLbRequest}
1043
+ * @returns A Promise of Lb
1044
+ */
1045
+ updateLb = (request) => this.client.fetch(
1046
+ {
1047
+ body: JSON.stringify(
1048
+ marshalUpdateLbRequest(request, this.client.settings)
1049
+ ),
1050
+ headers: jsonContentHeaders,
1051
+ method: "PUT",
1052
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}`
1053
+ },
1054
+ unmarshalLb
1055
+ );
1056
+ /**
1057
+ * Delete a load balancer.
1058
+ *
1059
+ * @param request - The request {@link DeleteLbRequest}
1060
+ */
1061
+ deleteLb = (request) => this.client.fetch({
1062
+ method: "DELETE",
1063
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}`,
1064
+ urlParams: urlParams(["release_ip", request.releaseIp])
1065
+ });
1066
+ /**
1067
+ * Migrate a load balancer.
1068
+ *
1069
+ * @param request - The request {@link MigrateLbRequest}
1070
+ * @returns A Promise of Lb
1071
+ */
1072
+ migrateLb = (request) => this.client.fetch(
1073
+ {
1074
+ body: JSON.stringify(
1075
+ marshalMigrateLbRequest(request, this.client.settings)
1076
+ ),
1077
+ headers: jsonContentHeaders,
1078
+ method: "POST",
1079
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/migrate`
1080
+ },
1081
+ unmarshalLb
1082
+ );
1083
+ pageOfListIPs = (request = {}) => this.client.fetch(
1084
+ {
1085
+ method: "GET",
1086
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`,
1087
+ urlParams: urlParams(
1088
+ ["ip_address", request.ipAddress],
1089
+ ["ip_type", request.ipType],
1090
+ ["organization_id", request.organizationId],
1091
+ ["page", request.page],
1092
+ [
1093
+ "page_size",
1094
+ request.pageSize ?? this.client.settings.defaultPageSize
1095
+ ],
1096
+ ["project_id", request.projectId],
1097
+ ["tags", request.tags]
1098
+ )
1099
+ },
1100
+ unmarshalListIpsResponse
1101
+ );
1102
+ /**
1103
+ * List IPs.
1104
+ *
1105
+ * @param request - The request {@link ListIPsRequest}
1106
+ * @returns A Promise of ListIpsResponse
1107
+ */
1108
+ listIPs = (request = {}) => enrichForPagination("ips", this.pageOfListIPs, request);
1109
+ /**
1110
+ * Create an IP.
1111
+ *
1112
+ * @param request - The request {@link CreateIpRequest}
1113
+ * @returns A Promise of Ip
1114
+ */
1115
+ createIp = (request) => this.client.fetch(
1116
+ {
1117
+ body: JSON.stringify(
1118
+ marshalCreateIpRequest(request, this.client.settings)
1119
+ ),
1120
+ headers: jsonContentHeaders,
1121
+ method: "POST",
1122
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`
1123
+ },
1124
+ unmarshalIp
1125
+ );
1126
+ /**
1127
+ * Get an IP.
1128
+ *
1129
+ * @param request - The request {@link GetIpRequest}
1130
+ * @returns A Promise of Ip
1131
+ */
1132
+ getIp = (request) => this.client.fetch(
1133
+ {
1134
+ method: "GET",
1135
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
1136
+ },
1137
+ unmarshalIp
1138
+ );
1139
+ /**
1140
+ * Delete an IP.
1141
+ *
1142
+ * @param request - The request {@link ReleaseIpRequest}
1143
+ */
1144
+ releaseIp = (request) => this.client.fetch({
1145
+ method: "DELETE",
1146
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
1147
+ });
1148
+ /**
1149
+ * Update an IP.
1150
+ *
1151
+ * @param request - The request {@link UpdateIpRequest}
1152
+ * @returns A Promise of Ip
1153
+ */
1154
+ updateIp = (request) => this.client.fetch(
1155
+ {
1156
+ body: JSON.stringify(
1157
+ marshalUpdateIpRequest(request, this.client.settings)
1158
+ ),
1159
+ headers: jsonContentHeaders,
1160
+ method: "PATCH",
1161
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
1162
+ },
1163
+ unmarshalIp
1164
+ );
1165
+ pageOfListBackends = (request) => this.client.fetch(
1166
+ {
1167
+ method: "GET",
1168
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/backends`,
1169
+ urlParams: urlParams(
1170
+ ["name", request.name],
1171
+ ["order_by", request.orderBy],
1172
+ ["page", request.page],
1173
+ [
1174
+ "page_size",
1175
+ request.pageSize ?? this.client.settings.defaultPageSize
1176
+ ]
1177
+ )
1178
+ },
1179
+ unmarshalListBackendsResponse
1180
+ );
1181
+ /**
1182
+ * List backends in a given load balancer.
1183
+ *
1184
+ * @param request - The request {@link ListBackendsRequest}
1185
+ * @returns A Promise of ListBackendsResponse
1186
+ */
1187
+ listBackends = (request) => enrichForPagination("backends", this.pageOfListBackends, request);
1188
+ /**
1189
+ * Create a backend in a given load balancer.
1190
+ *
1191
+ * @param request - The request {@link CreateBackendRequest}
1192
+ * @returns A Promise of Backend
1193
+ */
1194
+ createBackend = (request) => this.client.fetch(
1195
+ {
1196
+ body: JSON.stringify(
1197
+ marshalCreateBackendRequest(request, this.client.settings)
1198
+ ),
1199
+ headers: jsonContentHeaders,
1200
+ method: "POST",
1201
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/backends`
1202
+ },
1203
+ unmarshalBackend
1204
+ );
1205
+ /**
1206
+ * Get a backend in a given load balancer.
1207
+ *
1208
+ * @param request - The request {@link GetBackendRequest}
1209
+ * @returns A Promise of Backend
1210
+ */
1211
+ getBackend = (request) => this.client.fetch(
1212
+ {
1213
+ method: "GET",
1214
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backends/${validatePathParam("backendId", request.backendId)}`
1215
+ },
1216
+ unmarshalBackend
1217
+ );
1218
+ /**
1219
+ * Update a backend in a given load balancer.
1220
+ *
1221
+ * @param request - The request {@link UpdateBackendRequest}
1222
+ * @returns A Promise of Backend
1223
+ */
1224
+ updateBackend = (request) => this.client.fetch(
1225
+ {
1226
+ body: JSON.stringify(
1227
+ marshalUpdateBackendRequest(request, this.client.settings)
1228
+ ),
1229
+ headers: jsonContentHeaders,
1230
+ method: "PUT",
1231
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backends/${validatePathParam("backendId", request.backendId)}`
1232
+ },
1233
+ unmarshalBackend
1234
+ );
1235
+ /**
1236
+ * Delete a backend in a given load balancer.
1237
+ *
1238
+ * @param request - The request {@link DeleteBackendRequest}
1239
+ */
1240
+ deleteBackend = (request) => this.client.fetch({
1241
+ method: "DELETE",
1242
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backends/${validatePathParam("backendId", request.backendId)}`
1243
+ });
1244
+ /**
1245
+ * Add a set of servers in a given backend.
1246
+ *
1247
+ * @param request - The request {@link AddBackendServersRequest}
1248
+ * @returns A Promise of Backend
1249
+ */
1250
+ addBackendServers = (request) => this.client.fetch(
1251
+ {
1252
+ body: JSON.stringify(
1253
+ marshalAddBackendServersRequest(request, this.client.settings)
1254
+ ),
1255
+ headers: jsonContentHeaders,
1256
+ method: "POST",
1257
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backends/${validatePathParam("backendId", request.backendId)}/servers`
1258
+ },
1259
+ unmarshalBackend
1260
+ );
1261
+ /**
1262
+ * Remove a set of servers for a given backend.
1263
+ *
1264
+ * @param request - The request {@link RemoveBackendServersRequest}
1265
+ * @returns A Promise of Backend
1266
+ */
1267
+ removeBackendServers = (request) => this.client.fetch(
1268
+ {
1269
+ body: JSON.stringify(
1270
+ marshalRemoveBackendServersRequest(request, this.client.settings)
1271
+ ),
1272
+ headers: jsonContentHeaders,
1273
+ method: "DELETE",
1274
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backends/${validatePathParam("backendId", request.backendId)}/servers`
1275
+ },
1276
+ unmarshalBackend
1277
+ );
1278
+ /**
1279
+ * Define all servers in a given backend.
1280
+ *
1281
+ * @param request - The request {@link SetBackendServersRequest}
1282
+ * @returns A Promise of Backend
1283
+ */
1284
+ setBackendServers = (request) => this.client.fetch(
1285
+ {
1286
+ body: JSON.stringify(
1287
+ marshalSetBackendServersRequest(request, this.client.settings)
1288
+ ),
1289
+ headers: jsonContentHeaders,
1290
+ method: "PUT",
1291
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backends/${validatePathParam("backendId", request.backendId)}/servers`
1292
+ },
1293
+ unmarshalBackend
1294
+ );
1295
+ /**
1296
+ * Update an health check for a given backend.
1297
+ *
1298
+ * @param request - The request {@link UpdateHealthCheckRequest}
1299
+ * @returns A Promise of HealthCheck
1300
+ */
1301
+ updateHealthCheck = (request) => this.client.fetch(
1302
+ {
1303
+ body: JSON.stringify(
1304
+ marshalUpdateHealthCheckRequest(request, this.client.settings)
1305
+ ),
1306
+ headers: jsonContentHeaders,
1307
+ method: "PUT",
1308
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backends/${validatePathParam("backendId", request.backendId)}/healthcheck`
1309
+ },
1310
+ unmarshalHealthCheck
1311
+ );
1312
+ pageOfListFrontends = (request) => this.client.fetch(
1313
+ {
1314
+ method: "GET",
1315
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/frontends`,
1316
+ urlParams: urlParams(
1317
+ ["name", request.name],
1318
+ ["order_by", request.orderBy],
1319
+ ["page", request.page],
1320
+ [
1321
+ "page_size",
1322
+ request.pageSize ?? this.client.settings.defaultPageSize
1323
+ ]
1324
+ )
1325
+ },
1326
+ unmarshalListFrontendsResponse
1327
+ );
1328
+ /**
1329
+ * List frontends in a given load balancer.
1330
+ *
1331
+ * @param request - The request {@link ListFrontendsRequest}
1332
+ * @returns A Promise of ListFrontendsResponse
1333
+ */
1334
+ listFrontends = (request) => enrichForPagination("frontends", this.pageOfListFrontends, request);
1335
+ /**
1336
+ * Create a frontend in a given load balancer.
1337
+ *
1338
+ * @param request - The request {@link CreateFrontendRequest}
1339
+ * @returns A Promise of Frontend
1340
+ */
1341
+ createFrontend = (request) => this.client.fetch(
1342
+ {
1343
+ body: JSON.stringify(
1344
+ marshalCreateFrontendRequest(request, this.client.settings)
1345
+ ),
1346
+ headers: jsonContentHeaders,
1347
+ method: "POST",
1348
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/frontends`
1349
+ },
1350
+ unmarshalFrontend
1351
+ );
1352
+ /**
1353
+ * Get a frontend.
1354
+ *
1355
+ * @param request - The request {@link GetFrontendRequest}
1356
+ * @returns A Promise of Frontend
1357
+ */
1358
+ getFrontend = (request) => this.client.fetch(
1359
+ {
1360
+ method: "GET",
1361
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/frontends/${validatePathParam("frontendId", request.frontendId)}`
1362
+ },
1363
+ unmarshalFrontend
1364
+ );
1365
+ /**
1366
+ * Update a frontend.
1367
+ *
1368
+ * @param request - The request {@link UpdateFrontendRequest}
1369
+ * @returns A Promise of Frontend
1370
+ */
1371
+ updateFrontend = (request) => this.client.fetch(
1372
+ {
1373
+ body: JSON.stringify(
1374
+ marshalUpdateFrontendRequest(request, this.client.settings)
1375
+ ),
1376
+ headers: jsonContentHeaders,
1377
+ method: "PUT",
1378
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/frontends/${validatePathParam("frontendId", request.frontendId)}`
1379
+ },
1380
+ unmarshalFrontend
1381
+ );
1382
+ /**
1383
+ * Delete a frontend.
1384
+ *
1385
+ * @param request - The request {@link DeleteFrontendRequest}
1386
+ */
1387
+ deleteFrontend = (request) => this.client.fetch({
1388
+ method: "DELETE",
1389
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/frontends/${validatePathParam("frontendId", request.frontendId)}`
1390
+ });
1391
+ pageOfListRoutes = (request = {}) => this.client.fetch(
1392
+ {
1393
+ method: "GET",
1394
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes`,
1395
+ urlParams: urlParams(
1396
+ ["frontend_id", request.frontendId],
1397
+ ["order_by", request.orderBy],
1398
+ ["page", request.page],
1399
+ [
1400
+ "page_size",
1401
+ request.pageSize ?? this.client.settings.defaultPageSize
1402
+ ]
1403
+ )
1404
+ },
1405
+ unmarshalListRoutesResponse
1406
+ );
1407
+ /**
1408
+ * List all backend redirections.
1409
+ *
1410
+ * @param request - The request {@link ListRoutesRequest}
1411
+ * @returns A Promise of ListRoutesResponse
1412
+ */
1413
+ listRoutes = (request = {}) => enrichForPagination("routes", this.pageOfListRoutes, request);
1414
+ /**
1415
+ * Create a backend redirection.
1416
+ *
1417
+ * @param request - The request {@link CreateRouteRequest}
1418
+ * @returns A Promise of Route
1419
+ */
1420
+ createRoute = (request) => this.client.fetch(
1421
+ {
1422
+ body: JSON.stringify(
1423
+ marshalCreateRouteRequest(request, this.client.settings)
1424
+ ),
1425
+ headers: jsonContentHeaders,
1426
+ method: "POST",
1427
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes`
1428
+ },
1429
+ unmarshalRoute
1430
+ );
1431
+ /**
1432
+ * Get single backend redirection.
1433
+ *
1434
+ * @param request - The request {@link GetRouteRequest}
1435
+ * @returns A Promise of Route
1436
+ */
1437
+ getRoute = (request) => this.client.fetch(
1438
+ {
1439
+ method: "GET",
1440
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
1441
+ },
1442
+ unmarshalRoute
1443
+ );
1444
+ /**
1445
+ * Edit a backend redirection.
1446
+ *
1447
+ * @param request - The request {@link UpdateRouteRequest}
1448
+ * @returns A Promise of Route
1449
+ */
1450
+ updateRoute = (request) => this.client.fetch(
1451
+ {
1452
+ body: JSON.stringify(
1453
+ marshalUpdateRouteRequest(request, this.client.settings)
1454
+ ),
1455
+ headers: jsonContentHeaders,
1456
+ method: "PUT",
1457
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
1458
+ },
1459
+ unmarshalRoute
1460
+ );
1461
+ /**
1462
+ * Delete a backend redirection.
1463
+ *
1464
+ * @param request - The request {@link DeleteRouteRequest}
1465
+ */
1466
+ deleteRoute = (request) => this.client.fetch({
1467
+ method: "DELETE",
1468
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam("routeId", request.routeId)}`
1469
+ });
1470
+ /**
1471
+ * Get usage statistics of a given load balancer.
1472
+ *
1473
+ * @deprecated
1474
+ * @param request - The request {@link GetLbStatsRequest}
1475
+ * @returns A Promise of LbStats
1476
+ */
1477
+ getLbStats = (request) => this.client.fetch(
1478
+ {
1479
+ method: "GET",
1480
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/stats`,
1481
+ urlParams: urlParams(["backend_id", request.backendId])
1482
+ },
1483
+ unmarshalLbStats
1484
+ );
1485
+ pageOfListBackendStats = (request) => this.client.fetch(
1486
+ {
1487
+ method: "GET",
1488
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/backend-stats`,
1489
+ urlParams: urlParams(
1490
+ ["backend_id", request.backendId],
1491
+ ["page", request.page],
1492
+ [
1493
+ "page_size",
1494
+ request.pageSize ?? this.client.settings.defaultPageSize
1495
+ ]
1496
+ )
1497
+ },
1498
+ unmarshalListBackendStatsResponse
1499
+ );
1500
+ /**
1501
+ * List backend server statistics.
1502
+ *
1503
+ * @param request - The request {@link ListBackendStatsRequest}
1504
+ * @returns A Promise of ListBackendStatsResponse
1505
+ */
1506
+ listBackendStats = (request) => enrichForPagination(
1507
+ "backendServersStats",
1508
+ this.pageOfListBackendStats,
1509
+ request
1510
+ );
1511
+ pageOfListAcls = (request) => this.client.fetch(
1512
+ {
1513
+ method: "GET",
1514
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/frontends/${validatePathParam("frontendId", request.frontendId)}/acls`,
1515
+ urlParams: urlParams(
1516
+ ["name", request.name],
1517
+ ["order_by", request.orderBy],
1518
+ ["page", request.page],
1519
+ [
1520
+ "page_size",
1521
+ request.pageSize ?? this.client.settings.defaultPageSize
1522
+ ]
1523
+ )
1524
+ },
1525
+ unmarshalListAclResponse
1526
+ );
1527
+ /**
1528
+ * List ACL for a given frontend.
1529
+ *
1530
+ * @param request - The request {@link ListAclsRequest}
1531
+ * @returns A Promise of ListAclResponse
1532
+ */
1533
+ listAcls = (request) => enrichForPagination("acls", this.pageOfListAcls, request);
1534
+ /**
1535
+ * Create an ACL for a given frontend.
1536
+ *
1537
+ * @param request - The request {@link CreateAclRequest}
1538
+ * @returns A Promise of Acl
1539
+ */
1540
+ createAcl = (request) => this.client.fetch(
1541
+ {
1542
+ body: JSON.stringify(
1543
+ marshalCreateAclRequest(request, this.client.settings)
1544
+ ),
1545
+ headers: jsonContentHeaders,
1546
+ method: "POST",
1547
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/frontends/${validatePathParam("frontendId", request.frontendId)}/acls`
1548
+ },
1549
+ unmarshalAcl
1550
+ );
1551
+ /**
1552
+ * Get an ACL.
1553
+ *
1554
+ * @param request - The request {@link GetAclRequest}
1555
+ * @returns A Promise of Acl
1556
+ */
1557
+ getAcl = (request) => this.client.fetch(
1558
+ {
1559
+ method: "GET",
1560
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
1561
+ },
1562
+ unmarshalAcl
1563
+ );
1564
+ /**
1565
+ * Update an ACL.
1566
+ *
1567
+ * @param request - The request {@link UpdateAclRequest}
1568
+ * @returns A Promise of Acl
1569
+ */
1570
+ updateAcl = (request) => this.client.fetch(
1571
+ {
1572
+ body: JSON.stringify(
1573
+ marshalUpdateAclRequest(request, this.client.settings)
1574
+ ),
1575
+ headers: jsonContentHeaders,
1576
+ method: "PUT",
1577
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
1578
+ },
1579
+ unmarshalAcl
1580
+ );
1581
+ /**
1582
+ * Delete an ACL.
1583
+ *
1584
+ * @param request - The request {@link DeleteAclRequest}
1585
+ */
1586
+ deleteAcl = (request) => this.client.fetch({
1587
+ method: "DELETE",
1588
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
1589
+ });
1590
+ /**
1591
+ * Create a TLS certificate. Generate a new TLS certificate using Let's Encrypt or import your certificate.
1592
+ *
1593
+ * @param request - The request {@link CreateCertificateRequest}
1594
+ * @returns A Promise of Certificate
1595
+ */
1596
+ createCertificate = (request) => this.client.fetch(
1597
+ {
1598
+ body: JSON.stringify(
1599
+ marshalCreateCertificateRequest(request, this.client.settings)
1600
+ ),
1601
+ headers: jsonContentHeaders,
1602
+ method: "POST",
1603
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/certificates`
1604
+ },
1605
+ unmarshalCertificate
1606
+ );
1607
+ pageOfListCertificates = (request) => this.client.fetch(
1608
+ {
1609
+ method: "GET",
1610
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/certificates`,
1611
+ urlParams: urlParams(
1612
+ ["name", request.name],
1613
+ ["order_by", request.orderBy],
1614
+ ["page", request.page],
1615
+ [
1616
+ "page_size",
1617
+ request.pageSize ?? this.client.settings.defaultPageSize
1618
+ ]
1619
+ )
1620
+ },
1621
+ unmarshalListCertificatesResponse
1622
+ );
1623
+ /**
1624
+ * List all TLS certificates on a given load balancer.
1625
+ *
1626
+ * @param request - The request {@link ListCertificatesRequest}
1627
+ * @returns A Promise of ListCertificatesResponse
1628
+ */
1629
+ listCertificates = (request) => enrichForPagination("certificates", this.pageOfListCertificates, request);
1630
+ /**
1631
+ * Get a TLS certificate.
1632
+ *
1633
+ * @param request - The request {@link GetCertificateRequest}
1634
+ * @returns A Promise of Certificate
1635
+ */
1636
+ getCertificate = (request) => this.client.fetch(
1637
+ {
1638
+ method: "GET",
1639
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/certificates/${validatePathParam("certificateId", request.certificateId)}`
1640
+ },
1641
+ unmarshalCertificate
1642
+ );
1643
+ /**
1644
+ * Waits for {@link Certificate} to be in a final state.
1645
+ *
1646
+ * @param request - The request {@link GetCertificateRequest}
1647
+ * @param options - The waiting options
1648
+ * @returns A Promise of Certificate
1649
+ */
1650
+ waitForCertificate = (request, options) => waitForResource(
1651
+ options?.stop ?? ((res) => Promise.resolve(
1652
+ !CERTIFICATE_TRANSIENT_STATUSES.includes(res.status)
1653
+ )),
1654
+ this.getCertificate,
1655
+ request,
1656
+ options
1657
+ );
1658
+ /**
1659
+ * Update a TLS certificate.
1660
+ *
1661
+ * @param request - The request {@link UpdateCertificateRequest}
1662
+ * @returns A Promise of Certificate
1663
+ */
1664
+ updateCertificate = (request) => this.client.fetch(
1665
+ {
1666
+ body: JSON.stringify(
1667
+ marshalUpdateCertificateRequest(request, this.client.settings)
1668
+ ),
1669
+ headers: jsonContentHeaders,
1670
+ method: "PUT",
1671
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/certificates/${validatePathParam("certificateId", request.certificateId)}`
1672
+ },
1673
+ unmarshalCertificate
1674
+ );
1675
+ /**
1676
+ * Delete a TLS certificate.
1677
+ *
1678
+ * @param request - The request {@link DeleteCertificateRequest}
1679
+ */
1680
+ deleteCertificate = (request) => this.client.fetch({
1681
+ method: "DELETE",
1682
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/certificates/${validatePathParam("certificateId", request.certificateId)}`
1683
+ });
1684
+ pageOfListLbTypes = (request = {}) => this.client.fetch(
1685
+ {
1686
+ method: "GET",
1687
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lb-types`,
1688
+ urlParams: urlParams(
1689
+ ["page", request.page],
1690
+ [
1691
+ "page_size",
1692
+ request.pageSize ?? this.client.settings.defaultPageSize
1693
+ ]
1694
+ )
1695
+ },
1696
+ unmarshalListLbTypesResponse
1697
+ );
1698
+ /**
1699
+ * List all load balancer offer type.
1700
+ *
1701
+ * @param request - The request {@link ListLbTypesRequest}
1702
+ * @returns A Promise of ListLbTypesResponse
1703
+ */
1704
+ listLbTypes = (request = {}) => enrichForPagination("lbTypes", this.pageOfListLbTypes, request);
1705
+ /**
1706
+ * Create a subscriber, webhook or email.
1707
+ *
1708
+ * @param request - The request {@link CreateSubscriberRequest}
1709
+ * @returns A Promise of Subscriber
1710
+ */
1711
+ createSubscriber = (request) => this.client.fetch(
1712
+ {
1713
+ body: JSON.stringify(
1714
+ marshalCreateSubscriberRequest(request, this.client.settings)
1715
+ ),
1716
+ headers: jsonContentHeaders,
1717
+ method: "POST",
1718
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/subscribers`
1719
+ },
1720
+ unmarshalSubscriber
1721
+ );
1722
+ /**
1723
+ * Get a subscriber.
1724
+ *
1725
+ * @param request - The request {@link GetSubscriberRequest}
1726
+ * @returns A Promise of Subscriber
1727
+ */
1728
+ getSubscriber = (request) => this.client.fetch(
1729
+ {
1730
+ method: "GET",
1731
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/subscribers/${validatePathParam("subscriberId", request.subscriberId)}`
1732
+ },
1733
+ unmarshalSubscriber
1734
+ );
1735
+ pageOfListSubscriber = (request = {}) => this.client.fetch(
1736
+ {
1737
+ method: "GET",
1738
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/subscribers`,
1739
+ urlParams: urlParams(
1740
+ ["name", request.name],
1741
+ ["order_by", request.orderBy],
1742
+ ["organization_id", request.organizationId],
1743
+ ["page", request.page],
1744
+ [
1745
+ "page_size",
1746
+ request.pageSize ?? this.client.settings.defaultPageSize
1747
+ ],
1748
+ ["project_id", request.projectId]
1749
+ )
1750
+ },
1751
+ unmarshalListSubscriberResponse
1752
+ );
1753
+ /**
1754
+ * List all subscriber.
1755
+ *
1756
+ * @param request - The request {@link ListSubscriberRequest}
1757
+ * @returns A Promise of ListSubscriberResponse
1758
+ */
1759
+ listSubscriber = (request = {}) => enrichForPagination("subscribers", this.pageOfListSubscriber, request);
1760
+ /**
1761
+ * Update a subscriber.
1762
+ *
1763
+ * @param request - The request {@link UpdateSubscriberRequest}
1764
+ * @returns A Promise of Subscriber
1765
+ */
1766
+ updateSubscriber = (request) => this.client.fetch(
1767
+ {
1768
+ body: JSON.stringify(
1769
+ marshalUpdateSubscriberRequest(request, this.client.settings)
1770
+ ),
1771
+ headers: jsonContentHeaders,
1772
+ method: "PUT",
1773
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/subscribers/${validatePathParam("subscriberId", request.subscriberId)}`
1774
+ },
1775
+ unmarshalSubscriber
1776
+ );
1777
+ /**
1778
+ * Delete a subscriber.
1779
+ *
1780
+ * @param request - The request {@link DeleteSubscriberRequest}
1781
+ */
1782
+ deleteSubscriber = (request) => this.client.fetch({
1783
+ method: "DELETE",
1784
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lb/subscriber/${validatePathParam("subscriberId", request.subscriberId)}`
1785
+ });
1786
+ /**
1787
+ * Subscribe a subscriber to a given load balancer.
1788
+ *
1789
+ * @param request - The request {@link SubscribeToLbRequest}
1790
+ * @returns A Promise of Lb
1791
+ */
1792
+ subscribeToLb = (request) => this.client.fetch(
1793
+ {
1794
+ body: JSON.stringify(
1795
+ marshalSubscribeToLbRequest(request, this.client.settings)
1796
+ ),
1797
+ headers: jsonContentHeaders,
1798
+ method: "POST",
1799
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lb/${validatePathParam("lbId", request.lbId)}/subscribe`
1800
+ },
1801
+ unmarshalLb
1802
+ );
1803
+ /**
1804
+ * Unsubscribe a subscriber from a given load balancer.
1805
+ *
1806
+ * @param request - The request {@link UnsubscribeFromLbRequest}
1807
+ * @returns A Promise of Lb
1808
+ */
1809
+ unsubscribeFromLb = (request) => this.client.fetch(
1810
+ {
1811
+ method: "DELETE",
1812
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lb/${validatePathParam("lbId", request.lbId)}/unsubscribe`
1813
+ },
1814
+ unmarshalLb
1815
+ );
1816
+ pageOfListLbPrivateNetworks = (request) => this.client.fetch(
1817
+ {
1818
+ method: "GET",
1819
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/private-networks`,
1820
+ urlParams: urlParams(
1821
+ ["order_by", request.orderBy],
1822
+ ["page", request.page],
1823
+ [
1824
+ "page_size",
1825
+ request.pageSize ?? this.client.settings.defaultPageSize
1826
+ ]
1827
+ )
1828
+ },
1829
+ unmarshalListLbPrivateNetworksResponse
1830
+ );
1831
+ /**
1832
+ * List attached private network of load balancer.
1833
+ *
1834
+ * @param request - The request {@link ListLbPrivateNetworksRequest}
1835
+ * @returns A Promise of ListLbPrivateNetworksResponse
1836
+ */
1837
+ listLbPrivateNetworks = (request) => enrichForPagination(
1838
+ "privateNetwork",
1839
+ this.pageOfListLbPrivateNetworks,
1840
+ request
1841
+ );
1842
+ /**
1843
+ * Add load balancer on instance private network.
1844
+ *
1845
+ * @param request - The request {@link AttachPrivateNetworkRequest}
1846
+ * @returns A Promise of PrivateNetwork
1847
+ */
1848
+ attachPrivateNetwork = (request) => this.client.fetch(
1849
+ {
1850
+ body: JSON.stringify(
1851
+ marshalAttachPrivateNetworkRequest(request, this.client.settings)
1852
+ ),
1853
+ headers: jsonContentHeaders,
1854
+ method: "POST",
1855
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/private-networks/${validatePathParam("privateNetworkId", request.privateNetworkId)}/attach`
1856
+ },
1857
+ unmarshalPrivateNetwork
1858
+ );
1859
+ /**
1860
+ * Remove load balancer of private network.
1861
+ *
1862
+ * @param request - The request {@link DetachPrivateNetworkRequest}
1863
+ */
1864
+ detachPrivateNetwork = (request) => this.client.fetch({
1865
+ body: "{}",
1866
+ headers: jsonContentHeaders,
1867
+ method: "POST",
1868
+ path: `/lb/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/lbs/${validatePathParam("lbId", request.lbId)}/private-networks/${validatePathParam("privateNetworkId", request.privateNetworkId)}/detach`
1869
+ });
1870
+ }
1871
+ export {
1872
+ API,
1873
+ ZonedAPI
1874
+ };