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