@scaleway/sdk-edge-services 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,807 @@
1
+ import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject, unmarshalMoney, unmarshalMapOfObject } from "@scaleway/sdk-client";
2
+ const unmarshalScalewayLb = (data) => {
3
+ if (!isJSONObject(data)) {
4
+ throw new TypeError(
5
+ `Unmarshalling the type 'ScalewayLb' failed as data isn't a dictionary.`
6
+ );
7
+ }
8
+ return {
9
+ domainName: data.domain_name,
10
+ frontendId: data.frontend_id,
11
+ id: data.id,
12
+ isSsl: data.is_ssl,
13
+ zone: data.zone
14
+ };
15
+ };
16
+ const unmarshalScalewayLbBackendConfig = (data) => {
17
+ if (!isJSONObject(data)) {
18
+ throw new TypeError(
19
+ `Unmarshalling the type 'ScalewayLbBackendConfig' failed as data isn't a dictionary.`
20
+ );
21
+ }
22
+ return {
23
+ lbs: unmarshalArrayOfObject(data.lbs, unmarshalScalewayLb)
24
+ };
25
+ };
26
+ const unmarshalScalewayS3BackendConfig = (data) => {
27
+ if (!isJSONObject(data)) {
28
+ throw new TypeError(
29
+ `Unmarshalling the type 'ScalewayS3BackendConfig' failed as data isn't a dictionary.`
30
+ );
31
+ }
32
+ return {
33
+ bucketName: data.bucket_name,
34
+ bucketRegion: data.bucket_region,
35
+ isWebsite: data.is_website
36
+ };
37
+ };
38
+ const unmarshalBackendStage = (data) => {
39
+ if (!isJSONObject(data)) {
40
+ throw new TypeError(
41
+ `Unmarshalling the type 'BackendStage' failed as data isn't a dictionary.`
42
+ );
43
+ }
44
+ return {
45
+ createdAt: unmarshalDate(data.created_at),
46
+ id: data.id,
47
+ pipelineId: data.pipeline_id,
48
+ scalewayLb: data.scaleway_lb ? unmarshalScalewayLbBackendConfig(data.scaleway_lb) : void 0,
49
+ scalewayS3: data.scaleway_s3 ? unmarshalScalewayS3BackendConfig(data.scaleway_s3) : void 0,
50
+ updatedAt: unmarshalDate(data.updated_at)
51
+ };
52
+ };
53
+ const unmarshalCacheStage = (data) => {
54
+ if (!isJSONObject(data)) {
55
+ throw new TypeError(
56
+ `Unmarshalling the type 'CacheStage' failed as data isn't a dictionary.`
57
+ );
58
+ }
59
+ return {
60
+ backendStageId: data.backend_stage_id,
61
+ createdAt: unmarshalDate(data.created_at),
62
+ fallbackTtl: data.fallback_ttl,
63
+ id: data.id,
64
+ pipelineId: data.pipeline_id,
65
+ routeStageId: data.route_stage_id,
66
+ updatedAt: unmarshalDate(data.updated_at),
67
+ wafStageId: data.waf_stage_id
68
+ };
69
+ };
70
+ const unmarshalDNSStage = (data) => {
71
+ if (!isJSONObject(data)) {
72
+ throw new TypeError(
73
+ `Unmarshalling the type 'DNSStage' failed as data isn't a dictionary.`
74
+ );
75
+ }
76
+ return {
77
+ backendStageId: data.backend_stage_id,
78
+ cacheStageId: data.cache_stage_id,
79
+ createdAt: unmarshalDate(data.created_at),
80
+ fqdns: data.fqdns,
81
+ id: data.id,
82
+ pipelineId: data.pipeline_id,
83
+ tlsStageId: data.tls_stage_id,
84
+ type: data.type,
85
+ updatedAt: unmarshalDate(data.updated_at)
86
+ };
87
+ };
88
+ const unmarshalPipelineError = (data) => {
89
+ if (!isJSONObject(data)) {
90
+ throw new TypeError(
91
+ `Unmarshalling the type 'PipelineError' failed as data isn't a dictionary.`
92
+ );
93
+ }
94
+ return {
95
+ code: data.code,
96
+ message: data.message,
97
+ severity: data.severity,
98
+ stage: data.stage,
99
+ type: data.type
100
+ };
101
+ };
102
+ const unmarshalPipeline = (data) => {
103
+ if (!isJSONObject(data)) {
104
+ throw new TypeError(
105
+ `Unmarshalling the type 'Pipeline' failed as data isn't a dictionary.`
106
+ );
107
+ }
108
+ return {
109
+ createdAt: unmarshalDate(data.created_at),
110
+ description: data.description,
111
+ errors: unmarshalArrayOfObject(data.errors, unmarshalPipelineError),
112
+ id: data.id,
113
+ name: data.name,
114
+ organizationId: data.organization_id,
115
+ projectId: data.project_id,
116
+ status: data.status,
117
+ updatedAt: unmarshalDate(data.updated_at)
118
+ };
119
+ };
120
+ const unmarshalRouteStage = (data) => {
121
+ if (!isJSONObject(data)) {
122
+ throw new TypeError(
123
+ `Unmarshalling the type 'RouteStage' failed as data isn't a dictionary.`
124
+ );
125
+ }
126
+ return {
127
+ createdAt: unmarshalDate(data.created_at),
128
+ id: data.id,
129
+ pipelineId: data.pipeline_id,
130
+ updatedAt: unmarshalDate(data.updated_at),
131
+ wafStageId: data.waf_stage_id
132
+ };
133
+ };
134
+ const unmarshalTLSSecret = (data) => {
135
+ if (!isJSONObject(data)) {
136
+ throw new TypeError(
137
+ `Unmarshalling the type 'TLSSecret' failed as data isn't a dictionary.`
138
+ );
139
+ }
140
+ return {
141
+ region: data.region,
142
+ secretId: data.secret_id
143
+ };
144
+ };
145
+ const unmarshalTLSStage = (data) => {
146
+ if (!isJSONObject(data)) {
147
+ throw new TypeError(
148
+ `Unmarshalling the type 'TLSStage' failed as data isn't a dictionary.`
149
+ );
150
+ }
151
+ return {
152
+ backendStageId: data.backend_stage_id,
153
+ cacheStageId: data.cache_stage_id,
154
+ certificateExpiresAt: unmarshalDate(data.certificate_expires_at),
155
+ createdAt: unmarshalDate(data.created_at),
156
+ id: data.id,
157
+ managedCertificate: data.managed_certificate,
158
+ pipelineId: data.pipeline_id,
159
+ routeStageId: data.route_stage_id,
160
+ secrets: unmarshalArrayOfObject(data.secrets, unmarshalTLSSecret),
161
+ updatedAt: unmarshalDate(data.updated_at),
162
+ wafStageId: data.waf_stage_id
163
+ };
164
+ };
165
+ const unmarshalWafStage = (data) => {
166
+ if (!isJSONObject(data)) {
167
+ throw new TypeError(
168
+ `Unmarshalling the type 'WafStage' failed as data isn't a dictionary.`
169
+ );
170
+ }
171
+ return {
172
+ backendStageId: data.backend_stage_id,
173
+ createdAt: unmarshalDate(data.created_at),
174
+ id: data.id,
175
+ mode: data.mode,
176
+ paranoiaLevel: data.paranoia_level,
177
+ pipelineId: data.pipeline_id,
178
+ updatedAt: unmarshalDate(data.updated_at)
179
+ };
180
+ };
181
+ const unmarshalPipelineStages = (data) => {
182
+ if (!isJSONObject(data)) {
183
+ throw new TypeError(
184
+ `Unmarshalling the type 'PipelineStages' failed as data isn't a dictionary.`
185
+ );
186
+ }
187
+ return {
188
+ backendStages: unmarshalArrayOfObject(
189
+ data.backend_stages,
190
+ unmarshalBackendStage
191
+ ),
192
+ cacheStages: unmarshalArrayOfObject(data.cache_stages, unmarshalCacheStage),
193
+ dnsStages: unmarshalArrayOfObject(data.dns_stages, unmarshalDNSStage),
194
+ pipeline: data.pipeline ? unmarshalPipeline(data.pipeline) : void 0,
195
+ routeStages: unmarshalArrayOfObject(data.route_stages, unmarshalRouteStage),
196
+ tlsStages: unmarshalArrayOfObject(data.tls_stages, unmarshalTLSStage),
197
+ wafStages: unmarshalArrayOfObject(data.waf_stages, unmarshalWafStage)
198
+ };
199
+ };
200
+ const unmarshalPurgeRequest = (data) => {
201
+ if (!isJSONObject(data)) {
202
+ throw new TypeError(
203
+ `Unmarshalling the type 'PurgeRequest' failed as data isn't a dictionary.`
204
+ );
205
+ }
206
+ return {
207
+ all: data.all,
208
+ assets: data.assets,
209
+ createdAt: unmarshalDate(data.created_at),
210
+ id: data.id,
211
+ pipelineId: data.pipeline_id,
212
+ status: data.status,
213
+ updatedAt: unmarshalDate(data.updated_at)
214
+ };
215
+ };
216
+ const unmarshalRuleHttpMatchPathFilter = (data) => {
217
+ if (!isJSONObject(data)) {
218
+ throw new TypeError(
219
+ `Unmarshalling the type 'RuleHttpMatchPathFilter' failed as data isn't a dictionary.`
220
+ );
221
+ }
222
+ return {
223
+ pathFilterType: data.path_filter_type,
224
+ value: data.value
225
+ };
226
+ };
227
+ const unmarshalRuleHttpMatch = (data) => {
228
+ if (!isJSONObject(data)) {
229
+ throw new TypeError(
230
+ `Unmarshalling the type 'RuleHttpMatch' failed as data isn't a dictionary.`
231
+ );
232
+ }
233
+ return {
234
+ methodFilters: data.method_filters,
235
+ pathFilter: data.path_filter ? unmarshalRuleHttpMatchPathFilter(data.path_filter) : void 0
236
+ };
237
+ };
238
+ const unmarshalRouteRule = (data) => {
239
+ if (!isJSONObject(data)) {
240
+ throw new TypeError(
241
+ `Unmarshalling the type 'RouteRule' failed as data isn't a dictionary.`
242
+ );
243
+ }
244
+ return {
245
+ backendStageId: data.backend_stage_id,
246
+ position: data.position,
247
+ routeStageId: data.route_stage_id,
248
+ ruleHttpMatch: data.rule_http_match ? unmarshalRuleHttpMatch(data.rule_http_match) : void 0
249
+ };
250
+ };
251
+ const unmarshalAddRouteRulesResponse = (data) => {
252
+ if (!isJSONObject(data)) {
253
+ throw new TypeError(
254
+ `Unmarshalling the type 'AddRouteRulesResponse' failed as data isn't a dictionary.`
255
+ );
256
+ }
257
+ return {
258
+ routeRules: unmarshalArrayOfObject(data.route_rules, unmarshalRouteRule)
259
+ };
260
+ };
261
+ const unmarshalCheckDomainResponse = (data) => {
262
+ if (!isJSONObject(data)) {
263
+ throw new TypeError(
264
+ `Unmarshalling the type 'CheckDomainResponse' failed as data isn't a dictionary.`
265
+ );
266
+ }
267
+ return {
268
+ isValid: data.is_valid
269
+ };
270
+ };
271
+ const unmarshalCheckLbOriginResponse = (data) => {
272
+ if (!isJSONObject(data)) {
273
+ throw new TypeError(
274
+ `Unmarshalling the type 'CheckLbOriginResponse' failed as data isn't a dictionary.`
275
+ );
276
+ }
277
+ return {
278
+ errorType: data.error_type,
279
+ isValid: data.is_valid
280
+ };
281
+ };
282
+ const unmarshalCheckPEMChainResponse = (data) => {
283
+ if (!isJSONObject(data)) {
284
+ throw new TypeError(
285
+ `Unmarshalling the type 'CheckPEMChainResponse' failed as data isn't a dictionary.`
286
+ );
287
+ }
288
+ return {
289
+ isValid: data.is_valid
290
+ };
291
+ };
292
+ const unmarshalPlanDetails = (data) => {
293
+ if (!isJSONObject(data)) {
294
+ throw new TypeError(
295
+ `Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary.`
296
+ );
297
+ }
298
+ return {
299
+ packageGb: data.package_gb,
300
+ pipelineLimit: data.pipeline_limit,
301
+ planName: data.plan_name,
302
+ wafRequests: data.waf_requests
303
+ };
304
+ };
305
+ const unmarshalPlanUsageDetails = (data) => {
306
+ if (!isJSONObject(data)) {
307
+ throw new TypeError(
308
+ `Unmarshalling the type 'PlanUsageDetails' failed as data isn't a dictionary.`
309
+ );
310
+ }
311
+ return {
312
+ planCost: data.plan_cost ? unmarshalMoney(data.plan_cost) : void 0
313
+ };
314
+ };
315
+ const unmarshalGetBillingResponse = (data) => {
316
+ if (!isJSONObject(data)) {
317
+ throw new TypeError(
318
+ `Unmarshalling the type 'GetBillingResponse' failed as data isn't a dictionary.`
319
+ );
320
+ }
321
+ return {
322
+ currentPlan: data.current_plan ? unmarshalPlanDetails(data.current_plan) : void 0,
323
+ currentPlanCacheUsage: data.current_plan_cache_usage,
324
+ currentPlanWafUsage: data.current_plan_waf_usage,
325
+ extraCacheCost: data.extra_cache_cost ? unmarshalMoney(data.extra_cache_cost) : void 0,
326
+ extraCacheUsage: data.extra_cache_usage,
327
+ extraPipelinesCost: data.extra_pipelines_cost ? unmarshalMoney(data.extra_pipelines_cost) : void 0,
328
+ extraWafCost: data.extra_waf_cost ? unmarshalMoney(data.extra_waf_cost) : void 0,
329
+ extraWafUsage: data.extra_waf_usage,
330
+ pipelineNumber: data.pipeline_number,
331
+ planCost: data.plan_cost ? unmarshalMoney(data.plan_cost) : void 0,
332
+ plansUsageDetails: unmarshalMapOfObject(
333
+ data.plans_usage_details,
334
+ unmarshalPlanUsageDetails
335
+ ),
336
+ totalCost: data.total_cost ? unmarshalMoney(data.total_cost) : void 0,
337
+ wafAddOn: data.waf_add_on ? unmarshalMoney(data.waf_add_on) : void 0
338
+ };
339
+ };
340
+ const unmarshalHeadStageResponseHeadStage = (data) => {
341
+ if (!isJSONObject(data)) {
342
+ throw new TypeError(
343
+ `Unmarshalling the type 'HeadStageResponseHeadStage' failed as data isn't a dictionary.`
344
+ );
345
+ }
346
+ return {
347
+ dnsStageId: data.dns_stage_id
348
+ };
349
+ };
350
+ const unmarshalHeadStageResponse = (data) => {
351
+ if (!isJSONObject(data)) {
352
+ throw new TypeError(
353
+ `Unmarshalling the type 'HeadStageResponse' failed as data isn't a dictionary.`
354
+ );
355
+ }
356
+ return {
357
+ headStage: data.head_stage ? unmarshalHeadStageResponseHeadStage(data.head_stage) : void 0
358
+ };
359
+ };
360
+ const unmarshalListBackendStagesResponse = (data) => {
361
+ if (!isJSONObject(data)) {
362
+ throw new TypeError(
363
+ `Unmarshalling the type 'ListBackendStagesResponse' failed as data isn't a dictionary.`
364
+ );
365
+ }
366
+ return {
367
+ stages: unmarshalArrayOfObject(data.stages, unmarshalBackendStage),
368
+ totalCount: data.total_count
369
+ };
370
+ };
371
+ const unmarshalListCacheStagesResponse = (data) => {
372
+ if (!isJSONObject(data)) {
373
+ throw new TypeError(
374
+ `Unmarshalling the type 'ListCacheStagesResponse' failed as data isn't a dictionary.`
375
+ );
376
+ }
377
+ return {
378
+ stages: unmarshalArrayOfObject(data.stages, unmarshalCacheStage),
379
+ totalCount: data.total_count
380
+ };
381
+ };
382
+ const unmarshalListDNSStagesResponse = (data) => {
383
+ if (!isJSONObject(data)) {
384
+ throw new TypeError(
385
+ `Unmarshalling the type 'ListDNSStagesResponse' failed as data isn't a dictionary.`
386
+ );
387
+ }
388
+ return {
389
+ stages: unmarshalArrayOfObject(data.stages, unmarshalDNSStage),
390
+ totalCount: data.total_count
391
+ };
392
+ };
393
+ const unmarshalListHeadStagesResponseHeadStage = (data) => {
394
+ if (!isJSONObject(data)) {
395
+ throw new TypeError(
396
+ `Unmarshalling the type 'ListHeadStagesResponseHeadStage' failed as data isn't a dictionary.`
397
+ );
398
+ }
399
+ return {
400
+ dnsStageId: data.dns_stage_id
401
+ };
402
+ };
403
+ const unmarshalListHeadStagesResponse = (data) => {
404
+ if (!isJSONObject(data)) {
405
+ throw new TypeError(
406
+ `Unmarshalling the type 'ListHeadStagesResponse' failed as data isn't a dictionary.`
407
+ );
408
+ }
409
+ return {
410
+ headStages: unmarshalArrayOfObject(
411
+ data.head_stages,
412
+ unmarshalListHeadStagesResponseHeadStage
413
+ ),
414
+ totalCount: data.total_count
415
+ };
416
+ };
417
+ const unmarshalListPipelinesResponse = (data) => {
418
+ if (!isJSONObject(data)) {
419
+ throw new TypeError(
420
+ `Unmarshalling the type 'ListPipelinesResponse' failed as data isn't a dictionary.`
421
+ );
422
+ }
423
+ return {
424
+ pipelines: unmarshalArrayOfObject(data.pipelines, unmarshalPipeline),
425
+ totalCount: data.total_count
426
+ };
427
+ };
428
+ const unmarshalListPipelinesWithStagesResponse = (data) => {
429
+ if (!isJSONObject(data)) {
430
+ throw new TypeError(
431
+ `Unmarshalling the type 'ListPipelinesWithStagesResponse' failed as data isn't a dictionary.`
432
+ );
433
+ }
434
+ return {
435
+ pipelines: unmarshalArrayOfObject(data.pipelines, unmarshalPipelineStages),
436
+ totalCount: data.total_count
437
+ };
438
+ };
439
+ const unmarshalListPlansResponse = (data) => {
440
+ if (!isJSONObject(data)) {
441
+ throw new TypeError(
442
+ `Unmarshalling the type 'ListPlansResponse' failed as data isn't a dictionary.`
443
+ );
444
+ }
445
+ return {
446
+ plans: unmarshalArrayOfObject(data.plans, unmarshalPlanDetails),
447
+ totalCount: data.total_count
448
+ };
449
+ };
450
+ const unmarshalListPurgeRequestsResponse = (data) => {
451
+ if (!isJSONObject(data)) {
452
+ throw new TypeError(
453
+ `Unmarshalling the type 'ListPurgeRequestsResponse' failed as data isn't a dictionary.`
454
+ );
455
+ }
456
+ return {
457
+ purgeRequests: unmarshalArrayOfObject(
458
+ data.purge_requests,
459
+ unmarshalPurgeRequest
460
+ ),
461
+ totalCount: data.total_count
462
+ };
463
+ };
464
+ const unmarshalListRouteRulesResponse = (data) => {
465
+ if (!isJSONObject(data)) {
466
+ throw new TypeError(
467
+ `Unmarshalling the type 'ListRouteRulesResponse' failed as data isn't a dictionary.`
468
+ );
469
+ }
470
+ return {
471
+ routeRules: unmarshalArrayOfObject(data.route_rules, unmarshalRouteRule)
472
+ };
473
+ };
474
+ const unmarshalListRouteStagesResponse = (data) => {
475
+ if (!isJSONObject(data)) {
476
+ throw new TypeError(
477
+ `Unmarshalling the type 'ListRouteStagesResponse' failed as data isn't a dictionary.`
478
+ );
479
+ }
480
+ return {
481
+ stages: unmarshalArrayOfObject(data.stages, unmarshalRouteStage),
482
+ totalCount: data.total_count
483
+ };
484
+ };
485
+ const unmarshalListTLSStagesResponse = (data) => {
486
+ if (!isJSONObject(data)) {
487
+ throw new TypeError(
488
+ `Unmarshalling the type 'ListTLSStagesResponse' failed as data isn't a dictionary.`
489
+ );
490
+ }
491
+ return {
492
+ stages: unmarshalArrayOfObject(data.stages, unmarshalTLSStage),
493
+ totalCount: data.total_count
494
+ };
495
+ };
496
+ const unmarshalListWafStagesResponse = (data) => {
497
+ if (!isJSONObject(data)) {
498
+ throw new TypeError(
499
+ `Unmarshalling the type 'ListWafStagesResponse' failed as data isn't a dictionary.`
500
+ );
501
+ }
502
+ return {
503
+ stages: unmarshalArrayOfObject(data.stages, unmarshalWafStage),
504
+ totalCount: data.total_count
505
+ };
506
+ };
507
+ const unmarshalPlan = (data) => {
508
+ if (!isJSONObject(data)) {
509
+ throw new TypeError(
510
+ `Unmarshalling the type 'Plan' failed as data isn't a dictionary.`
511
+ );
512
+ }
513
+ return {
514
+ planName: data.plan_name
515
+ };
516
+ };
517
+ const unmarshalSetRouteRulesResponse = (data) => {
518
+ if (!isJSONObject(data)) {
519
+ throw new TypeError(
520
+ `Unmarshalling the type 'SetRouteRulesResponse' failed as data isn't a dictionary.`
521
+ );
522
+ }
523
+ return {
524
+ routeRules: unmarshalArrayOfObject(data.route_rules, unmarshalRouteRule)
525
+ };
526
+ };
527
+ const marshalRuleHttpMatchPathFilter = (request, defaults) => ({
528
+ path_filter_type: request.pathFilterType,
529
+ value: request.value
530
+ });
531
+ const marshalRuleHttpMatch = (request, defaults) => ({
532
+ method_filters: request.methodFilters,
533
+ path_filter: request.pathFilter !== void 0 ? marshalRuleHttpMatchPathFilter(request.pathFilter) : void 0
534
+ });
535
+ const marshalSetRouteRulesRequestRouteRule = (request, defaults) => ({
536
+ ...resolveOneOf([
537
+ {
538
+ param: "rule_http_match",
539
+ value: request.ruleHttpMatch !== void 0 ? marshalRuleHttpMatch(request.ruleHttpMatch) : void 0
540
+ }
541
+ ]),
542
+ ...resolveOneOf([
543
+ { param: "backend_stage_id", value: request.backendStageId }
544
+ ])
545
+ });
546
+ const marshalAddRouteRulesRequest = (request, defaults) => ({
547
+ route_rules: request.routeRules !== void 0 ? request.routeRules.map(
548
+ (elt) => marshalSetRouteRulesRequestRouteRule(elt)
549
+ ) : void 0,
550
+ ...resolveOneOf([
551
+ { param: "after_position", value: request.afterPosition },
552
+ { param: "before_position", value: request.beforePosition }
553
+ ])
554
+ });
555
+ const marshalCheckDomainRequest = (request, defaults) => ({
556
+ cname: request.cname,
557
+ fqdn: request.fqdn,
558
+ project_id: request.projectId ?? defaults.defaultProjectId
559
+ });
560
+ const marshalScalewayLb = (request, defaults) => ({
561
+ domain_name: request.domainName,
562
+ frontend_id: request.frontendId,
563
+ id: request.id,
564
+ is_ssl: request.isSsl,
565
+ zone: request.zone
566
+ });
567
+ const marshalCheckLbOriginRequest = (request, defaults) => ({
568
+ lb: request.lb !== void 0 ? marshalScalewayLb(request.lb) : void 0
569
+ });
570
+ const marshalCheckPEMChainRequestSecretChain = (request, defaults) => ({
571
+ secret_id: request.secretId,
572
+ secret_region: request.secretRegion
573
+ });
574
+ const marshalCheckPEMChainRequest = (request, defaults) => ({
575
+ fqdn: request.fqdn,
576
+ project_id: request.projectId ?? defaults.defaultProjectId,
577
+ ...resolveOneOf([
578
+ {
579
+ param: "secret",
580
+ value: request.secret !== void 0 ? marshalCheckPEMChainRequestSecretChain(request.secret) : void 0
581
+ },
582
+ { param: "raw", value: request.raw }
583
+ ])
584
+ });
585
+ const marshalScalewayLbBackendConfig = (request, defaults) => ({
586
+ lbs: request.lbs.map((elt) => marshalScalewayLb(elt))
587
+ });
588
+ const marshalScalewayS3BackendConfig = (request, defaults) => ({
589
+ bucket_name: request.bucketName,
590
+ bucket_region: request.bucketRegion,
591
+ is_website: request.isWebsite
592
+ });
593
+ const marshalCreateBackendStageRequest = (request, defaults) => ({
594
+ ...resolveOneOf([
595
+ {
596
+ param: "scaleway_s3",
597
+ value: request.scalewayS3 !== void 0 ? marshalScalewayS3BackendConfig(request.scalewayS3) : void 0
598
+ },
599
+ {
600
+ param: "scaleway_lb",
601
+ value: request.scalewayLb !== void 0 ? marshalScalewayLbBackendConfig(request.scalewayLb) : void 0
602
+ }
603
+ ])
604
+ });
605
+ const marshalCreateCacheStageRequest = (request, defaults) => ({
606
+ fallback_ttl: request.fallbackTtl,
607
+ ...resolveOneOf([
608
+ { param: "backend_stage_id", value: request.backendStageId },
609
+ { param: "waf_stage_id", value: request.wafStageId },
610
+ { param: "route_stage_id", value: request.routeStageId }
611
+ ])
612
+ });
613
+ const marshalCreateDNSStageRequest = (request, defaults) => ({
614
+ fqdns: request.fqdns,
615
+ ...resolveOneOf([
616
+ { param: "tls_stage_id", value: request.tlsStageId },
617
+ { param: "cache_stage_id", value: request.cacheStageId },
618
+ { param: "backend_stage_id", value: request.backendStageId }
619
+ ])
620
+ });
621
+ const marshalCreatePipelineRequest = (request, defaults) => ({
622
+ description: request.description,
623
+ name: request.name,
624
+ project_id: request.projectId ?? defaults.defaultProjectId
625
+ });
626
+ const marshalCreatePurgeRequestRequest = (request, defaults) => ({
627
+ pipeline_id: request.pipelineId,
628
+ ...resolveOneOf([
629
+ { param: "assets", value: request.assets },
630
+ { param: "all", value: request.all }
631
+ ])
632
+ });
633
+ const marshalCreateRouteStageRequest = (request, defaults) => ({
634
+ ...resolveOneOf([{ param: "waf_stage_id", value: request.wafStageId }])
635
+ });
636
+ const marshalTLSSecret = (request, defaults) => ({
637
+ region: request.region,
638
+ secret_id: request.secretId
639
+ });
640
+ const marshalCreateTLSStageRequest = (request, defaults) => ({
641
+ managed_certificate: request.managedCertificate,
642
+ secrets: request.secrets !== void 0 ? request.secrets.map((elt) => marshalTLSSecret(elt)) : void 0,
643
+ ...resolveOneOf([
644
+ { param: "cache_stage_id", value: request.cacheStageId },
645
+ { param: "backend_stage_id", value: request.backendStageId },
646
+ { param: "route_stage_id", value: request.routeStageId },
647
+ { param: "waf_stage_id", value: request.wafStageId }
648
+ ])
649
+ });
650
+ const marshalCreateWafStageRequest = (request, defaults) => ({
651
+ mode: request.mode,
652
+ paranoia_level: request.paranoiaLevel,
653
+ ...resolveOneOf([
654
+ { param: "backend_stage_id", value: request.backendStageId }
655
+ ])
656
+ });
657
+ const marshalSelectPlanRequest = (request, defaults) => ({
658
+ plan_name: request.planName,
659
+ project_id: request.projectId ?? defaults.defaultProjectId
660
+ });
661
+ const marshalSetHeadStageRequestAddNewHeadStage = (request, defaults) => ({
662
+ new_stage_id: request.newStageId
663
+ });
664
+ const marshalSetHeadStageRequestRemoveHeadStage = (request, defaults) => ({
665
+ remove_stage_id: request.removeStageId
666
+ });
667
+ const marshalSetHeadStageRequestSwapHeadStage = (request, defaults) => ({
668
+ current_stage_id: request.currentStageId,
669
+ new_stage_id: request.newStageId
670
+ });
671
+ const marshalSetHeadStageRequest = (request, defaults) => ({
672
+ ...resolveOneOf([
673
+ {
674
+ param: "add_new_head_stage",
675
+ value: request.addNewHeadStage !== void 0 ? marshalSetHeadStageRequestAddNewHeadStage(
676
+ request.addNewHeadStage
677
+ ) : void 0
678
+ },
679
+ {
680
+ param: "remove_head_stage",
681
+ value: request.removeHeadStage !== void 0 ? marshalSetHeadStageRequestRemoveHeadStage(
682
+ request.removeHeadStage
683
+ ) : void 0
684
+ },
685
+ {
686
+ param: "swap_head_stage",
687
+ value: request.swapHeadStage !== void 0 ? marshalSetHeadStageRequestSwapHeadStage(
688
+ request.swapHeadStage
689
+ ) : void 0
690
+ }
691
+ ])
692
+ });
693
+ const marshalSetRouteRulesRequest = (request, defaults) => ({
694
+ route_rules: request.routeRules !== void 0 ? request.routeRules.map(
695
+ (elt) => marshalSetRouteRulesRequestRouteRule(elt)
696
+ ) : void 0
697
+ });
698
+ const marshalUpdateBackendStageRequest = (request, defaults) => ({
699
+ pipeline_id: request.pipelineId,
700
+ ...resolveOneOf([
701
+ {
702
+ param: "scaleway_s3",
703
+ value: request.scalewayS3 !== void 0 ? marshalScalewayS3BackendConfig(request.scalewayS3) : void 0
704
+ },
705
+ {
706
+ param: "scaleway_lb",
707
+ value: request.scalewayLb !== void 0 ? marshalScalewayLbBackendConfig(request.scalewayLb) : void 0
708
+ }
709
+ ])
710
+ });
711
+ const marshalUpdateCacheStageRequest = (request, defaults) => ({
712
+ fallback_ttl: request.fallbackTtl,
713
+ ...resolveOneOf([
714
+ { param: "backend_stage_id", value: request.backendStageId },
715
+ { param: "waf_stage_id", value: request.wafStageId },
716
+ { param: "route_stage_id", value: request.routeStageId }
717
+ ])
718
+ });
719
+ const marshalUpdateDNSStageRequest = (request, defaults) => ({
720
+ fqdns: request.fqdns,
721
+ ...resolveOneOf([
722
+ { param: "tls_stage_id", value: request.tlsStageId },
723
+ { param: "cache_stage_id", value: request.cacheStageId },
724
+ { param: "backend_stage_id", value: request.backendStageId }
725
+ ])
726
+ });
727
+ const marshalUpdatePipelineRequest = (request, defaults) => ({
728
+ description: request.description,
729
+ name: request.name
730
+ });
731
+ const marshalUpdateRouteStageRequest = (request, defaults) => ({
732
+ ...resolveOneOf([{ param: "waf_stage_id", value: request.wafStageId }])
733
+ });
734
+ const marshalTLSSecretsConfig = (request, defaults) => ({
735
+ tls_secrets: request.tlsSecrets.map((elt) => marshalTLSSecret(elt))
736
+ });
737
+ const marshalUpdateTLSStageRequest = (request, defaults) => ({
738
+ managed_certificate: request.managedCertificate,
739
+ tls_secrets_config: request.tlsSecretsConfig !== void 0 ? marshalTLSSecretsConfig(request.tlsSecretsConfig) : void 0,
740
+ ...resolveOneOf([
741
+ { param: "cache_stage_id", value: request.cacheStageId },
742
+ { param: "backend_stage_id", value: request.backendStageId },
743
+ { param: "route_stage_id", value: request.routeStageId },
744
+ { param: "waf_stage_id", value: request.wafStageId }
745
+ ])
746
+ });
747
+ const marshalUpdateWafStageRequest = (request, defaults) => ({
748
+ mode: request.mode,
749
+ paranoia_level: request.paranoiaLevel,
750
+ ...resolveOneOf([
751
+ { param: "backend_stage_id", value: request.backendStageId }
752
+ ])
753
+ });
754
+ export {
755
+ marshalAddRouteRulesRequest,
756
+ marshalCheckDomainRequest,
757
+ marshalCheckLbOriginRequest,
758
+ marshalCheckPEMChainRequest,
759
+ marshalCreateBackendStageRequest,
760
+ marshalCreateCacheStageRequest,
761
+ marshalCreateDNSStageRequest,
762
+ marshalCreatePipelineRequest,
763
+ marshalCreatePurgeRequestRequest,
764
+ marshalCreateRouteStageRequest,
765
+ marshalCreateTLSStageRequest,
766
+ marshalCreateWafStageRequest,
767
+ marshalSelectPlanRequest,
768
+ marshalSetHeadStageRequest,
769
+ marshalSetRouteRulesRequest,
770
+ marshalSetRouteRulesRequestRouteRule,
771
+ marshalUpdateBackendStageRequest,
772
+ marshalUpdateCacheStageRequest,
773
+ marshalUpdateDNSStageRequest,
774
+ marshalUpdatePipelineRequest,
775
+ marshalUpdateRouteStageRequest,
776
+ marshalUpdateTLSStageRequest,
777
+ marshalUpdateWafStageRequest,
778
+ unmarshalAddRouteRulesResponse,
779
+ unmarshalBackendStage,
780
+ unmarshalCacheStage,
781
+ unmarshalCheckDomainResponse,
782
+ unmarshalCheckLbOriginResponse,
783
+ unmarshalCheckPEMChainResponse,
784
+ unmarshalDNSStage,
785
+ unmarshalGetBillingResponse,
786
+ unmarshalHeadStageResponse,
787
+ unmarshalListBackendStagesResponse,
788
+ unmarshalListCacheStagesResponse,
789
+ unmarshalListDNSStagesResponse,
790
+ unmarshalListHeadStagesResponse,
791
+ unmarshalListPipelinesResponse,
792
+ unmarshalListPipelinesWithStagesResponse,
793
+ unmarshalListPlansResponse,
794
+ unmarshalListPurgeRequestsResponse,
795
+ unmarshalListRouteRulesResponse,
796
+ unmarshalListRouteStagesResponse,
797
+ unmarshalListTLSStagesResponse,
798
+ unmarshalListWafStagesResponse,
799
+ unmarshalPipeline,
800
+ unmarshalPipelineStages,
801
+ unmarshalPlan,
802
+ unmarshalPurgeRequest,
803
+ unmarshalRouteStage,
804
+ unmarshalSetRouteRulesResponse,
805
+ unmarshalTLSStage,
806
+ unmarshalWafStage
807
+ };