@scaleway/sdk-function 2.2.0 → 2.3.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,647 +1,442 @@
1
- import { API as API$1, toApiLocality, urlParams, validatePathParam, enrichForPagination, waitForResource, resolveOneOf } from "@scaleway/sdk-client";
2
- import { NAMESPACE_TRANSIENT_STATUSES, FUNCTION_TRANSIENT_STATUSES, CRON_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, TOKEN_TRANSIENT_STATUSES, TRIGGER_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalListNamespacesResponse, unmarshalNamespace, marshalCreateNamespaceRequest, marshalUpdateNamespaceRequest, unmarshalListFunctionsResponse, unmarshalFunction, marshalCreateFunctionRequest, marshalUpdateFunctionRequest, unmarshalListFunctionRuntimesResponse, unmarshalUploadURL, unmarshalDownloadURL, unmarshalListCronsResponse, unmarshalCron, marshalCreateCronRequest, marshalUpdateCronRequest, unmarshalListDomainsResponse, unmarshalDomain, marshalCreateDomainRequest, marshalCreateTokenRequest, unmarshalToken, unmarshalListTokensResponse, marshalCreateTriggerRequest, unmarshalTrigger, unmarshalListTriggersResponse, marshalUpdateTriggerRequest } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
6
- };
7
- class API extends API$1 {
8
- /**
9
- * Locality of this API.
10
- * type {'zone','region','global','unspecified'}
11
- */
12
- static LOCALITY = toApiLocality({
13
- regions: ["fr-par", "nl-ams", "pl-waw"]
14
- });
15
- pageOfListNamespaces = (request = {}) => this.client.fetch(
16
- {
17
- method: "GET",
18
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces`,
19
- urlParams: urlParams(
20
- ["name", request.name],
21
- ["order_by", request.orderBy],
22
- ["organization_id", request.organizationId],
23
- ["page", request.page],
24
- [
25
- "page_size",
26
- request.pageSize ?? this.client.settings.defaultPageSize
27
- ],
28
- ["project_id", request.projectId]
29
- )
30
- },
31
- unmarshalListNamespacesResponse
32
- );
33
- /**
34
- * List all your namespaces. List all existing namespaces in the specified region.
35
- *
36
- * @param request - The request {@link ListNamespacesRequest}
37
- * @returns A Promise of ListNamespacesResponse
38
- */
39
- listNamespaces = (request = {}) => enrichForPagination("namespaces", this.pageOfListNamespaces, request);
40
- /**
41
- * Get a namespace. Get the namespace associated with the specified ID.
42
- *
43
- * @param request - The request {@link GetNamespaceRequest}
44
- * @returns A Promise of Namespace
45
- */
46
- getNamespace = (request) => this.client.fetch(
47
- {
48
- method: "GET",
49
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam("namespaceId", request.namespaceId)}`
50
- },
51
- unmarshalNamespace
52
- );
53
- /**
54
- * Waits for {@link Namespace} to be in a final state.
55
- *
56
- * @param request - The request {@link GetNamespaceRequest}
57
- * @param options - The waiting options
58
- * @returns A Promise of Namespace
59
- */
60
- waitForNamespace = (request, options) => waitForResource(
61
- options?.stop ?? ((res) => Promise.resolve(
62
- !NAMESPACE_TRANSIENT_STATUSES.includes(res.status)
63
- )),
64
- this.getNamespace,
65
- request,
66
- options
67
- );
68
- /**
69
- * Create a new namespace. Create a new namespace in a specified Organization or Project.
70
- *
71
- * @param request - The request {@link CreateNamespaceRequest}
72
- * @returns A Promise of Namespace
73
- */
74
- createNamespace = (request = {}) => this.client.fetch(
75
- {
76
- body: JSON.stringify(
77
- marshalCreateNamespaceRequest(request, this.client.settings)
78
- ),
79
- headers: jsonContentHeaders,
80
- method: "POST",
81
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces`
82
- },
83
- unmarshalNamespace
84
- );
85
- /**
86
- * Update an existing namespace. Update the namespace associated with the specified ID.
87
- *
88
- * @param request - The request {@link UpdateNamespaceRequest}
89
- * @returns A Promise of Namespace
90
- */
91
- updateNamespace = (request) => this.client.fetch(
92
- {
93
- body: JSON.stringify(
94
- marshalUpdateNamespaceRequest(request, this.client.settings)
95
- ),
96
- headers: jsonContentHeaders,
97
- method: "PATCH",
98
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam("namespaceId", request.namespaceId)}`
99
- },
100
- unmarshalNamespace
101
- );
102
- /**
103
- * Delete an existing namespace. Delete the namespace associated with the specified ID.
104
- *
105
- * @param request - The request {@link DeleteNamespaceRequest}
106
- * @returns A Promise of Namespace
107
- */
108
- deleteNamespace = (request) => this.client.fetch(
109
- {
110
- method: "DELETE",
111
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam("namespaceId", request.namespaceId)}`
112
- },
113
- unmarshalNamespace
114
- );
115
- pageOfListFunctions = (request) => this.client.fetch(
116
- {
117
- method: "GET",
118
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions`,
119
- urlParams: urlParams(
120
- ["name", request.name],
121
- ["namespace_id", request.namespaceId],
122
- ["order_by", request.orderBy],
123
- ["organization_id", request.organizationId],
124
- ["page", request.page],
125
- [
126
- "page_size",
127
- request.pageSize ?? this.client.settings.defaultPageSize
128
- ],
129
- ["project_id", request.projectId]
130
- )
131
- },
132
- unmarshalListFunctionsResponse
133
- );
134
- /**
135
- * List all your functions.
136
- *
137
- * @param request - The request {@link ListFunctionsRequest}
138
- * @returns A Promise of ListFunctionsResponse
139
- */
140
- listFunctions = (request) => enrichForPagination("functions", this.pageOfListFunctions, request);
141
- /**
142
- * Get a function. Get the function associated with the specified ID.
143
- *
144
- * @param request - The request {@link GetFunctionRequest}
145
- * @returns A Promise of Function
146
- */
147
- getFunction = (request) => this.client.fetch(
148
- {
149
- method: "GET",
150
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}`
151
- },
152
- unmarshalFunction
153
- );
154
- /**
155
- * Waits for {@link Function} to be in a final state.
156
- *
157
- * @param request - The request {@link GetFunctionRequest}
158
- * @param options - The waiting options
159
- * @returns A Promise of Function
160
- */
161
- waitForFunction = (request, options) => waitForResource(
162
- options?.stop ?? ((res) => Promise.resolve(
163
- !FUNCTION_TRANSIENT_STATUSES.includes(res.status)
164
- )),
165
- this.getFunction,
166
- request,
167
- options
168
- );
169
- /**
170
- * Create a new function. Create a new function in the specified region for a specified Organization or Project.
171
- *
172
- * @param request - The request {@link CreateFunctionRequest}
173
- * @returns A Promise of Function
174
- */
175
- createFunction = (request) => this.client.fetch(
176
- {
177
- body: JSON.stringify(
178
- marshalCreateFunctionRequest(request, this.client.settings)
179
- ),
180
- headers: jsonContentHeaders,
181
- method: "POST",
182
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions`
183
- },
184
- unmarshalFunction
185
- );
186
- /**
187
- * Update an existing function. Update the function associated with the specified ID.
188
-
189
- When updating a function, the function is automatically redeployed to apply the changes.
190
- This behavior can be changed by setting the `redeploy` field to `false` in the request.
191
- *
192
- * @param request - The request {@link UpdateFunctionRequest}
193
- * @returns A Promise of Function
194
- */
195
- updateFunction = (request) => this.client.fetch(
196
- {
197
- body: JSON.stringify(
198
- marshalUpdateFunctionRequest(request, this.client.settings)
199
- ),
200
- headers: jsonContentHeaders,
201
- method: "PATCH",
202
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}`
203
- },
204
- unmarshalFunction
205
- );
206
- /**
207
- * Delete a function. Delete the function associated with the specified ID.
208
- *
209
- * @param request - The request {@link DeleteFunctionRequest}
210
- * @returns A Promise of Function
211
- */
212
- deleteFunction = (request) => this.client.fetch(
213
- {
214
- method: "DELETE",
215
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}`
216
- },
217
- unmarshalFunction
218
- );
219
- /**
220
- * Deploy a function. Deploy a function associated with the specified ID.
221
- *
222
- * @param request - The request {@link DeployFunctionRequest}
223
- * @returns A Promise of Function
224
- */
225
- deployFunction = (request) => this.client.fetch(
226
- {
227
- body: "{}",
228
- headers: jsonContentHeaders,
229
- method: "POST",
230
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}/deploy`
231
- },
232
- unmarshalFunction
233
- );
234
- /**
235
- * List function runtimes. List available function runtimes.
236
- *
237
- * @param request - The request {@link ListFunctionRuntimesRequest}
238
- * @returns A Promise of ListFunctionRuntimesResponse
239
- */
240
- listFunctionRuntimes = (request = {}) => this.client.fetch(
241
- {
242
- method: "GET",
243
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/runtimes`
244
- },
245
- unmarshalListFunctionRuntimesResponse
246
- );
247
- /**
248
- * Get an upload URL of a function. Get an upload URL of a function associated with the specified ID.
249
- *
250
- * @param request - The request {@link GetFunctionUploadURLRequest}
251
- * @returns A Promise of UploadURL
252
- */
253
- getFunctionUploadURL = (request) => this.client.fetch(
254
- {
255
- method: "GET",
256
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}/upload-url`,
257
- urlParams: urlParams(["content_length", request.contentLength])
258
- },
259
- unmarshalUploadURL
260
- );
261
- /**
262
- * Get a download URL of a function. Get a download URL for a function associated with the specified ID.
263
- *
264
- * @param request - The request {@link GetFunctionDownloadURLRequest}
265
- * @returns A Promise of DownloadURL
266
- */
267
- getFunctionDownloadURL = (request) => this.client.fetch(
268
- {
269
- method: "GET",
270
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}/download-url`
271
- },
272
- unmarshalDownloadURL
273
- );
274
- pageOfListCrons = (request) => this.client.fetch(
275
- {
276
- method: "GET",
277
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons`,
278
- urlParams: urlParams(
279
- ["function_id", request.functionId],
280
- ["order_by", request.orderBy],
281
- ["page", request.page],
282
- [
283
- "page_size",
284
- request.pageSize ?? this.client.settings.defaultPageSize
285
- ]
286
- )
287
- },
288
- unmarshalListCronsResponse
289
- );
290
- /**
291
- * List all crons. List all the cronjobs in a specified region.
292
- *
293
- * @param request - The request {@link ListCronsRequest}
294
- * @returns A Promise of ListCronsResponse
295
- */
296
- listCrons = (request) => enrichForPagination("crons", this.pageOfListCrons, request);
297
- /**
298
- * Get a cron. Get the cron associated with the specified ID.
299
- *
300
- * @param request - The request {@link GetCronRequest}
301
- * @returns A Promise of Cron
302
- */
303
- getCron = (request) => this.client.fetch(
304
- {
305
- method: "GET",
306
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons/${validatePathParam("cronId", request.cronId)}`
307
- },
308
- unmarshalCron
309
- );
310
- /**
311
- * Waits for {@link Cron} to be in a final state.
312
- *
313
- * @param request - The request {@link GetCronRequest}
314
- * @param options - The waiting options
315
- * @returns A Promise of Cron
316
- */
317
- waitForCron = (request, options) => waitForResource(
318
- options?.stop ?? ((res) => Promise.resolve(
319
- !CRON_TRANSIENT_STATUSES.includes(res.status)
320
- )),
321
- this.getCron,
322
- request,
323
- options
324
- );
325
- /**
326
- * Create a new cron. Create a new cronjob for a function with the specified ID.
327
- *
328
- * @param request - The request {@link CreateCronRequest}
329
- * @returns A Promise of Cron
330
- */
331
- createCron = (request) => this.client.fetch(
332
- {
333
- body: JSON.stringify(
334
- marshalCreateCronRequest(request, this.client.settings)
335
- ),
336
- headers: jsonContentHeaders,
337
- method: "POST",
338
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons`
339
- },
340
- unmarshalCron
341
- );
342
- /**
343
- * Update an existing cron. Update the cron associated with the specified ID.
344
- *
345
- * @param request - The request {@link UpdateCronRequest}
346
- * @returns A Promise of Cron
347
- */
348
- updateCron = (request) => this.client.fetch(
349
- {
350
- body: JSON.stringify(
351
- marshalUpdateCronRequest(request, this.client.settings)
352
- ),
353
- headers: jsonContentHeaders,
354
- method: "PATCH",
355
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons/${validatePathParam("cronId", request.cronId)}`
356
- },
357
- unmarshalCron
358
- );
359
- /**
360
- * Delete an existing cron. Delete the cron associated with the specified ID.
361
- *
362
- * @param request - The request {@link DeleteCronRequest}
363
- * @returns A Promise of Cron
364
- */
365
- deleteCron = (request) => this.client.fetch(
366
- {
367
- method: "DELETE",
368
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons/${validatePathParam("cronId", request.cronId)}`
369
- },
370
- unmarshalCron
371
- );
372
- pageOfListDomains = (request) => this.client.fetch(
373
- {
374
- method: "GET",
375
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains`,
376
- urlParams: urlParams(
377
- ["function_id", request.functionId],
378
- ["order_by", request.orderBy],
379
- ["page", request.page],
380
- [
381
- "page_size",
382
- request.pageSize ?? this.client.settings.defaultPageSize
383
- ]
384
- )
385
- },
386
- unmarshalListDomainsResponse
387
- );
388
- /**
389
- * List all domain name bindings. List all domain name bindings in a specified region.
390
- *
391
- * @param request - The request {@link ListDomainsRequest}
392
- * @returns A Promise of ListDomainsResponse
393
- */
394
- listDomains = (request) => enrichForPagination("domains", this.pageOfListDomains, request);
395
- /**
396
- * Get a domain name binding. Get a domain name binding for the function with the specified ID.
397
- *
398
- * @param request - The request {@link GetDomainRequest}
399
- * @returns A Promise of Domain
400
- */
401
- getDomain = (request) => this.client.fetch(
402
- {
403
- method: "GET",
404
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domainId", request.domainId)}`
405
- },
406
- unmarshalDomain
407
- );
408
- /**
409
- * Waits for {@link Domain} to be in a final state.
410
- *
411
- * @param request - The request {@link GetDomainRequest}
412
- * @param options - The waiting options
413
- * @returns A Promise of Domain
414
- */
415
- waitForDomain = (request, options) => waitForResource(
416
- options?.stop ?? ((res) => Promise.resolve(
417
- !DOMAIN_TRANSIENT_STATUSES.includes(res.status)
418
- )),
419
- this.getDomain,
420
- request,
421
- options
422
- );
423
- /**
424
- * Create a domain name binding. Create a domain name binding for the function with the specified ID.
425
- *
426
- * @param request - The request {@link CreateDomainRequest}
427
- * @returns A Promise of Domain
428
- */
429
- createDomain = (request) => this.client.fetch(
430
- {
431
- body: JSON.stringify(
432
- marshalCreateDomainRequest(request, this.client.settings)
433
- ),
434
- headers: jsonContentHeaders,
435
- method: "POST",
436
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains`
437
- },
438
- unmarshalDomain
439
- );
440
- /**
441
- * Delete a domain name binding. Delete a domain name binding for the function with the specified ID.
442
- *
443
- * @param request - The request {@link DeleteDomainRequest}
444
- * @returns A Promise of Domain
445
- */
446
- deleteDomain = (request) => this.client.fetch(
447
- {
448
- method: "DELETE",
449
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domainId", request.domainId)}`
450
- },
451
- unmarshalDomain
452
- );
453
- /**
454
- * Create a new revocable token. Deprecated in favor of IAM authentication.
455
- *
456
- * @deprecated
457
- * @param request - The request {@link CreateTokenRequest}
458
- * @returns A Promise of Token
459
- */
460
- createToken = (request = {}) => this.client.fetch(
461
- {
462
- body: JSON.stringify(
463
- marshalCreateTokenRequest(request, this.client.settings)
464
- ),
465
- headers: jsonContentHeaders,
466
- method: "POST",
467
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`
468
- },
469
- unmarshalToken
470
- );
471
- /**
472
- * Get a token.
473
- *
474
- * @param request - The request {@link GetTokenRequest}
475
- * @returns A Promise of Token
476
- */
477
- getToken = (request) => this.client.fetch(
478
- {
479
- method: "GET",
480
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
481
- },
482
- unmarshalToken
483
- );
484
- /**
485
- * Waits for {@link Token} to be in a final state.
486
- *
487
- * @param request - The request {@link GetTokenRequest}
488
- * @param options - The waiting options
489
- * @returns A Promise of Token
490
- */
491
- waitForToken = (request, options) => waitForResource(
492
- options?.stop ?? ((res) => Promise.resolve(
493
- !TOKEN_TRANSIENT_STATUSES.includes(res.status)
494
- )),
495
- this.getToken,
496
- request,
497
- options
498
- );
499
- pageOfListTokens = (request = {}) => this.client.fetch(
500
- {
501
- method: "GET",
502
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`,
503
- urlParams: urlParams(
504
- ["function_id", request.functionId],
505
- ["namespace_id", request.namespaceId],
506
- ["order_by", request.orderBy],
507
- ["page", request.page],
508
- [
509
- "page_size",
510
- request.pageSize ?? this.client.settings.defaultPageSize
511
- ]
512
- )
513
- },
514
- unmarshalListTokensResponse
515
- );
516
- /**
517
- * List all tokens.
518
- *
519
- * @param request - The request {@link ListTokensRequest}
520
- * @returns A Promise of ListTokensResponse
521
- */
522
- listTokens = (request = {}) => enrichForPagination("tokens", this.pageOfListTokens, request);
523
- /**
524
- * Delete a token.
525
- *
526
- * @param request - The request {@link DeleteTokenRequest}
527
- * @returns A Promise of Token
528
- */
529
- deleteToken = (request) => this.client.fetch(
530
- {
531
- method: "DELETE",
532
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
533
- },
534
- unmarshalToken
535
- );
536
- /**
537
- * Create a trigger. Create a new trigger for a specified function.
538
- *
539
- * @param request - The request {@link CreateTriggerRequest}
540
- * @returns A Promise of Trigger
541
- */
542
- createTrigger = (request) => this.client.fetch(
543
- {
544
- body: JSON.stringify(
545
- marshalCreateTriggerRequest(request, this.client.settings)
546
- ),
547
- headers: jsonContentHeaders,
548
- method: "POST",
549
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers`
550
- },
551
- unmarshalTrigger
552
- );
553
- /**
554
- * Get a trigger. Get a trigger with a specified ID.
555
- *
556
- * @param request - The request {@link GetTriggerRequest}
557
- * @returns A Promise of Trigger
558
- */
559
- getTrigger = (request) => this.client.fetch(
560
- {
561
- method: "GET",
562
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers/${validatePathParam("triggerId", request.triggerId)}`
563
- },
564
- unmarshalTrigger
565
- );
566
- /**
567
- * Waits for {@link Trigger} to be in a final state.
568
- *
569
- * @param request - The request {@link GetTriggerRequest}
570
- * @param options - The waiting options
571
- * @returns A Promise of Trigger
572
- */
573
- waitForTrigger = (request, options) => waitForResource(
574
- options?.stop ?? ((res) => Promise.resolve(
575
- !TRIGGER_TRANSIENT_STATUSES.includes(res.status)
576
- )),
577
- this.getTrigger,
578
- request,
579
- options
580
- );
581
- pageOfListTriggers = (request = {}) => this.client.fetch(
582
- {
583
- method: "GET",
584
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers`,
585
- urlParams: urlParams(
586
- ["order_by", request.orderBy],
587
- ["page", request.page],
588
- [
589
- "page_size",
590
- request.pageSize ?? this.client.settings.defaultPageSize
591
- ],
592
- ...Object.entries(
593
- resolveOneOf([
594
- { param: "function_id", value: request.functionId },
595
- { param: "namespace_id", value: request.namespaceId },
596
- {
597
- default: this.client.settings.defaultProjectId,
598
- param: "project_id",
599
- value: request.projectId
600
- }
601
- ])
602
- )
603
- )
604
- },
605
- unmarshalListTriggersResponse
606
- );
607
- /**
608
- * List all triggers. List all triggers belonging to a specified Organization or Project.
609
- *
610
- * @param request - The request {@link ListTriggersRequest}
611
- * @returns A Promise of ListTriggersResponse
612
- */
613
- listTriggers = (request = {}) => enrichForPagination("triggers", this.pageOfListTriggers, request);
614
- /**
615
- * Update a trigger. Update a trigger with a specified ID.
616
- *
617
- * @param request - The request {@link UpdateTriggerRequest}
618
- * @returns A Promise of Trigger
619
- */
620
- updateTrigger = (request) => this.client.fetch(
621
- {
622
- body: JSON.stringify(
623
- marshalUpdateTriggerRequest(request, this.client.settings)
624
- ),
625
- headers: jsonContentHeaders,
626
- method: "PATCH",
627
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers/${validatePathParam("triggerId", request.triggerId)}`
628
- },
629
- unmarshalTrigger
630
- );
631
- /**
632
- * Delete a trigger. Delete a trigger with a specified ID.
633
- *
634
- * @param request - The request {@link DeleteTriggerRequest}
635
- * @returns A Promise of Trigger
636
- */
637
- deleteTrigger = (request) => this.client.fetch(
638
- {
639
- method: "DELETE",
640
- path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers/${validatePathParam("triggerId", request.triggerId)}`
641
- },
642
- unmarshalTrigger
643
- );
644
- }
645
- export {
646
- API
1
+ import { CRON_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, FUNCTION_TRANSIENT_STATUSES, NAMESPACE_TRANSIENT_STATUSES, TOKEN_TRANSIENT_STATUSES, TRIGGER_TRANSIENT_STATUSES } from "./content.gen.js";
2
+ import { marshalCreateCronRequest, marshalCreateDomainRequest, marshalCreateFunctionRequest, marshalCreateNamespaceRequest, marshalCreateTokenRequest, marshalCreateTriggerRequest, marshalUpdateCronRequest, marshalUpdateFunctionRequest, marshalUpdateNamespaceRequest, marshalUpdateTriggerRequest, unmarshalCron, unmarshalDomain, unmarshalDownloadURL, unmarshalFunction, unmarshalListCronsResponse, unmarshalListDomainsResponse, unmarshalListFunctionRuntimesResponse, unmarshalListFunctionsResponse, unmarshalListNamespacesResponse, unmarshalListTokensResponse, unmarshalListTriggersResponse, unmarshalNamespace, unmarshalToken, unmarshalTrigger, unmarshalUploadURL } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, resolveOneOf, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Serverless Functions API.
7
+
8
+ This API allows you to manage your Serverless Functions.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Locality of this API.
13
+ * type ∈ {'zone','region','global','unspecified'}
14
+ */
15
+ static LOCALITY = toApiLocality({ regions: [
16
+ "fr-par",
17
+ "nl-ams",
18
+ "pl-waw"
19
+ ] });
20
+ pageOfListNamespaces = (request = {}) => this.client.fetch({
21
+ method: "GET",
22
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces`,
23
+ 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])
24
+ }, unmarshalListNamespacesResponse);
25
+ /**
26
+ * List all your namespaces. List all existing namespaces in the specified region.
27
+ *
28
+ * @param request - The request {@link ListNamespacesRequest}
29
+ * @returns A Promise of ListNamespacesResponse
30
+ */
31
+ listNamespaces = (request = {}) => enrichForPagination("namespaces", this.pageOfListNamespaces, request);
32
+ /**
33
+ * Get a namespace. Get the namespace associated with the specified ID.
34
+ *
35
+ * @param request - The request {@link GetNamespaceRequest}
36
+ * @returns A Promise of Namespace
37
+ */
38
+ getNamespace = (request) => this.client.fetch({
39
+ method: "GET",
40
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam("namespaceId", request.namespaceId)}`
41
+ }, unmarshalNamespace);
42
+ /**
43
+ * Waits for {@link Namespace} to be in a final state.
44
+ *
45
+ * @param request - The request {@link GetNamespaceRequest}
46
+ * @param options - The waiting options
47
+ * @returns A Promise of Namespace
48
+ */
49
+ waitForNamespace = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!NAMESPACE_TRANSIENT_STATUSES.includes(res.status))), this.getNamespace, request, options);
50
+ /**
51
+ * Create a new namespace. Create a new namespace in a specified Organization or Project.
52
+ *
53
+ * @param request - The request {@link CreateNamespaceRequest}
54
+ * @returns A Promise of Namespace
55
+ */
56
+ createNamespace = (request = {}) => this.client.fetch({
57
+ body: JSON.stringify(marshalCreateNamespaceRequest(request, this.client.settings)),
58
+ headers: jsonContentHeaders,
59
+ method: "POST",
60
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces`
61
+ }, unmarshalNamespace);
62
+ /**
63
+ * Update an existing namespace. Update the namespace associated with the specified ID.
64
+ *
65
+ * @param request - The request {@link UpdateNamespaceRequest}
66
+ * @returns A Promise of Namespace
67
+ */
68
+ updateNamespace = (request) => this.client.fetch({
69
+ body: JSON.stringify(marshalUpdateNamespaceRequest(request, this.client.settings)),
70
+ headers: jsonContentHeaders,
71
+ method: "PATCH",
72
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam("namespaceId", request.namespaceId)}`
73
+ }, unmarshalNamespace);
74
+ /**
75
+ * Delete an existing namespace. Delete the namespace associated with the specified ID.
76
+ *
77
+ * @param request - The request {@link DeleteNamespaceRequest}
78
+ * @returns A Promise of Namespace
79
+ */
80
+ deleteNamespace = (request) => this.client.fetch({
81
+ method: "DELETE",
82
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam("namespaceId", request.namespaceId)}`
83
+ }, unmarshalNamespace);
84
+ pageOfListFunctions = (request) => this.client.fetch({
85
+ method: "GET",
86
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions`,
87
+ urlParams: urlParams(["name", request.name], ["namespace_id", request.namespaceId], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId])
88
+ }, unmarshalListFunctionsResponse);
89
+ /**
90
+ * List all your functions.
91
+ *
92
+ * @param request - The request {@link ListFunctionsRequest}
93
+ * @returns A Promise of ListFunctionsResponse
94
+ */
95
+ listFunctions = (request) => enrichForPagination("functions", this.pageOfListFunctions, request);
96
+ /**
97
+ * Get a function. Get the function associated with the specified ID.
98
+ *
99
+ * @param request - The request {@link GetFunctionRequest}
100
+ * @returns A Promise of Function
101
+ */
102
+ getFunction = (request) => this.client.fetch({
103
+ method: "GET",
104
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}`
105
+ }, unmarshalFunction);
106
+ /**
107
+ * Waits for {@link Function} to be in a final state.
108
+ *
109
+ * @param request - The request {@link GetFunctionRequest}
110
+ * @param options - The waiting options
111
+ * @returns A Promise of Function
112
+ */
113
+ waitForFunction = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!FUNCTION_TRANSIENT_STATUSES.includes(res.status))), this.getFunction, request, options);
114
+ /**
115
+ * Create a new function. Create a new function in the specified region for a specified Organization or Project.
116
+ *
117
+ * @param request - The request {@link CreateFunctionRequest}
118
+ * @returns A Promise of Function
119
+ */
120
+ createFunction = (request) => this.client.fetch({
121
+ body: JSON.stringify(marshalCreateFunctionRequest(request, this.client.settings)),
122
+ headers: jsonContentHeaders,
123
+ method: "POST",
124
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions`
125
+ }, unmarshalFunction);
126
+ /**
127
+ * Update an existing function. Update the function associated with the specified ID.
128
+
129
+ When updating a function, the function is automatically redeployed to apply the changes.
130
+ This behavior can be changed by setting the `redeploy` field to `false` in the request.
131
+ *
132
+ * @param request - The request {@link UpdateFunctionRequest}
133
+ * @returns A Promise of Function
134
+ */
135
+ updateFunction = (request) => this.client.fetch({
136
+ body: JSON.stringify(marshalUpdateFunctionRequest(request, this.client.settings)),
137
+ headers: jsonContentHeaders,
138
+ method: "PATCH",
139
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}`
140
+ }, unmarshalFunction);
141
+ /**
142
+ * Delete a function. Delete the function associated with the specified ID.
143
+ *
144
+ * @param request - The request {@link DeleteFunctionRequest}
145
+ * @returns A Promise of Function
146
+ */
147
+ deleteFunction = (request) => this.client.fetch({
148
+ method: "DELETE",
149
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}`
150
+ }, unmarshalFunction);
151
+ /**
152
+ * Deploy a function. Deploy a function associated with the specified ID.
153
+ *
154
+ * @param request - The request {@link DeployFunctionRequest}
155
+ * @returns A Promise of Function
156
+ */
157
+ deployFunction = (request) => this.client.fetch({
158
+ body: "{}",
159
+ headers: jsonContentHeaders,
160
+ method: "POST",
161
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}/deploy`
162
+ }, unmarshalFunction);
163
+ /**
164
+ * List function runtimes. List available function runtimes.
165
+ *
166
+ * @param request - The request {@link ListFunctionRuntimesRequest}
167
+ * @returns A Promise of ListFunctionRuntimesResponse
168
+ */
169
+ listFunctionRuntimes = (request = {}) => this.client.fetch({
170
+ method: "GET",
171
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/runtimes`
172
+ }, unmarshalListFunctionRuntimesResponse);
173
+ /**
174
+ * Get an upload URL of a function. Get an upload URL of a function associated with the specified ID.
175
+ *
176
+ * @param request - The request {@link GetFunctionUploadURLRequest}
177
+ * @returns A Promise of UploadURL
178
+ */
179
+ getFunctionUploadURL = (request) => this.client.fetch({
180
+ method: "GET",
181
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}/upload-url`,
182
+ urlParams: urlParams(["content_length", request.contentLength])
183
+ }, unmarshalUploadURL);
184
+ /**
185
+ * Get a download URL of a function. Get a download URL for a function associated with the specified ID.
186
+ *
187
+ * @param request - The request {@link GetFunctionDownloadURLRequest}
188
+ * @returns A Promise of DownloadURL
189
+ */
190
+ getFunctionDownloadURL = (request) => this.client.fetch({
191
+ method: "GET",
192
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/functions/${validatePathParam("functionId", request.functionId)}/download-url`
193
+ }, unmarshalDownloadURL);
194
+ pageOfListCrons = (request) => this.client.fetch({
195
+ method: "GET",
196
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons`,
197
+ urlParams: urlParams(["function_id", request.functionId], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
198
+ }, unmarshalListCronsResponse);
199
+ /**
200
+ * List all crons. List all the cronjobs in a specified region.
201
+ *
202
+ * @param request - The request {@link ListCronsRequest}
203
+ * @returns A Promise of ListCronsResponse
204
+ */
205
+ listCrons = (request) => enrichForPagination("crons", this.pageOfListCrons, request);
206
+ /**
207
+ * Get a cron. Get the cron associated with the specified ID.
208
+ *
209
+ * @param request - The request {@link GetCronRequest}
210
+ * @returns A Promise of Cron
211
+ */
212
+ getCron = (request) => this.client.fetch({
213
+ method: "GET",
214
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons/${validatePathParam("cronId", request.cronId)}`
215
+ }, unmarshalCron);
216
+ /**
217
+ * Waits for {@link Cron} to be in a final state.
218
+ *
219
+ * @param request - The request {@link GetCronRequest}
220
+ * @param options - The waiting options
221
+ * @returns A Promise of Cron
222
+ */
223
+ waitForCron = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!CRON_TRANSIENT_STATUSES.includes(res.status))), this.getCron, request, options);
224
+ /**
225
+ * Create a new cron. Create a new cronjob for a function with the specified ID.
226
+ *
227
+ * @param request - The request {@link CreateCronRequest}
228
+ * @returns A Promise of Cron
229
+ */
230
+ createCron = (request) => this.client.fetch({
231
+ body: JSON.stringify(marshalCreateCronRequest(request, this.client.settings)),
232
+ headers: jsonContentHeaders,
233
+ method: "POST",
234
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons`
235
+ }, unmarshalCron);
236
+ /**
237
+ * Update an existing cron. Update the cron associated with the specified ID.
238
+ *
239
+ * @param request - The request {@link UpdateCronRequest}
240
+ * @returns A Promise of Cron
241
+ */
242
+ updateCron = (request) => this.client.fetch({
243
+ body: JSON.stringify(marshalUpdateCronRequest(request, this.client.settings)),
244
+ headers: jsonContentHeaders,
245
+ method: "PATCH",
246
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons/${validatePathParam("cronId", request.cronId)}`
247
+ }, unmarshalCron);
248
+ /**
249
+ * Delete an existing cron. Delete the cron associated with the specified ID.
250
+ *
251
+ * @param request - The request {@link DeleteCronRequest}
252
+ * @returns A Promise of Cron
253
+ */
254
+ deleteCron = (request) => this.client.fetch({
255
+ method: "DELETE",
256
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/crons/${validatePathParam("cronId", request.cronId)}`
257
+ }, unmarshalCron);
258
+ pageOfListDomains = (request) => this.client.fetch({
259
+ method: "GET",
260
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains`,
261
+ urlParams: urlParams(["function_id", request.functionId], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
262
+ }, unmarshalListDomainsResponse);
263
+ /**
264
+ * List all domain name bindings. List all domain name bindings in a specified region.
265
+ *
266
+ * @param request - The request {@link ListDomainsRequest}
267
+ * @returns A Promise of ListDomainsResponse
268
+ */
269
+ listDomains = (request) => enrichForPagination("domains", this.pageOfListDomains, request);
270
+ /**
271
+ * Get a domain name binding. Get a domain name binding for the function with the specified ID.
272
+ *
273
+ * @param request - The request {@link GetDomainRequest}
274
+ * @returns A Promise of Domain
275
+ */
276
+ getDomain = (request) => this.client.fetch({
277
+ method: "GET",
278
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domainId", request.domainId)}`
279
+ }, unmarshalDomain);
280
+ /**
281
+ * Waits for {@link Domain} to be in a final state.
282
+ *
283
+ * @param request - The request {@link GetDomainRequest}
284
+ * @param options - The waiting options
285
+ * @returns A Promise of Domain
286
+ */
287
+ waitForDomain = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), this.getDomain, request, options);
288
+ /**
289
+ * Create a domain name binding. Create a domain name binding for the function with the specified ID.
290
+ *
291
+ * @param request - The request {@link CreateDomainRequest}
292
+ * @returns A Promise of Domain
293
+ */
294
+ createDomain = (request) => this.client.fetch({
295
+ body: JSON.stringify(marshalCreateDomainRequest(request, this.client.settings)),
296
+ headers: jsonContentHeaders,
297
+ method: "POST",
298
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains`
299
+ }, unmarshalDomain);
300
+ /**
301
+ * Delete a domain name binding. Delete a domain name binding for the function with the specified ID.
302
+ *
303
+ * @param request - The request {@link DeleteDomainRequest}
304
+ * @returns A Promise of Domain
305
+ */
306
+ deleteDomain = (request) => this.client.fetch({
307
+ method: "DELETE",
308
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam("domainId", request.domainId)}`
309
+ }, unmarshalDomain);
310
+ /**
311
+ * Create a new revocable token. Deprecated in favor of IAM authentication.
312
+ *
313
+ * @deprecated
314
+ * @param request - The request {@link CreateTokenRequest}
315
+ * @returns A Promise of Token
316
+ */
317
+ createToken = (request = {}) => this.client.fetch({
318
+ body: JSON.stringify(marshalCreateTokenRequest(request, this.client.settings)),
319
+ headers: jsonContentHeaders,
320
+ method: "POST",
321
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`
322
+ }, unmarshalToken);
323
+ /**
324
+ * Get a token.
325
+ *
326
+ * @param request - The request {@link GetTokenRequest}
327
+ * @returns A Promise of Token
328
+ */
329
+ getToken = (request) => this.client.fetch({
330
+ method: "GET",
331
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
332
+ }, unmarshalToken);
333
+ /**
334
+ * Waits for {@link Token} to be in a final state.
335
+ *
336
+ * @param request - The request {@link GetTokenRequest}
337
+ * @param options - The waiting options
338
+ * @returns A Promise of Token
339
+ */
340
+ waitForToken = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!TOKEN_TRANSIENT_STATUSES.includes(res.status))), this.getToken, request, options);
341
+ pageOfListTokens = (request = {}) => this.client.fetch({
342
+ method: "GET",
343
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens`,
344
+ urlParams: urlParams(["function_id", request.functionId], ["namespace_id", request.namespaceId], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
345
+ }, unmarshalListTokensResponse);
346
+ /**
347
+ * List all tokens.
348
+ *
349
+ * @param request - The request {@link ListTokensRequest}
350
+ * @returns A Promise of ListTokensResponse
351
+ */
352
+ listTokens = (request = {}) => enrichForPagination("tokens", this.pageOfListTokens, request);
353
+ /**
354
+ * Delete a token.
355
+ *
356
+ * @param request - The request {@link DeleteTokenRequest}
357
+ * @returns A Promise of Token
358
+ */
359
+ deleteToken = (request) => this.client.fetch({
360
+ method: "DELETE",
361
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tokens/${validatePathParam("tokenId", request.tokenId)}`
362
+ }, unmarshalToken);
363
+ /**
364
+ * Create a trigger. Create a new trigger for a specified function.
365
+ *
366
+ * @param request - The request {@link CreateTriggerRequest}
367
+ * @returns A Promise of Trigger
368
+ */
369
+ createTrigger = (request) => this.client.fetch({
370
+ body: JSON.stringify(marshalCreateTriggerRequest(request, this.client.settings)),
371
+ headers: jsonContentHeaders,
372
+ method: "POST",
373
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers`
374
+ }, unmarshalTrigger);
375
+ /**
376
+ * Get a trigger. Get a trigger with a specified ID.
377
+ *
378
+ * @param request - The request {@link GetTriggerRequest}
379
+ * @returns A Promise of Trigger
380
+ */
381
+ getTrigger = (request) => this.client.fetch({
382
+ method: "GET",
383
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers/${validatePathParam("triggerId", request.triggerId)}`
384
+ }, unmarshalTrigger);
385
+ /**
386
+ * Waits for {@link Trigger} to be in a final state.
387
+ *
388
+ * @param request - The request {@link GetTriggerRequest}
389
+ * @param options - The waiting options
390
+ * @returns A Promise of Trigger
391
+ */
392
+ waitForTrigger = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!TRIGGER_TRANSIENT_STATUSES.includes(res.status))), this.getTrigger, request, options);
393
+ pageOfListTriggers = (request = {}) => this.client.fetch({
394
+ method: "GET",
395
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers`,
396
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ...Object.entries(resolveOneOf([
397
+ {
398
+ param: "function_id",
399
+ value: request.functionId
400
+ },
401
+ {
402
+ param: "namespace_id",
403
+ value: request.namespaceId
404
+ },
405
+ {
406
+ default: this.client.settings.defaultProjectId,
407
+ param: "project_id",
408
+ value: request.projectId
409
+ }
410
+ ])))
411
+ }, unmarshalListTriggersResponse);
412
+ /**
413
+ * List all triggers. List all triggers belonging to a specified Organization or Project.
414
+ *
415
+ * @param request - The request {@link ListTriggersRequest}
416
+ * @returns A Promise of ListTriggersResponse
417
+ */
418
+ listTriggers = (request = {}) => enrichForPagination("triggers", this.pageOfListTriggers, request);
419
+ /**
420
+ * Update a trigger. Update a trigger with a specified ID.
421
+ *
422
+ * @param request - The request {@link UpdateTriggerRequest}
423
+ * @returns A Promise of Trigger
424
+ */
425
+ updateTrigger = (request) => this.client.fetch({
426
+ body: JSON.stringify(marshalUpdateTriggerRequest(request, this.client.settings)),
427
+ headers: jsonContentHeaders,
428
+ method: "PATCH",
429
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers/${validatePathParam("triggerId", request.triggerId)}`
430
+ }, unmarshalTrigger);
431
+ /**
432
+ * Delete a trigger. Delete a trigger with a specified ID.
433
+ *
434
+ * @param request - The request {@link DeleteTriggerRequest}
435
+ * @returns A Promise of Trigger
436
+ */
437
+ deleteTrigger = (request) => this.client.fetch({
438
+ method: "DELETE",
439
+ path: `/functions/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/triggers/${validatePathParam("triggerId", request.triggerId)}`
440
+ }, unmarshalTrigger);
647
441
  };
442
+ export { API$1 as API };