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