@scaleway/sdk-edge-services 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,872 @@
1
+ import { API as API$1, urlParams, enrichForPagination, validatePathParam, waitForResource } from "@scaleway/sdk-client";
2
+ import { PIPELINE_TRANSIENT_STATUSES, PURGE_REQUEST_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { unmarshalListPipelinesResponse, marshalCreatePipelineRequest, unmarshalPipeline, unmarshalListPipelinesWithStagesResponse, marshalUpdatePipelineRequest, unmarshalListHeadStagesResponse, marshalSetHeadStageRequest, unmarshalHeadStageResponse, unmarshalListDNSStagesResponse, marshalCreateDNSStageRequest, unmarshalDNSStage, marshalUpdateDNSStageRequest, unmarshalListTLSStagesResponse, marshalCreateTLSStageRequest, unmarshalTLSStage, marshalUpdateTLSStageRequest, unmarshalListCacheStagesResponse, marshalCreateCacheStageRequest, unmarshalCacheStage, marshalUpdateCacheStageRequest, unmarshalListBackendStagesResponse, marshalCreateBackendStageRequest, unmarshalBackendStage, marshalUpdateBackendStageRequest, unmarshalListWafStagesResponse, marshalCreateWafStageRequest, unmarshalWafStage, marshalUpdateWafStageRequest, unmarshalListRouteStagesResponse, marshalCreateRouteStageRequest, unmarshalRouteStage, marshalUpdateRouteStageRequest, unmarshalListRouteRulesResponse, marshalSetRouteRulesRequest, unmarshalSetRouteRulesResponse, marshalAddRouteRulesRequest, unmarshalAddRouteRulesResponse, marshalCheckDomainRequest, unmarshalCheckDomainResponse, marshalCheckPEMChainRequest, unmarshalCheckPEMChainResponse, unmarshalListPurgeRequestsResponse, marshalCreatePurgeRequestRequest, unmarshalPurgeRequest, marshalCheckLbOriginRequest, unmarshalCheckLbOriginResponse, unmarshalListPlansResponse, marshalSelectPlanRequest, unmarshalPlan, unmarshalGetBillingResponse } from "./marshalling.gen.js";
4
+ const jsonContentHeaders = {
5
+ "Content-Type": "application/json; charset=utf-8"
6
+ };
7
+ class API extends API$1 {
8
+ pageOfListPipelines = (request = {}) => this.client.fetch(
9
+ {
10
+ method: "GET",
11
+ path: `/edge-services/v1beta1/pipelines`,
12
+ urlParams: urlParams(
13
+ ["has_backend_stage_lb", request.hasBackendStageLb],
14
+ ["name", request.name],
15
+ ["order_by", request.orderBy],
16
+ ["organization_id", request.organizationId],
17
+ ["page", request.page],
18
+ [
19
+ "page_size",
20
+ request.pageSize ?? this.client.settings.defaultPageSize
21
+ ],
22
+ ["project_id", request.projectId]
23
+ )
24
+ },
25
+ unmarshalListPipelinesResponse
26
+ );
27
+ /**
28
+ * List pipelines. List all pipelines, for a Scaleway Organization or Scaleway Project. By default, the pipelines returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
29
+ *
30
+ * @param request - The request {@link ListPipelinesRequest}
31
+ * @returns A Promise of ListPipelinesResponse
32
+ */
33
+ listPipelines = (request = {}) => enrichForPagination("pipelines", this.pageOfListPipelines, request);
34
+ /**
35
+ * Create pipeline. Create a new pipeline. You must specify a `dns_stage_id` to form a stage-chain that goes all the way to the backend stage (origin), so the HTTP request will be processed according to the stages you created.
36
+ *
37
+ * @param request - The request {@link CreatePipelineRequest}
38
+ * @returns A Promise of Pipeline
39
+ */
40
+ createPipeline = (request) => this.client.fetch(
41
+ {
42
+ body: JSON.stringify(
43
+ marshalCreatePipelineRequest(request, this.client.settings)
44
+ ),
45
+ headers: jsonContentHeaders,
46
+ method: "POST",
47
+ path: `/edge-services/v1beta1/pipelines`
48
+ },
49
+ unmarshalPipeline
50
+ );
51
+ /**
52
+ * Get pipeline. Retrieve information about an existing pipeline, specified by its `pipeline_id`. Its full details, including errors, are returned in the response object.
53
+ *
54
+ * @param request - The request {@link GetPipelineRequest}
55
+ * @returns A Promise of Pipeline
56
+ */
57
+ getPipeline = (request) => this.client.fetch(
58
+ {
59
+ method: "GET",
60
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}`
61
+ },
62
+ unmarshalPipeline
63
+ );
64
+ /**
65
+ * Waits for {@link Pipeline} to be in a final state.
66
+ *
67
+ * @param request - The request {@link GetPipelineRequest}
68
+ * @param options - The waiting options
69
+ * @returns A Promise of Pipeline
70
+ */
71
+ waitForPipeline = (request, options) => waitForResource(
72
+ options?.stop ?? ((res) => Promise.resolve(
73
+ !PIPELINE_TRANSIENT_STATUSES.includes(res.status)
74
+ )),
75
+ this.getPipeline,
76
+ request,
77
+ options
78
+ );
79
+ pageOfListPipelinesWithStages = (request = {}) => this.client.fetch(
80
+ {
81
+ method: "GET",
82
+ path: `/edge-services/v1beta1/pipelines-stages`,
83
+ urlParams: urlParams(
84
+ ["name", request.name],
85
+ ["order_by", request.orderBy],
86
+ ["organization_id", request.organizationId],
87
+ ["page", request.page],
88
+ [
89
+ "page_size",
90
+ request.pageSize ?? this.client.settings.defaultPageSize
91
+ ],
92
+ ["project_id", request.projectId]
93
+ )
94
+ },
95
+ unmarshalListPipelinesWithStagesResponse
96
+ );
97
+ listPipelinesWithStages = (request = {}) => enrichForPagination(
98
+ "pipelines",
99
+ this.pageOfListPipelinesWithStages,
100
+ request
101
+ );
102
+ /**
103
+ * Update pipeline. Update the parameters of an existing pipeline, specified by its `pipeline_id`. Parameters which can be updated include the `name`, `description` and `dns_stage_id`.
104
+ *
105
+ * @param request - The request {@link UpdatePipelineRequest}
106
+ * @returns A Promise of Pipeline
107
+ */
108
+ updatePipeline = (request) => this.client.fetch(
109
+ {
110
+ body: JSON.stringify(
111
+ marshalUpdatePipelineRequest(request, this.client.settings)
112
+ ),
113
+ headers: jsonContentHeaders,
114
+ method: "PATCH",
115
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}`
116
+ },
117
+ unmarshalPipeline
118
+ );
119
+ /**
120
+ * Delete pipeline. Delete an existing pipeline, specified by its `pipeline_id`. Deleting a pipeline is permanent, and cannot be undone. Note that all stages linked to the pipeline are also deleted.
121
+ *
122
+ * @param request - The request {@link DeletePipelineRequest}
123
+ */
124
+ deletePipeline = (request) => this.client.fetch({
125
+ method: "DELETE",
126
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}`
127
+ });
128
+ pageOfListHeadStages = (request) => this.client.fetch(
129
+ {
130
+ method: "GET",
131
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/head-stages`,
132
+ urlParams: urlParams(
133
+ ["page", request.page],
134
+ [
135
+ "page_size",
136
+ request.pageSize ?? this.client.settings.defaultPageSize
137
+ ]
138
+ )
139
+ },
140
+ unmarshalListHeadStagesResponse
141
+ );
142
+ listHeadStages = (request) => enrichForPagination("headStages", this.pageOfListHeadStages, request);
143
+ /**
144
+ * Configure a entry point to your pipeline. You must specify a `head stage` to form a stage-chain that goes all the way to the backend stage (origin), so the HTTP request will be processed according to the stages you created.. You must specify either a `add_new_head_stage` (to add a new head stage), `remove_head_stage` (to remove a head stage) or `swap_head_stage` (to replace a head stage).
145
+ *
146
+ * @param request - The request {@link SetHeadStageRequest}
147
+ * @returns A Promise of HeadStageResponse
148
+ */
149
+ setHeadStage = (request) => this.client.fetch(
150
+ {
151
+ body: JSON.stringify(
152
+ marshalSetHeadStageRequest(request, this.client.settings)
153
+ ),
154
+ headers: jsonContentHeaders,
155
+ method: "POST",
156
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/set-head-stage`
157
+ },
158
+ unmarshalHeadStageResponse
159
+ );
160
+ pageOfListDNSStages = (request) => this.client.fetch(
161
+ {
162
+ method: "GET",
163
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/dns-stages`,
164
+ urlParams: urlParams(
165
+ ["fqdn", request.fqdn],
166
+ ["order_by", request.orderBy],
167
+ ["page", request.page],
168
+ [
169
+ "page_size",
170
+ request.pageSize ?? this.client.settings.defaultPageSize
171
+ ]
172
+ )
173
+ },
174
+ unmarshalListDNSStagesResponse
175
+ );
176
+ /**
177
+ * List DNS stages. List all DNS stages, for a Scaleway Organization or Scaleway Project. By default, the DNS stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
178
+ *
179
+ * @param request - The request {@link ListDNSStagesRequest}
180
+ * @returns A Promise of ListDNSStagesResponse
181
+ */
182
+ listDNSStages = (request) => enrichForPagination("stages", this.pageOfListDNSStages, request);
183
+ /**
184
+ * Create DNS stage. Create a new DNS stage. You must specify the `fqdns` field to customize the domain endpoint, using a domain you already own.
185
+ *
186
+ * @param request - The request {@link CreateDNSStageRequest}
187
+ * @returns A Promise of DNSStage
188
+ */
189
+ createDNSStage = (request) => this.client.fetch(
190
+ {
191
+ body: JSON.stringify(
192
+ marshalCreateDNSStageRequest(request, this.client.settings)
193
+ ),
194
+ headers: jsonContentHeaders,
195
+ method: "POST",
196
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/dns-stages`
197
+ },
198
+ unmarshalDNSStage
199
+ );
200
+ /**
201
+ * Get DNS stage. Retrieve information about an existing DNS stage, specified by its `dns_stage_id`. Its full details, including FQDNs, are returned in the response object.
202
+ *
203
+ * @param request - The request {@link GetDNSStageRequest}
204
+ * @returns A Promise of DNSStage
205
+ */
206
+ getDNSStage = (request) => this.client.fetch(
207
+ {
208
+ method: "GET",
209
+ path: `/edge-services/v1beta1/dns-stages/${validatePathParam("dnsStageId", request.dnsStageId)}`
210
+ },
211
+ unmarshalDNSStage
212
+ );
213
+ /**
214
+ * Update DNS stage. Update the parameters of an existing DNS stage, specified by its `dns_stage_id`.
215
+ *
216
+ * @param request - The request {@link UpdateDNSStageRequest}
217
+ * @returns A Promise of DNSStage
218
+ */
219
+ updateDNSStage = (request) => this.client.fetch(
220
+ {
221
+ body: JSON.stringify(
222
+ marshalUpdateDNSStageRequest(request, this.client.settings)
223
+ ),
224
+ headers: jsonContentHeaders,
225
+ method: "PATCH",
226
+ path: `/edge-services/v1beta1/dns-stages/${validatePathParam("dnsStageId", request.dnsStageId)}`
227
+ },
228
+ unmarshalDNSStage
229
+ );
230
+ /**
231
+ * Delete DNS stage. Delete an existing DNS stage, specified by its `dns_stage_id`. Deleting a DNS stage is permanent, and cannot be undone.
232
+ *
233
+ * @param request - The request {@link DeleteDNSStageRequest}
234
+ */
235
+ deleteDNSStage = (request) => this.client.fetch({
236
+ method: "DELETE",
237
+ path: `/edge-services/v1beta1/dns-stages/${validatePathParam("dnsStageId", request.dnsStageId)}`
238
+ });
239
+ pageOfListTLSStages = (request) => this.client.fetch(
240
+ {
241
+ method: "GET",
242
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/tls-stages`,
243
+ urlParams: urlParams(
244
+ ["order_by", request.orderBy],
245
+ ["page", request.page],
246
+ [
247
+ "page_size",
248
+ request.pageSize ?? this.client.settings.defaultPageSize
249
+ ],
250
+ ["secret_id", request.secretId],
251
+ ["secret_region", request.secretRegion]
252
+ )
253
+ },
254
+ unmarshalListTLSStagesResponse
255
+ );
256
+ /**
257
+ * List TLS stages. List all TLS stages, for a Scaleway Organization or Scaleway Project. By default, the TLS stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
258
+ *
259
+ * @param request - The request {@link ListTLSStagesRequest}
260
+ * @returns A Promise of ListTLSStagesResponse
261
+ */
262
+ listTLSStages = (request) => enrichForPagination("stages", this.pageOfListTLSStages, request);
263
+ /**
264
+ * Create TLS stage. Create a new TLS stage. You must specify either the `secrets` or `managed_certificate` fields to customize the SSL/TLS certificate of your endpoint. Choose `secrets` if you are using a pre-existing certificate held in Scaleway Secret Manager, or `managed_certificate` to let Scaleway generate and manage a Let's Encrypt certificate for your customized endpoint.
265
+ *
266
+ * @param request - The request {@link CreateTLSStageRequest}
267
+ * @returns A Promise of TLSStage
268
+ */
269
+ createTLSStage = (request) => this.client.fetch(
270
+ {
271
+ body: JSON.stringify(
272
+ marshalCreateTLSStageRequest(request, this.client.settings)
273
+ ),
274
+ headers: jsonContentHeaders,
275
+ method: "POST",
276
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/tls-stages`
277
+ },
278
+ unmarshalTLSStage
279
+ );
280
+ /**
281
+ * Get TLS stage. Retrieve information about an existing TLS stage, specified by its `tls_stage_id`. Its full details, including secrets and certificate expiration date are returned in the response object.
282
+ *
283
+ * @param request - The request {@link GetTLSStageRequest}
284
+ * @returns A Promise of TLSStage
285
+ */
286
+ getTLSStage = (request) => this.client.fetch(
287
+ {
288
+ method: "GET",
289
+ path: `/edge-services/v1beta1/tls-stages/${validatePathParam("tlsStageId", request.tlsStageId)}`
290
+ },
291
+ unmarshalTLSStage
292
+ );
293
+ /**
294
+ * Update TLS stage. Update the parameters of an existing TLS stage, specified by its `tls_stage_id`. Both `tls_secrets_config` and `managed_certificate` parameters can be updated.
295
+ *
296
+ * @param request - The request {@link UpdateTLSStageRequest}
297
+ * @returns A Promise of TLSStage
298
+ */
299
+ updateTLSStage = (request) => this.client.fetch(
300
+ {
301
+ body: JSON.stringify(
302
+ marshalUpdateTLSStageRequest(request, this.client.settings)
303
+ ),
304
+ headers: jsonContentHeaders,
305
+ method: "PATCH",
306
+ path: `/edge-services/v1beta1/tls-stages/${validatePathParam("tlsStageId", request.tlsStageId)}`
307
+ },
308
+ unmarshalTLSStage
309
+ );
310
+ /**
311
+ * Delete TLS stage. Delete an existing TLS stage, specified by its `tls_stage_id`. Deleting a TLS stage is permanent, and cannot be undone.
312
+ *
313
+ * @param request - The request {@link DeleteTLSStageRequest}
314
+ */
315
+ deleteTLSStage = (request) => this.client.fetch({
316
+ method: "DELETE",
317
+ path: `/edge-services/v1beta1/tls-stages/${validatePathParam("tlsStageId", request.tlsStageId)}`
318
+ });
319
+ pageOfListCacheStages = (request) => this.client.fetch(
320
+ {
321
+ method: "GET",
322
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/cache-stages`,
323
+ urlParams: urlParams(
324
+ ["order_by", request.orderBy],
325
+ ["page", request.page],
326
+ [
327
+ "page_size",
328
+ request.pageSize ?? this.client.settings.defaultPageSize
329
+ ]
330
+ )
331
+ },
332
+ unmarshalListCacheStagesResponse
333
+ );
334
+ /**
335
+ * List cache stages. List all cache stages, for a Scaleway Organization or Scaleway Project. By default, the cache stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
336
+ *
337
+ * @param request - The request {@link ListCacheStagesRequest}
338
+ * @returns A Promise of ListCacheStagesResponse
339
+ */
340
+ listCacheStages = (request) => enrichForPagination("stages", this.pageOfListCacheStages, request);
341
+ /**
342
+ * Create cache stage. Create a new cache stage. You must specify the `fallback_ttl` field to customize the TTL of the cache.
343
+ *
344
+ * @param request - The request {@link CreateCacheStageRequest}
345
+ * @returns A Promise of CacheStage
346
+ */
347
+ createCacheStage = (request) => this.client.fetch(
348
+ {
349
+ body: JSON.stringify(
350
+ marshalCreateCacheStageRequest(request, this.client.settings)
351
+ ),
352
+ headers: jsonContentHeaders,
353
+ method: "POST",
354
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/cache-stages`
355
+ },
356
+ unmarshalCacheStage
357
+ );
358
+ /**
359
+ * Get cache stage. Retrieve information about an existing cache stage, specified by its `cache_stage_id`. Its full details, including Time To Live (TTL), are returned in the response object.
360
+ *
361
+ * @param request - The request {@link GetCacheStageRequest}
362
+ * @returns A Promise of CacheStage
363
+ */
364
+ getCacheStage = (request) => this.client.fetch(
365
+ {
366
+ method: "GET",
367
+ path: `/edge-services/v1beta1/cache-stages/${validatePathParam("cacheStageId", request.cacheStageId)}`
368
+ },
369
+ unmarshalCacheStage
370
+ );
371
+ /**
372
+ * Update cache stage. Update the parameters of an existing cache stage, specified by its `cache_stage_id`. Parameters which can be updated include the `fallback_ttl` and `backend_stage_id`.
373
+ *
374
+ * @param request - The request {@link UpdateCacheStageRequest}
375
+ * @returns A Promise of CacheStage
376
+ */
377
+ updateCacheStage = (request) => this.client.fetch(
378
+ {
379
+ body: JSON.stringify(
380
+ marshalUpdateCacheStageRequest(request, this.client.settings)
381
+ ),
382
+ headers: jsonContentHeaders,
383
+ method: "PATCH",
384
+ path: `/edge-services/v1beta1/cache-stages/${validatePathParam("cacheStageId", request.cacheStageId)}`
385
+ },
386
+ unmarshalCacheStage
387
+ );
388
+ /**
389
+ * Delete cache stage. Delete an existing cache stage, specified by its `cache_stage_id`. Deleting a cache stage is permanent, and cannot be undone.
390
+ *
391
+ * @param request - The request {@link DeleteCacheStageRequest}
392
+ */
393
+ deleteCacheStage = (request) => this.client.fetch({
394
+ method: "DELETE",
395
+ path: `/edge-services/v1beta1/cache-stages/${validatePathParam("cacheStageId", request.cacheStageId)}`
396
+ });
397
+ pageOfListBackendStages = (request) => this.client.fetch(
398
+ {
399
+ method: "GET",
400
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/backend-stages`,
401
+ urlParams: urlParams(
402
+ ["bucket_name", request.bucketName],
403
+ ["bucket_region", request.bucketRegion],
404
+ ["lb_id", request.lbId],
405
+ ["order_by", request.orderBy],
406
+ ["page", request.page],
407
+ [
408
+ "page_size",
409
+ request.pageSize ?? this.client.settings.defaultPageSize
410
+ ]
411
+ )
412
+ },
413
+ unmarshalListBackendStagesResponse
414
+ );
415
+ /**
416
+ * List backend stages. List all backend stages, for a Scaleway Organization or Scaleway Project. By default, the backend stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
417
+ *
418
+ * @param request - The request {@link ListBackendStagesRequest}
419
+ * @returns A Promise of ListBackendStagesResponse
420
+ */
421
+ listBackendStages = (request) => enrichForPagination("stages", this.pageOfListBackendStages, request);
422
+ /**
423
+ * Create backend stage. Create a new backend stage. You must specify either a `scaleway_s3` (for a Scaleway Object Storage bucket) or `scaleway_lb` (for a Scaleway Load Balancer) field to configure the origin.
424
+ *
425
+ * @param request - The request {@link CreateBackendStageRequest}
426
+ * @returns A Promise of BackendStage
427
+ */
428
+ createBackendStage = (request) => this.client.fetch(
429
+ {
430
+ body: JSON.stringify(
431
+ marshalCreateBackendStageRequest(request, this.client.settings)
432
+ ),
433
+ headers: jsonContentHeaders,
434
+ method: "POST",
435
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/backend-stages`
436
+ },
437
+ unmarshalBackendStage
438
+ );
439
+ /**
440
+ * Get backend stage. Retrieve information about an existing backend stage, specified by its `backend_stage_id`. Its full details, including `scaleway_s3` or `scaleway_lb`, are returned in the response object.
441
+ *
442
+ * @param request - The request {@link GetBackendStageRequest}
443
+ * @returns A Promise of BackendStage
444
+ */
445
+ getBackendStage = (request) => this.client.fetch(
446
+ {
447
+ method: "GET",
448
+ path: `/edge-services/v1beta1/backend-stages/${validatePathParam("backendStageId", request.backendStageId)}`
449
+ },
450
+ unmarshalBackendStage
451
+ );
452
+ /**
453
+ * Update backend stage. Update the parameters of an existing backend stage, specified by its `backend_stage_id`.
454
+ *
455
+ * @param request - The request {@link UpdateBackendStageRequest}
456
+ * @returns A Promise of BackendStage
457
+ */
458
+ updateBackendStage = (request) => this.client.fetch(
459
+ {
460
+ body: JSON.stringify(
461
+ marshalUpdateBackendStageRequest(request, this.client.settings)
462
+ ),
463
+ headers: jsonContentHeaders,
464
+ method: "PATCH",
465
+ path: `/edge-services/v1beta1/backend-stages/${validatePathParam("backendStageId", request.backendStageId)}`
466
+ },
467
+ unmarshalBackendStage
468
+ );
469
+ /**
470
+ * Delete backend stage. Delete an existing backend stage, specified by its `backend_stage_id`. Deleting a backend stage is permanent, and cannot be undone.
471
+ *
472
+ * @param request - The request {@link DeleteBackendStageRequest}
473
+ */
474
+ deleteBackendStage = (request) => this.client.fetch({
475
+ method: "DELETE",
476
+ path: `/edge-services/v1beta1/backend-stages/${validatePathParam("backendStageId", request.backendStageId)}`
477
+ });
478
+ searchBackendStages = (request = {}) => this.client.fetch(
479
+ {
480
+ method: "GET",
481
+ path: `/edge-services/v1beta1/search-backend-stages`,
482
+ urlParams: urlParams(
483
+ ["bucket_name", request.bucketName],
484
+ ["bucket_region", request.bucketRegion],
485
+ ["lb_id", request.lbId],
486
+ ["order_by", request.orderBy],
487
+ ["page", request.page],
488
+ [
489
+ "page_size",
490
+ request.pageSize ?? this.client.settings.defaultPageSize
491
+ ],
492
+ [
493
+ "project_id",
494
+ request.projectId ?? this.client.settings.defaultProjectId
495
+ ]
496
+ )
497
+ },
498
+ unmarshalListBackendStagesResponse
499
+ );
500
+ pageOfListWafStages = (request) => this.client.fetch(
501
+ {
502
+ method: "GET",
503
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/waf-stages`,
504
+ urlParams: urlParams(
505
+ ["order_by", request.orderBy],
506
+ ["page", request.page],
507
+ [
508
+ "page_size",
509
+ request.pageSize ?? this.client.settings.defaultPageSize
510
+ ]
511
+ )
512
+ },
513
+ unmarshalListWafStagesResponse
514
+ );
515
+ /**
516
+ * List WAF stages. List all WAF stages, for a Scaleway Organization or Scaleway Project. By default, the WAF stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
517
+ *
518
+ * @param request - The request {@link ListWafStagesRequest}
519
+ * @returns A Promise of ListWafStagesResponse
520
+ */
521
+ listWafStages = (request) => enrichForPagination("stages", this.pageOfListWafStages, request);
522
+ /**
523
+ * Create WAF stage. Create a new WAF stage. You must specify the `mode` and `paranoia_level` fields to customize the WAF.
524
+ *
525
+ * @param request - The request {@link CreateWafStageRequest}
526
+ * @returns A Promise of WafStage
527
+ */
528
+ createWafStage = (request) => this.client.fetch(
529
+ {
530
+ body: JSON.stringify(
531
+ marshalCreateWafStageRequest(request, this.client.settings)
532
+ ),
533
+ headers: jsonContentHeaders,
534
+ method: "POST",
535
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/waf-stages`
536
+ },
537
+ unmarshalWafStage
538
+ );
539
+ /**
540
+ * Get WAF stage. Retrieve information about an existing WAF stage, specified by its `waf_stage_id`. Its full details are returned in the response object.
541
+ *
542
+ * @param request - The request {@link GetWafStageRequest}
543
+ * @returns A Promise of WafStage
544
+ */
545
+ getWafStage = (request) => this.client.fetch(
546
+ {
547
+ method: "GET",
548
+ path: `/edge-services/v1beta1/waf-stages/${validatePathParam("wafStageId", request.wafStageId)}`
549
+ },
550
+ unmarshalWafStage
551
+ );
552
+ /**
553
+ * Update WAF stage. Update the parameters of an existing WAF stage, specified by its `waf_stage_id`. Both `mode` and `paranoia_level` parameters can be updated.
554
+ *
555
+ * @param request - The request {@link UpdateWafStageRequest}
556
+ * @returns A Promise of WafStage
557
+ */
558
+ updateWafStage = (request) => this.client.fetch(
559
+ {
560
+ body: JSON.stringify(
561
+ marshalUpdateWafStageRequest(request, this.client.settings)
562
+ ),
563
+ headers: jsonContentHeaders,
564
+ method: "PATCH",
565
+ path: `/edge-services/v1beta1/waf-stages/${validatePathParam("wafStageId", request.wafStageId)}`
566
+ },
567
+ unmarshalWafStage
568
+ );
569
+ /**
570
+ * Delete WAF stage. Delete an existing WAF stage, specified by its `waf_stage_id`. Deleting a WAF stage is permanent, and cannot be undone.
571
+ *
572
+ * @param request - The request {@link DeleteWafStageRequest}
573
+ */
574
+ deleteWafStage = (request) => this.client.fetch({
575
+ method: "DELETE",
576
+ path: `/edge-services/v1beta1/waf-stages/${validatePathParam("wafStageId", request.wafStageId)}`
577
+ });
578
+ searchWafStages = (request = {}) => this.client.fetch(
579
+ {
580
+ method: "GET",
581
+ path: `/edge-services/v1beta1/search-waf-stages`,
582
+ urlParams: urlParams(
583
+ ["order_by", request.orderBy],
584
+ ["page", request.page],
585
+ [
586
+ "page_size",
587
+ request.pageSize ?? this.client.settings.defaultPageSize
588
+ ],
589
+ [
590
+ "project_id",
591
+ request.projectId ?? this.client.settings.defaultProjectId
592
+ ]
593
+ )
594
+ },
595
+ unmarshalListWafStagesResponse
596
+ );
597
+ pageOfListRouteStages = (request) => this.client.fetch(
598
+ {
599
+ method: "GET",
600
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/route-stages`,
601
+ urlParams: urlParams(
602
+ ["order_by", request.orderBy],
603
+ ["page", request.page],
604
+ [
605
+ "page_size",
606
+ request.pageSize ?? this.client.settings.defaultPageSize
607
+ ]
608
+ )
609
+ },
610
+ unmarshalListRouteStagesResponse
611
+ );
612
+ /**
613
+ * List route stages. List all route stages, for a given pipeline. By default, the route stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
614
+ *
615
+ * @param request - The request {@link ListRouteStagesRequest}
616
+ * @returns A Promise of ListRouteStagesResponse
617
+ */
618
+ listRouteStages = (request) => enrichForPagination("stages", this.pageOfListRouteStages, request);
619
+ /**
620
+ * Create route stage. Create a new route stage. You must specify the `waf_stage_id` field to customize the route.
621
+ *
622
+ * @param request - The request {@link CreateRouteStageRequest}
623
+ * @returns A Promise of RouteStage
624
+ */
625
+ createRouteStage = (request) => this.client.fetch(
626
+ {
627
+ body: JSON.stringify(
628
+ marshalCreateRouteStageRequest(request, this.client.settings)
629
+ ),
630
+ headers: jsonContentHeaders,
631
+ method: "POST",
632
+ path: `/edge-services/v1beta1/pipelines/${validatePathParam("pipelineId", request.pipelineId)}/route-stages`
633
+ },
634
+ unmarshalRouteStage
635
+ );
636
+ /**
637
+ * Get route stage. Retrieve information about an existing route stage, specified by its `route_stage_id`. The summary of the route stage (without route rules) is returned in the response object.
638
+ *
639
+ * @param request - The request {@link GetRouteStageRequest}
640
+ * @returns A Promise of RouteStage
641
+ */
642
+ getRouteStage = (request) => this.client.fetch(
643
+ {
644
+ method: "GET",
645
+ path: `/edge-services/v1beta1/route-stages/${validatePathParam("routeStageId", request.routeStageId)}`
646
+ },
647
+ unmarshalRouteStage
648
+ );
649
+ /**
650
+ * Update route stage. Update the parameters of an existing route stage, specified by its `route_stage_id`.
651
+ *
652
+ * @param request - The request {@link UpdateRouteStageRequest}
653
+ * @returns A Promise of RouteStage
654
+ */
655
+ updateRouteStage = (request) => this.client.fetch(
656
+ {
657
+ body: JSON.stringify(
658
+ marshalUpdateRouteStageRequest(request, this.client.settings)
659
+ ),
660
+ headers: jsonContentHeaders,
661
+ method: "PATCH",
662
+ path: `/edge-services/v1beta1/route-stages/${validatePathParam("routeStageId", request.routeStageId)}`
663
+ },
664
+ unmarshalRouteStage
665
+ );
666
+ /**
667
+ * Delete route stage. Delete an existing route stage, specified by its `route_stage_id`. Deleting a route stage is permanent, and cannot be undone.
668
+ *
669
+ * @param request - The request {@link DeleteRouteStageRequest}
670
+ */
671
+ deleteRouteStage = (request) => this.client.fetch({
672
+ method: "DELETE",
673
+ path: `/edge-services/v1beta1/route-stages/${validatePathParam("routeStageId", request.routeStageId)}`
674
+ });
675
+ /**
676
+ * List route rules. List all route rules of an existing route stage, specified by its `route_stage_id`.
677
+ *
678
+ * @param request - The request {@link ListRouteRulesRequest}
679
+ * @returns A Promise of ListRouteRulesResponse
680
+ */
681
+ listRouteRules = (request) => this.client.fetch(
682
+ {
683
+ method: "GET",
684
+ path: `/edge-services/v1beta1/route-stages/${validatePathParam("routeStageId", request.routeStageId)}/route-rules`
685
+ },
686
+ unmarshalListRouteRulesResponse
687
+ );
688
+ /**
689
+ * Set route rules. Set the rules of an existing route stage, specified by its `route_stage_id`.
690
+ *
691
+ * @param request - The request {@link SetRouteRulesRequest}
692
+ * @returns A Promise of SetRouteRulesResponse
693
+ */
694
+ setRouteRules = (request) => this.client.fetch(
695
+ {
696
+ body: JSON.stringify(
697
+ marshalSetRouteRulesRequest(request, this.client.settings)
698
+ ),
699
+ headers: jsonContentHeaders,
700
+ method: "PUT",
701
+ path: `/edge-services/v1beta1/route-stages/${validatePathParam("routeStageId", request.routeStageId)}/route-rules`
702
+ },
703
+ unmarshalSetRouteRulesResponse
704
+ );
705
+ /**
706
+ * Add route rules. Add route rules to an existing route stage, specified by its `route_stage_id`.
707
+ *
708
+ * @param request - The request {@link AddRouteRulesRequest}
709
+ * @returns A Promise of AddRouteRulesResponse
710
+ */
711
+ addRouteRules = (request) => this.client.fetch(
712
+ {
713
+ body: JSON.stringify(
714
+ marshalAddRouteRulesRequest(request, this.client.settings)
715
+ ),
716
+ headers: jsonContentHeaders,
717
+ method: "POST",
718
+ path: `/edge-services/v1beta1/route-stages/${validatePathParam("routeStageId", request.routeStageId)}/route-rules`
719
+ },
720
+ unmarshalAddRouteRulesResponse
721
+ );
722
+ checkDomain = (request) => this.client.fetch(
723
+ {
724
+ body: JSON.stringify(
725
+ marshalCheckDomainRequest(request, this.client.settings)
726
+ ),
727
+ headers: jsonContentHeaders,
728
+ method: "POST",
729
+ path: `/edge-services/v1beta1/check-domain`
730
+ },
731
+ unmarshalCheckDomainResponse
732
+ );
733
+ checkPEMChain = (request) => this.client.fetch(
734
+ {
735
+ body: JSON.stringify(
736
+ marshalCheckPEMChainRequest(request, this.client.settings)
737
+ ),
738
+ headers: jsonContentHeaders,
739
+ method: "POST",
740
+ path: `/edge-services/v1beta1/check-pem-chain`
741
+ },
742
+ unmarshalCheckPEMChainResponse
743
+ );
744
+ pageOfListPurgeRequests = (request = {}) => this.client.fetch(
745
+ {
746
+ method: "GET",
747
+ path: `/edge-services/v1beta1/purge-requests`,
748
+ urlParams: urlParams(
749
+ ["order_by", request.orderBy],
750
+ ["organization_id", request.organizationId],
751
+ ["page", request.page],
752
+ [
753
+ "page_size",
754
+ request.pageSize ?? this.client.settings.defaultPageSize
755
+ ],
756
+ ["pipeline_id", request.pipelineId],
757
+ ["project_id", request.projectId]
758
+ )
759
+ },
760
+ unmarshalListPurgeRequestsResponse
761
+ );
762
+ /**
763
+ * List purge requests. List all purge requests, for a Scaleway Organization or Scaleway Project. This enables you to retrieve a history of all previously-made purge requests. By default, the purge requests returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
764
+ *
765
+ * @param request - The request {@link ListPurgeRequestsRequest}
766
+ * @returns A Promise of ListPurgeRequestsResponse
767
+ */
768
+ listPurgeRequests = (request = {}) => enrichForPagination("purgeRequests", this.pageOfListPurgeRequests, request);
769
+ /**
770
+ * Create purge request. Create a new purge request. You must specify either the `all` field (to purge all content) or a list of `assets` (to define the precise assets to purge).
771
+ *
772
+ * @param request - The request {@link CreatePurgeRequestRequest}
773
+ * @returns A Promise of PurgeRequest
774
+ */
775
+ createPurgeRequest = (request) => this.client.fetch(
776
+ {
777
+ body: JSON.stringify(
778
+ marshalCreatePurgeRequestRequest(request, this.client.settings)
779
+ ),
780
+ headers: jsonContentHeaders,
781
+ method: "POST",
782
+ path: `/edge-services/v1beta1/purge-requests`
783
+ },
784
+ unmarshalPurgeRequest
785
+ );
786
+ /**
787
+ * Get purge request. Retrieve information about a purge request, specified by its `purge_request_id`. Its full details, including `status` and `target`, are returned in the response object.
788
+ *
789
+ * @param request - The request {@link GetPurgeRequestRequest}
790
+ * @returns A Promise of PurgeRequest
791
+ */
792
+ getPurgeRequest = (request) => this.client.fetch(
793
+ {
794
+ method: "GET",
795
+ path: `/edge-services/v1beta1/purge-requests/${validatePathParam("purgeRequestId", request.purgeRequestId)}`
796
+ },
797
+ unmarshalPurgeRequest
798
+ );
799
+ /**
800
+ * Waits for {@link PurgeRequest} to be in a final state.
801
+ *
802
+ * @param request - The request {@link GetPurgeRequestRequest}
803
+ * @param options - The waiting options
804
+ * @returns A Promise of PurgeRequest
805
+ */
806
+ waitForPurgeRequest = (request, options) => waitForResource(
807
+ options?.stop ?? ((res) => Promise.resolve(
808
+ !PURGE_REQUEST_TRANSIENT_STATUSES.includes(
809
+ res.status
810
+ )
811
+ )),
812
+ this.getPurgeRequest,
813
+ request,
814
+ options
815
+ );
816
+ checkLbOrigin = (request = {}) => this.client.fetch(
817
+ {
818
+ body: JSON.stringify(
819
+ marshalCheckLbOriginRequest(request, this.client.settings)
820
+ ),
821
+ headers: jsonContentHeaders,
822
+ method: "POST",
823
+ path: `/edge-services/v1beta1/check-lb-origin`
824
+ },
825
+ unmarshalCheckLbOriginResponse
826
+ );
827
+ listPlans = () => this.client.fetch(
828
+ {
829
+ method: "GET",
830
+ path: `/edge-services/v1beta1/plans`
831
+ },
832
+ unmarshalListPlansResponse
833
+ );
834
+ selectPlan = (request = {}) => this.client.fetch(
835
+ {
836
+ body: JSON.stringify(
837
+ marshalSelectPlanRequest(request, this.client.settings)
838
+ ),
839
+ headers: jsonContentHeaders,
840
+ method: "PATCH",
841
+ path: `/edge-services/v1beta1/current-plan`
842
+ },
843
+ unmarshalPlan
844
+ );
845
+ getCurrentPlan = (request = {}) => this.client.fetch(
846
+ {
847
+ method: "GET",
848
+ path: `/edge-services/v1beta1/current-plan/${validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
849
+ },
850
+ unmarshalPlan
851
+ );
852
+ deleteCurrentPlan = (request = {}) => this.client.fetch({
853
+ method: "DELETE",
854
+ path: `/edge-services/v1beta1/current-plan/${validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
855
+ });
856
+ /**
857
+ * Gives information on the currently selected Edge Services subscription plan, resource usage and associated billing information for this calendar month (including whether consumption falls within or exceeds the currently selected subscription plan.).
858
+ *
859
+ * @param request - The request {@link GetBillingRequest}
860
+ * @returns A Promise of GetBillingResponse
861
+ */
862
+ getBilling = (request = {}) => this.client.fetch(
863
+ {
864
+ method: "GET",
865
+ path: `/edge-services/v1beta1/billing/${validatePathParam("projectId", request.projectId ?? this.client.settings.defaultProjectId)}`
866
+ },
867
+ unmarshalGetBillingResponse
868
+ );
869
+ }
870
+ export {
871
+ API
872
+ };