@aws-sdk/client-amplify 3.141.0 → 3.150.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.
@@ -57,16 +57,7 @@ const serializeAws_restJson1CreateBackendEnvironmentCommand = async (input, cont
57
57
  "content-type": "application/json",
58
58
  };
59
59
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/backendenvironments";
60
- if (input.appId !== undefined) {
61
- const labelValue = input.appId;
62
- if (labelValue.length <= 0) {
63
- throw new Error("Empty value provided for input HTTP label: appId.");
64
- }
65
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
66
- }
67
- else {
68
- throw new Error("No value provided for input HTTP label: appId.");
69
- }
60
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
70
61
  let body;
71
62
  body = JSON.stringify({
72
63
  ...(input.deploymentArtifacts != null && { deploymentArtifacts: input.deploymentArtifacts }),
@@ -90,16 +81,7 @@ const serializeAws_restJson1CreateBranchCommand = async (input, context) => {
90
81
  "content-type": "application/json",
91
82
  };
92
83
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches";
93
- if (input.appId !== undefined) {
94
- const labelValue = input.appId;
95
- if (labelValue.length <= 0) {
96
- throw new Error("Empty value provided for input HTTP label: appId.");
97
- }
98
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
99
- }
100
- else {
101
- throw new Error("No value provided for input HTTP label: appId.");
102
- }
84
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
103
85
  let body;
104
86
  body = JSON.stringify({
105
87
  ...(input.backendEnvironmentArn != null && { backendEnvironmentArn: input.backendEnvironmentArn }),
@@ -140,26 +122,8 @@ const serializeAws_restJson1CreateDeploymentCommand = async (input, context) =>
140
122
  };
141
123
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
142
124
  "/apps/{appId}/branches/{branchName}/deployments";
143
- if (input.appId !== undefined) {
144
- const labelValue = input.appId;
145
- if (labelValue.length <= 0) {
146
- throw new Error("Empty value provided for input HTTP label: appId.");
147
- }
148
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
149
- }
150
- else {
151
- throw new Error("No value provided for input HTTP label: appId.");
152
- }
153
- if (input.branchName !== undefined) {
154
- const labelValue = input.branchName;
155
- if (labelValue.length <= 0) {
156
- throw new Error("Empty value provided for input HTTP label: branchName.");
157
- }
158
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
159
- }
160
- else {
161
- throw new Error("No value provided for input HTTP label: branchName.");
162
- }
125
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
126
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
163
127
  let body;
164
128
  body = JSON.stringify({
165
129
  ...(input.fileMap != null && { fileMap: serializeAws_restJson1FileMap(input.fileMap, context) }),
@@ -181,16 +145,7 @@ const serializeAws_restJson1CreateDomainAssociationCommand = async (input, conte
181
145
  "content-type": "application/json",
182
146
  };
183
147
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains";
184
- if (input.appId !== undefined) {
185
- const labelValue = input.appId;
186
- if (labelValue.length <= 0) {
187
- throw new Error("Empty value provided for input HTTP label: appId.");
188
- }
189
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
190
- }
191
- else {
192
- throw new Error("No value provided for input HTTP label: appId.");
193
- }
148
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
194
149
  let body;
195
150
  body = JSON.stringify({
196
151
  ...(input.autoSubDomainCreationPatterns != null && {
@@ -220,16 +175,7 @@ const serializeAws_restJson1CreateWebhookCommand = async (input, context) => {
220
175
  "content-type": "application/json",
221
176
  };
222
177
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/webhooks";
223
- if (input.appId !== undefined) {
224
- const labelValue = input.appId;
225
- if (labelValue.length <= 0) {
226
- throw new Error("Empty value provided for input HTTP label: appId.");
227
- }
228
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
229
- }
230
- else {
231
- throw new Error("No value provided for input HTTP label: appId.");
232
- }
178
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
233
179
  let body;
234
180
  body = JSON.stringify({
235
181
  ...(input.branchName != null && { branchName: input.branchName }),
@@ -250,16 +196,7 @@ const serializeAws_restJson1DeleteAppCommand = async (input, context) => {
250
196
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
251
197
  const headers = {};
252
198
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}";
253
- if (input.appId !== undefined) {
254
- const labelValue = input.appId;
255
- if (labelValue.length <= 0) {
256
- throw new Error("Empty value provided for input HTTP label: appId.");
257
- }
258
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
259
- }
260
- else {
261
- throw new Error("No value provided for input HTTP label: appId.");
262
- }
199
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
263
200
  let body;
264
201
  return new protocol_http_1.HttpRequest({
265
202
  protocol,
@@ -277,26 +214,8 @@ const serializeAws_restJson1DeleteBackendEnvironmentCommand = async (input, cont
277
214
  const headers = {};
278
215
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
279
216
  "/apps/{appId}/backendenvironments/{environmentName}";
280
- if (input.appId !== undefined) {
281
- const labelValue = input.appId;
282
- if (labelValue.length <= 0) {
283
- throw new Error("Empty value provided for input HTTP label: appId.");
284
- }
285
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
286
- }
287
- else {
288
- throw new Error("No value provided for input HTTP label: appId.");
289
- }
290
- if (input.environmentName !== undefined) {
291
- const labelValue = input.environmentName;
292
- if (labelValue.length <= 0) {
293
- throw new Error("Empty value provided for input HTTP label: environmentName.");
294
- }
295
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
296
- }
297
- else {
298
- throw new Error("No value provided for input HTTP label: environmentName.");
299
- }
217
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
218
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
300
219
  let body;
301
220
  return new protocol_http_1.HttpRequest({
302
221
  protocol,
@@ -313,26 +232,8 @@ const serializeAws_restJson1DeleteBranchCommand = async (input, context) => {
313
232
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
314
233
  const headers = {};
315
234
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}";
316
- if (input.appId !== undefined) {
317
- const labelValue = input.appId;
318
- if (labelValue.length <= 0) {
319
- throw new Error("Empty value provided for input HTTP label: appId.");
320
- }
321
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
322
- }
323
- else {
324
- throw new Error("No value provided for input HTTP label: appId.");
325
- }
326
- if (input.branchName !== undefined) {
327
- const labelValue = input.branchName;
328
- if (labelValue.length <= 0) {
329
- throw new Error("Empty value provided for input HTTP label: branchName.");
330
- }
331
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
332
- }
333
- else {
334
- throw new Error("No value provided for input HTTP label: branchName.");
335
- }
235
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
236
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
336
237
  let body;
337
238
  return new protocol_http_1.HttpRequest({
338
239
  protocol,
@@ -349,26 +250,8 @@ const serializeAws_restJson1DeleteDomainAssociationCommand = async (input, conte
349
250
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
350
251
  const headers = {};
351
252
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains/{domainName}";
352
- if (input.appId !== undefined) {
353
- const labelValue = input.appId;
354
- if (labelValue.length <= 0) {
355
- throw new Error("Empty value provided for input HTTP label: appId.");
356
- }
357
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
358
- }
359
- else {
360
- throw new Error("No value provided for input HTTP label: appId.");
361
- }
362
- if (input.domainName !== undefined) {
363
- const labelValue = input.domainName;
364
- if (labelValue.length <= 0) {
365
- throw new Error("Empty value provided for input HTTP label: domainName.");
366
- }
367
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
368
- }
369
- else {
370
- throw new Error("No value provided for input HTTP label: domainName.");
371
- }
253
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
254
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
372
255
  let body;
373
256
  return new protocol_http_1.HttpRequest({
374
257
  protocol,
@@ -386,36 +269,9 @@ const serializeAws_restJson1DeleteJobCommand = async (input, context) => {
386
269
  const headers = {};
387
270
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
388
271
  "/apps/{appId}/branches/{branchName}/jobs/{jobId}";
389
- if (input.appId !== undefined) {
390
- const labelValue = input.appId;
391
- if (labelValue.length <= 0) {
392
- throw new Error("Empty value provided for input HTTP label: appId.");
393
- }
394
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
395
- }
396
- else {
397
- throw new Error("No value provided for input HTTP label: appId.");
398
- }
399
- if (input.branchName !== undefined) {
400
- const labelValue = input.branchName;
401
- if (labelValue.length <= 0) {
402
- throw new Error("Empty value provided for input HTTP label: branchName.");
403
- }
404
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
405
- }
406
- else {
407
- throw new Error("No value provided for input HTTP label: branchName.");
408
- }
409
- if (input.jobId !== undefined) {
410
- const labelValue = input.jobId;
411
- if (labelValue.length <= 0) {
412
- throw new Error("Empty value provided for input HTTP label: jobId.");
413
- }
414
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
415
- }
416
- else {
417
- throw new Error("No value provided for input HTTP label: jobId.");
418
- }
272
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
273
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
274
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
419
275
  let body;
420
276
  return new protocol_http_1.HttpRequest({
421
277
  protocol,
@@ -432,16 +288,7 @@ const serializeAws_restJson1DeleteWebhookCommand = async (input, context) => {
432
288
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
433
289
  const headers = {};
434
290
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/webhooks/{webhookId}";
435
- if (input.webhookId !== undefined) {
436
- const labelValue = input.webhookId;
437
- if (labelValue.length <= 0) {
438
- throw new Error("Empty value provided for input HTTP label: webhookId.");
439
- }
440
- resolvedPath = resolvedPath.replace("{webhookId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
441
- }
442
- else {
443
- throw new Error("No value provided for input HTTP label: webhookId.");
444
- }
291
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "webhookId", () => input.webhookId, "{webhookId}", false);
445
292
  let body;
446
293
  return new protocol_http_1.HttpRequest({
447
294
  protocol,
@@ -460,16 +307,7 @@ const serializeAws_restJson1GenerateAccessLogsCommand = async (input, context) =
460
307
  "content-type": "application/json",
461
308
  };
462
309
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/accesslogs";
463
- if (input.appId !== undefined) {
464
- const labelValue = input.appId;
465
- if (labelValue.length <= 0) {
466
- throw new Error("Empty value provided for input HTTP label: appId.");
467
- }
468
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
469
- }
470
- else {
471
- throw new Error("No value provided for input HTTP label: appId.");
472
- }
310
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
473
311
  let body;
474
312
  body = JSON.stringify({
475
313
  ...(input.domainName != null && { domainName: input.domainName }),
@@ -491,16 +329,7 @@ const serializeAws_restJson1GetAppCommand = async (input, context) => {
491
329
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
492
330
  const headers = {};
493
331
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}";
494
- if (input.appId !== undefined) {
495
- const labelValue = input.appId;
496
- if (labelValue.length <= 0) {
497
- throw new Error("Empty value provided for input HTTP label: appId.");
498
- }
499
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
500
- }
501
- else {
502
- throw new Error("No value provided for input HTTP label: appId.");
503
- }
332
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
504
333
  let body;
505
334
  return new protocol_http_1.HttpRequest({
506
335
  protocol,
@@ -517,16 +346,7 @@ const serializeAws_restJson1GetArtifactUrlCommand = async (input, context) => {
517
346
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
518
347
  const headers = {};
519
348
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/artifacts/{artifactId}";
520
- if (input.artifactId !== undefined) {
521
- const labelValue = input.artifactId;
522
- if (labelValue.length <= 0) {
523
- throw new Error("Empty value provided for input HTTP label: artifactId.");
524
- }
525
- resolvedPath = resolvedPath.replace("{artifactId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
526
- }
527
- else {
528
- throw new Error("No value provided for input HTTP label: artifactId.");
529
- }
349
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "artifactId", () => input.artifactId, "{artifactId}", false);
530
350
  let body;
531
351
  return new protocol_http_1.HttpRequest({
532
352
  protocol,
@@ -544,26 +364,8 @@ const serializeAws_restJson1GetBackendEnvironmentCommand = async (input, context
544
364
  const headers = {};
545
365
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
546
366
  "/apps/{appId}/backendenvironments/{environmentName}";
547
- if (input.appId !== undefined) {
548
- const labelValue = input.appId;
549
- if (labelValue.length <= 0) {
550
- throw new Error("Empty value provided for input HTTP label: appId.");
551
- }
552
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
553
- }
554
- else {
555
- throw new Error("No value provided for input HTTP label: appId.");
556
- }
557
- if (input.environmentName !== undefined) {
558
- const labelValue = input.environmentName;
559
- if (labelValue.length <= 0) {
560
- throw new Error("Empty value provided for input HTTP label: environmentName.");
561
- }
562
- resolvedPath = resolvedPath.replace("{environmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
563
- }
564
- else {
565
- throw new Error("No value provided for input HTTP label: environmentName.");
566
- }
367
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
368
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "environmentName", () => input.environmentName, "{environmentName}", false);
567
369
  let body;
568
370
  return new protocol_http_1.HttpRequest({
569
371
  protocol,
@@ -580,26 +382,8 @@ const serializeAws_restJson1GetBranchCommand = async (input, context) => {
580
382
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
581
383
  const headers = {};
582
384
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}";
583
- if (input.appId !== undefined) {
584
- const labelValue = input.appId;
585
- if (labelValue.length <= 0) {
586
- throw new Error("Empty value provided for input HTTP label: appId.");
587
- }
588
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
589
- }
590
- else {
591
- throw new Error("No value provided for input HTTP label: appId.");
592
- }
593
- if (input.branchName !== undefined) {
594
- const labelValue = input.branchName;
595
- if (labelValue.length <= 0) {
596
- throw new Error("Empty value provided for input HTTP label: branchName.");
597
- }
598
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
599
- }
600
- else {
601
- throw new Error("No value provided for input HTTP label: branchName.");
602
- }
385
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
386
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
603
387
  let body;
604
388
  return new protocol_http_1.HttpRequest({
605
389
  protocol,
@@ -616,26 +400,8 @@ const serializeAws_restJson1GetDomainAssociationCommand = async (input, context)
616
400
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
617
401
  const headers = {};
618
402
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains/{domainName}";
619
- if (input.appId !== undefined) {
620
- const labelValue = input.appId;
621
- if (labelValue.length <= 0) {
622
- throw new Error("Empty value provided for input HTTP label: appId.");
623
- }
624
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
625
- }
626
- else {
627
- throw new Error("No value provided for input HTTP label: appId.");
628
- }
629
- if (input.domainName !== undefined) {
630
- const labelValue = input.domainName;
631
- if (labelValue.length <= 0) {
632
- throw new Error("Empty value provided for input HTTP label: domainName.");
633
- }
634
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
635
- }
636
- else {
637
- throw new Error("No value provided for input HTTP label: domainName.");
638
- }
403
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
404
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
639
405
  let body;
640
406
  return new protocol_http_1.HttpRequest({
641
407
  protocol,
@@ -653,36 +419,9 @@ const serializeAws_restJson1GetJobCommand = async (input, context) => {
653
419
  const headers = {};
654
420
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
655
421
  "/apps/{appId}/branches/{branchName}/jobs/{jobId}";
656
- if (input.appId !== undefined) {
657
- const labelValue = input.appId;
658
- if (labelValue.length <= 0) {
659
- throw new Error("Empty value provided for input HTTP label: appId.");
660
- }
661
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
662
- }
663
- else {
664
- throw new Error("No value provided for input HTTP label: appId.");
665
- }
666
- if (input.branchName !== undefined) {
667
- const labelValue = input.branchName;
668
- if (labelValue.length <= 0) {
669
- throw new Error("Empty value provided for input HTTP label: branchName.");
670
- }
671
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
672
- }
673
- else {
674
- throw new Error("No value provided for input HTTP label: branchName.");
675
- }
676
- if (input.jobId !== undefined) {
677
- const labelValue = input.jobId;
678
- if (labelValue.length <= 0) {
679
- throw new Error("Empty value provided for input HTTP label: jobId.");
680
- }
681
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
682
- }
683
- else {
684
- throw new Error("No value provided for input HTTP label: jobId.");
685
- }
422
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
423
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
424
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
686
425
  let body;
687
426
  return new protocol_http_1.HttpRequest({
688
427
  protocol,
@@ -699,16 +438,7 @@ const serializeAws_restJson1GetWebhookCommand = async (input, context) => {
699
438
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
700
439
  const headers = {};
701
440
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/webhooks/{webhookId}";
702
- if (input.webhookId !== undefined) {
703
- const labelValue = input.webhookId;
704
- if (labelValue.length <= 0) {
705
- throw new Error("Empty value provided for input HTTP label: webhookId.");
706
- }
707
- resolvedPath = resolvedPath.replace("{webhookId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
708
- }
709
- else {
710
- throw new Error("No value provided for input HTTP label: webhookId.");
711
- }
441
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "webhookId", () => input.webhookId, "{webhookId}", false);
712
442
  let body;
713
443
  return new protocol_http_1.HttpRequest({
714
444
  protocol,
@@ -725,10 +455,10 @@ const serializeAws_restJson1ListAppsCommand = async (input, context) => {
725
455
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
726
456
  const headers = {};
727
457
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps";
728
- const query = {
729
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
730
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
731
- };
458
+ const query = map({
459
+ nextToken: [, input.nextToken],
460
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
461
+ });
732
462
  let body;
733
463
  return new protocol_http_1.HttpRequest({
734
464
  protocol,
@@ -747,40 +477,13 @@ const serializeAws_restJson1ListArtifactsCommand = async (input, context) => {
747
477
  const headers = {};
748
478
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
749
479
  "/apps/{appId}/branches/{branchName}/jobs/{jobId}/artifacts";
750
- if (input.appId !== undefined) {
751
- const labelValue = input.appId;
752
- if (labelValue.length <= 0) {
753
- throw new Error("Empty value provided for input HTTP label: appId.");
754
- }
755
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
756
- }
757
- else {
758
- throw new Error("No value provided for input HTTP label: appId.");
759
- }
760
- if (input.branchName !== undefined) {
761
- const labelValue = input.branchName;
762
- if (labelValue.length <= 0) {
763
- throw new Error("Empty value provided for input HTTP label: branchName.");
764
- }
765
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
766
- }
767
- else {
768
- throw new Error("No value provided for input HTTP label: branchName.");
769
- }
770
- if (input.jobId !== undefined) {
771
- const labelValue = input.jobId;
772
- if (labelValue.length <= 0) {
773
- throw new Error("Empty value provided for input HTTP label: jobId.");
774
- }
775
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
776
- }
777
- else {
778
- throw new Error("No value provided for input HTTP label: jobId.");
779
- }
780
- const query = {
781
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
782
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
783
- };
480
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
481
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
482
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
483
+ const query = map({
484
+ nextToken: [, input.nextToken],
485
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
486
+ });
784
487
  let body;
785
488
  return new protocol_http_1.HttpRequest({
786
489
  protocol,
@@ -798,21 +501,12 @@ const serializeAws_restJson1ListBackendEnvironmentsCommand = async (input, conte
798
501
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
799
502
  const headers = {};
800
503
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/backendenvironments";
801
- if (input.appId !== undefined) {
802
- const labelValue = input.appId;
803
- if (labelValue.length <= 0) {
804
- throw new Error("Empty value provided for input HTTP label: appId.");
805
- }
806
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
807
- }
808
- else {
809
- throw new Error("No value provided for input HTTP label: appId.");
810
- }
811
- const query = {
812
- ...(input.environmentName !== undefined && { environmentName: input.environmentName }),
813
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
814
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
815
- };
504
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
505
+ const query = map({
506
+ environmentName: [, input.environmentName],
507
+ nextToken: [, input.nextToken],
508
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
509
+ });
816
510
  let body;
817
511
  return new protocol_http_1.HttpRequest({
818
512
  protocol,
@@ -830,20 +524,11 @@ const serializeAws_restJson1ListBranchesCommand = async (input, context) => {
830
524
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
831
525
  const headers = {};
832
526
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches";
833
- if (input.appId !== undefined) {
834
- const labelValue = input.appId;
835
- if (labelValue.length <= 0) {
836
- throw new Error("Empty value provided for input HTTP label: appId.");
837
- }
838
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
839
- }
840
- else {
841
- throw new Error("No value provided for input HTTP label: appId.");
842
- }
843
- const query = {
844
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
845
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
846
- };
527
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
528
+ const query = map({
529
+ nextToken: [, input.nextToken],
530
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
531
+ });
847
532
  let body;
848
533
  return new protocol_http_1.HttpRequest({
849
534
  protocol,
@@ -861,20 +546,11 @@ const serializeAws_restJson1ListDomainAssociationsCommand = async (input, contex
861
546
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
862
547
  const headers = {};
863
548
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains";
864
- if (input.appId !== undefined) {
865
- const labelValue = input.appId;
866
- if (labelValue.length <= 0) {
867
- throw new Error("Empty value provided for input HTTP label: appId.");
868
- }
869
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
870
- }
871
- else {
872
- throw new Error("No value provided for input HTTP label: appId.");
873
- }
874
- const query = {
875
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
876
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
877
- };
549
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
550
+ const query = map({
551
+ nextToken: [, input.nextToken],
552
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
553
+ });
878
554
  let body;
879
555
  return new protocol_http_1.HttpRequest({
880
556
  protocol,
@@ -892,30 +568,12 @@ const serializeAws_restJson1ListJobsCommand = async (input, context) => {
892
568
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
893
569
  const headers = {};
894
570
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}/jobs";
895
- if (input.appId !== undefined) {
896
- const labelValue = input.appId;
897
- if (labelValue.length <= 0) {
898
- throw new Error("Empty value provided for input HTTP label: appId.");
899
- }
900
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
901
- }
902
- else {
903
- throw new Error("No value provided for input HTTP label: appId.");
904
- }
905
- if (input.branchName !== undefined) {
906
- const labelValue = input.branchName;
907
- if (labelValue.length <= 0) {
908
- throw new Error("Empty value provided for input HTTP label: branchName.");
909
- }
910
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
911
- }
912
- else {
913
- throw new Error("No value provided for input HTTP label: branchName.");
914
- }
915
- const query = {
916
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
917
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
918
- };
571
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
572
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
573
+ const query = map({
574
+ nextToken: [, input.nextToken],
575
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
576
+ });
919
577
  let body;
920
578
  return new protocol_http_1.HttpRequest({
921
579
  protocol,
@@ -933,16 +591,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
933
591
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
934
592
  const headers = {};
935
593
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
936
- if (input.resourceArn !== undefined) {
937
- const labelValue = input.resourceArn;
938
- if (labelValue.length <= 0) {
939
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
940
- }
941
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
942
- }
943
- else {
944
- throw new Error("No value provided for input HTTP label: resourceArn.");
945
- }
594
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
946
595
  let body;
947
596
  return new protocol_http_1.HttpRequest({
948
597
  protocol,
@@ -959,20 +608,11 @@ const serializeAws_restJson1ListWebhooksCommand = async (input, context) => {
959
608
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
960
609
  const headers = {};
961
610
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/webhooks";
962
- if (input.appId !== undefined) {
963
- const labelValue = input.appId;
964
- if (labelValue.length <= 0) {
965
- throw new Error("Empty value provided for input HTTP label: appId.");
966
- }
967
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
968
- }
969
- else {
970
- throw new Error("No value provided for input HTTP label: appId.");
971
- }
972
- const query = {
973
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
974
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
975
- };
611
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
612
+ const query = map({
613
+ nextToken: [, input.nextToken],
614
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
615
+ });
976
616
  let body;
977
617
  return new protocol_http_1.HttpRequest({
978
618
  protocol,
@@ -993,26 +633,8 @@ const serializeAws_restJson1StartDeploymentCommand = async (input, context) => {
993
633
  };
994
634
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
995
635
  "/apps/{appId}/branches/{branchName}/deployments/start";
996
- if (input.appId !== undefined) {
997
- const labelValue = input.appId;
998
- if (labelValue.length <= 0) {
999
- throw new Error("Empty value provided for input HTTP label: appId.");
1000
- }
1001
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1002
- }
1003
- else {
1004
- throw new Error("No value provided for input HTTP label: appId.");
1005
- }
1006
- if (input.branchName !== undefined) {
1007
- const labelValue = input.branchName;
1008
- if (labelValue.length <= 0) {
1009
- throw new Error("Empty value provided for input HTTP label: branchName.");
1010
- }
1011
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1012
- }
1013
- else {
1014
- throw new Error("No value provided for input HTTP label: branchName.");
1015
- }
636
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
637
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
1016
638
  let body;
1017
639
  body = JSON.stringify({
1018
640
  ...(input.jobId != null && { jobId: input.jobId }),
@@ -1035,26 +657,8 @@ const serializeAws_restJson1StartJobCommand = async (input, context) => {
1035
657
  "content-type": "application/json",
1036
658
  };
1037
659
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}/jobs";
1038
- if (input.appId !== undefined) {
1039
- const labelValue = input.appId;
1040
- if (labelValue.length <= 0) {
1041
- throw new Error("Empty value provided for input HTTP label: appId.");
1042
- }
1043
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1044
- }
1045
- else {
1046
- throw new Error("No value provided for input HTTP label: appId.");
1047
- }
1048
- if (input.branchName !== undefined) {
1049
- const labelValue = input.branchName;
1050
- if (labelValue.length <= 0) {
1051
- throw new Error("Empty value provided for input HTTP label: branchName.");
1052
- }
1053
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1054
- }
1055
- else {
1056
- throw new Error("No value provided for input HTTP label: branchName.");
1057
- }
660
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
661
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
1058
662
  let body;
1059
663
  body = JSON.stringify({
1060
664
  ...(input.commitId != null && { commitId: input.commitId }),
@@ -1080,36 +684,9 @@ const serializeAws_restJson1StopJobCommand = async (input, context) => {
1080
684
  const headers = {};
1081
685
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1082
686
  "/apps/{appId}/branches/{branchName}/jobs/{jobId}/stop";
1083
- if (input.appId !== undefined) {
1084
- const labelValue = input.appId;
1085
- if (labelValue.length <= 0) {
1086
- throw new Error("Empty value provided for input HTTP label: appId.");
1087
- }
1088
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1089
- }
1090
- else {
1091
- throw new Error("No value provided for input HTTP label: appId.");
1092
- }
1093
- if (input.branchName !== undefined) {
1094
- const labelValue = input.branchName;
1095
- if (labelValue.length <= 0) {
1096
- throw new Error("Empty value provided for input HTTP label: branchName.");
1097
- }
1098
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1099
- }
1100
- else {
1101
- throw new Error("No value provided for input HTTP label: branchName.");
1102
- }
1103
- if (input.jobId !== undefined) {
1104
- const labelValue = input.jobId;
1105
- if (labelValue.length <= 0) {
1106
- throw new Error("Empty value provided for input HTTP label: jobId.");
1107
- }
1108
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1109
- }
1110
- else {
1111
- throw new Error("No value provided for input HTTP label: jobId.");
1112
- }
687
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
688
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
689
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
1113
690
  let body;
1114
691
  return new protocol_http_1.HttpRequest({
1115
692
  protocol,
@@ -1128,16 +705,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
1128
705
  "content-type": "application/json",
1129
706
  };
1130
707
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
1131
- if (input.resourceArn !== undefined) {
1132
- const labelValue = input.resourceArn;
1133
- if (labelValue.length <= 0) {
1134
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1135
- }
1136
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1137
- }
1138
- else {
1139
- throw new Error("No value provided for input HTTP label: resourceArn.");
1140
- }
708
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1141
709
  let body;
1142
710
  body = JSON.stringify({
1143
711
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -1157,19 +725,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1157
725
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1158
726
  const headers = {};
1159
727
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
1160
- if (input.resourceArn !== undefined) {
1161
- const labelValue = input.resourceArn;
1162
- if (labelValue.length <= 0) {
1163
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1164
- }
1165
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1166
- }
1167
- else {
1168
- throw new Error("No value provided for input HTTP label: resourceArn.");
1169
- }
1170
- const query = {
1171
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
1172
- };
728
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
729
+ const query = map({
730
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
731
+ });
1173
732
  let body;
1174
733
  return new protocol_http_1.HttpRequest({
1175
734
  protocol,
@@ -1189,16 +748,7 @@ const serializeAws_restJson1UpdateAppCommand = async (input, context) => {
1189
748
  "content-type": "application/json",
1190
749
  };
1191
750
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}";
1192
- if (input.appId !== undefined) {
1193
- const labelValue = input.appId;
1194
- if (labelValue.length <= 0) {
1195
- throw new Error("Empty value provided for input HTTP label: appId.");
1196
- }
1197
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1198
- }
1199
- else {
1200
- throw new Error("No value provided for input HTTP label: appId.");
1201
- }
751
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
1202
752
  let body;
1203
753
  body = JSON.stringify({
1204
754
  ...(input.accessToken != null && { accessToken: input.accessToken }),
@@ -1243,26 +793,8 @@ const serializeAws_restJson1UpdateBranchCommand = async (input, context) => {
1243
793
  "content-type": "application/json",
1244
794
  };
1245
795
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}";
1246
- if (input.appId !== undefined) {
1247
- const labelValue = input.appId;
1248
- if (labelValue.length <= 0) {
1249
- throw new Error("Empty value provided for input HTTP label: appId.");
1250
- }
1251
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1252
- }
1253
- else {
1254
- throw new Error("No value provided for input HTTP label: appId.");
1255
- }
1256
- if (input.branchName !== undefined) {
1257
- const labelValue = input.branchName;
1258
- if (labelValue.length <= 0) {
1259
- throw new Error("Empty value provided for input HTTP label: branchName.");
1260
- }
1261
- resolvedPath = resolvedPath.replace("{branchName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1262
- }
1263
- else {
1264
- throw new Error("No value provided for input HTTP label: branchName.");
1265
- }
796
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
797
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "branchName", () => input.branchName, "{branchName}", false);
1266
798
  let body;
1267
799
  body = JSON.stringify({
1268
800
  ...(input.backendEnvironmentArn != null && { backendEnvironmentArn: input.backendEnvironmentArn }),
@@ -1300,26 +832,8 @@ const serializeAws_restJson1UpdateDomainAssociationCommand = async (input, conte
1300
832
  "content-type": "application/json",
1301
833
  };
1302
834
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains/{domainName}";
1303
- if (input.appId !== undefined) {
1304
- const labelValue = input.appId;
1305
- if (labelValue.length <= 0) {
1306
- throw new Error("Empty value provided for input HTTP label: appId.");
1307
- }
1308
- resolvedPath = resolvedPath.replace("{appId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1309
- }
1310
- else {
1311
- throw new Error("No value provided for input HTTP label: appId.");
1312
- }
1313
- if (input.domainName !== undefined) {
1314
- const labelValue = input.domainName;
1315
- if (labelValue.length <= 0) {
1316
- throw new Error("Empty value provided for input HTTP label: domainName.");
1317
- }
1318
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1319
- }
1320
- else {
1321
- throw new Error("No value provided for input HTTP label: domainName.");
1322
- }
835
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "appId", () => input.appId, "{appId}", false);
836
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
1323
837
  let body;
1324
838
  body = JSON.stringify({
1325
839
  ...(input.autoSubDomainCreationPatterns != null && {
@@ -1348,16 +862,7 @@ const serializeAws_restJson1UpdateWebhookCommand = async (input, context) => {
1348
862
  "content-type": "application/json",
1349
863
  };
1350
864
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/webhooks/{webhookId}";
1351
- if (input.webhookId !== undefined) {
1352
- const labelValue = input.webhookId;
1353
- if (labelValue.length <= 0) {
1354
- throw new Error("Empty value provided for input HTTP label: webhookId.");
1355
- }
1356
- resolvedPath = resolvedPath.replace("{webhookId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1357
- }
1358
- else {
1359
- throw new Error("No value provided for input HTTP label: webhookId.");
1360
- }
865
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "webhookId", () => input.webhookId, "{webhookId}", false);
1361
866
  let body;
1362
867
  body = JSON.stringify({
1363
868
  ...(input.branchName != null && { branchName: input.branchName }),
@@ -1378,15 +883,14 @@ const deserializeAws_restJson1CreateAppCommand = async (output, context) => {
1378
883
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1379
884
  return deserializeAws_restJson1CreateAppCommandError(output, context);
1380
885
  }
1381
- const contents = {
886
+ const contents = map({
1382
887
  $metadata: deserializeMetadata(output),
1383
- app: undefined,
1384
- };
888
+ });
1385
889
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1386
- if (data.app !== undefined && data.app !== null) {
890
+ if (data.app != null) {
1387
891
  contents.app = deserializeAws_restJson1App(data.app, context);
1388
892
  }
1389
- return Promise.resolve(contents);
893
+ return contents;
1390
894
  };
1391
895
  exports.deserializeAws_restJson1CreateAppCommand = deserializeAws_restJson1CreateAppCommand;
1392
896
  const deserializeAws_restJson1CreateAppCommandError = async (output, context) => {
@@ -1394,7 +898,6 @@ const deserializeAws_restJson1CreateAppCommandError = async (output, context) =>
1394
898
  ...output,
1395
899
  body: await parseBody(output.body, context),
1396
900
  };
1397
- let response;
1398
901
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1399
902
  switch (errorCode) {
1400
903
  case "BadRequestException":
@@ -1414,29 +917,26 @@ const deserializeAws_restJson1CreateAppCommandError = async (output, context) =>
1414
917
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1415
918
  default:
1416
919
  const parsedBody = parsedOutput.body;
1417
- const $metadata = deserializeMetadata(output);
1418
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1419
- response = new AmplifyServiceException_1.AmplifyServiceException({
1420
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1421
- $fault: "client",
1422
- $metadata,
920
+ (0, smithy_client_1.throwDefaultError)({
921
+ output,
922
+ parsedBody,
923
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
924
+ errorCode,
1423
925
  });
1424
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1425
926
  }
1426
927
  };
1427
928
  const deserializeAws_restJson1CreateBackendEnvironmentCommand = async (output, context) => {
1428
929
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1429
930
  return deserializeAws_restJson1CreateBackendEnvironmentCommandError(output, context);
1430
931
  }
1431
- const contents = {
932
+ const contents = map({
1432
933
  $metadata: deserializeMetadata(output),
1433
- backendEnvironment: undefined,
1434
- };
934
+ });
1435
935
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1436
- if (data.backendEnvironment !== undefined && data.backendEnvironment !== null) {
936
+ if (data.backendEnvironment != null) {
1437
937
  contents.backendEnvironment = deserializeAws_restJson1BackendEnvironment(data.backendEnvironment, context);
1438
938
  }
1439
- return Promise.resolve(contents);
939
+ return contents;
1440
940
  };
1441
941
  exports.deserializeAws_restJson1CreateBackendEnvironmentCommand = deserializeAws_restJson1CreateBackendEnvironmentCommand;
1442
942
  const deserializeAws_restJson1CreateBackendEnvironmentCommandError = async (output, context) => {
@@ -1444,7 +944,6 @@ const deserializeAws_restJson1CreateBackendEnvironmentCommandError = async (outp
1444
944
  ...output,
1445
945
  body: await parseBody(output.body, context),
1446
946
  };
1447
- let response;
1448
947
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1449
948
  switch (errorCode) {
1450
949
  case "BadRequestException":
@@ -1464,29 +963,26 @@ const deserializeAws_restJson1CreateBackendEnvironmentCommandError = async (outp
1464
963
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1465
964
  default:
1466
965
  const parsedBody = parsedOutput.body;
1467
- const $metadata = deserializeMetadata(output);
1468
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1469
- response = new AmplifyServiceException_1.AmplifyServiceException({
1470
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1471
- $fault: "client",
1472
- $metadata,
966
+ (0, smithy_client_1.throwDefaultError)({
967
+ output,
968
+ parsedBody,
969
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
970
+ errorCode,
1473
971
  });
1474
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1475
972
  }
1476
973
  };
1477
974
  const deserializeAws_restJson1CreateBranchCommand = async (output, context) => {
1478
975
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1479
976
  return deserializeAws_restJson1CreateBranchCommandError(output, context);
1480
977
  }
1481
- const contents = {
978
+ const contents = map({
1482
979
  $metadata: deserializeMetadata(output),
1483
- branch: undefined,
1484
- };
980
+ });
1485
981
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1486
- if (data.branch !== undefined && data.branch !== null) {
982
+ if (data.branch != null) {
1487
983
  contents.branch = deserializeAws_restJson1Branch(data.branch, context);
1488
984
  }
1489
- return Promise.resolve(contents);
985
+ return contents;
1490
986
  };
1491
987
  exports.deserializeAws_restJson1CreateBranchCommand = deserializeAws_restJson1CreateBranchCommand;
1492
988
  const deserializeAws_restJson1CreateBranchCommandError = async (output, context) => {
@@ -1494,7 +990,6 @@ const deserializeAws_restJson1CreateBranchCommandError = async (output, context)
1494
990
  ...output,
1495
991
  body: await parseBody(output.body, context),
1496
992
  };
1497
- let response;
1498
993
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1499
994
  switch (errorCode) {
1500
995
  case "BadRequestException":
@@ -1517,37 +1012,32 @@ const deserializeAws_restJson1CreateBranchCommandError = async (output, context)
1517
1012
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1518
1013
  default:
1519
1014
  const parsedBody = parsedOutput.body;
1520
- const $metadata = deserializeMetadata(output);
1521
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1522
- response = new AmplifyServiceException_1.AmplifyServiceException({
1523
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1524
- $fault: "client",
1525
- $metadata,
1015
+ (0, smithy_client_1.throwDefaultError)({
1016
+ output,
1017
+ parsedBody,
1018
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1019
+ errorCode,
1526
1020
  });
1527
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1528
1021
  }
1529
1022
  };
1530
1023
  const deserializeAws_restJson1CreateDeploymentCommand = async (output, context) => {
1531
1024
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1532
1025
  return deserializeAws_restJson1CreateDeploymentCommandError(output, context);
1533
1026
  }
1534
- const contents = {
1027
+ const contents = map({
1535
1028
  $metadata: deserializeMetadata(output),
1536
- fileUploadUrls: undefined,
1537
- jobId: undefined,
1538
- zipUploadUrl: undefined,
1539
- };
1029
+ });
1540
1030
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1541
- if (data.fileUploadUrls !== undefined && data.fileUploadUrls !== null) {
1031
+ if (data.fileUploadUrls != null) {
1542
1032
  contents.fileUploadUrls = deserializeAws_restJson1FileUploadUrls(data.fileUploadUrls, context);
1543
1033
  }
1544
- if (data.jobId !== undefined && data.jobId !== null) {
1034
+ if (data.jobId != null) {
1545
1035
  contents.jobId = (0, smithy_client_1.expectString)(data.jobId);
1546
1036
  }
1547
- if (data.zipUploadUrl !== undefined && data.zipUploadUrl !== null) {
1037
+ if (data.zipUploadUrl != null) {
1548
1038
  contents.zipUploadUrl = (0, smithy_client_1.expectString)(data.zipUploadUrl);
1549
1039
  }
1550
- return Promise.resolve(contents);
1040
+ return contents;
1551
1041
  };
1552
1042
  exports.deserializeAws_restJson1CreateDeploymentCommand = deserializeAws_restJson1CreateDeploymentCommand;
1553
1043
  const deserializeAws_restJson1CreateDeploymentCommandError = async (output, context) => {
@@ -1555,7 +1045,6 @@ const deserializeAws_restJson1CreateDeploymentCommandError = async (output, cont
1555
1045
  ...output,
1556
1046
  body: await parseBody(output.body, context),
1557
1047
  };
1558
- let response;
1559
1048
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1560
1049
  switch (errorCode) {
1561
1050
  case "BadRequestException":
@@ -1572,29 +1061,26 @@ const deserializeAws_restJson1CreateDeploymentCommandError = async (output, cont
1572
1061
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1573
1062
  default:
1574
1063
  const parsedBody = parsedOutput.body;
1575
- const $metadata = deserializeMetadata(output);
1576
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1577
- response = new AmplifyServiceException_1.AmplifyServiceException({
1578
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1579
- $fault: "client",
1580
- $metadata,
1064
+ (0, smithy_client_1.throwDefaultError)({
1065
+ output,
1066
+ parsedBody,
1067
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1068
+ errorCode,
1581
1069
  });
1582
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1583
1070
  }
1584
1071
  };
1585
1072
  const deserializeAws_restJson1CreateDomainAssociationCommand = async (output, context) => {
1586
1073
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1587
1074
  return deserializeAws_restJson1CreateDomainAssociationCommandError(output, context);
1588
1075
  }
1589
- const contents = {
1076
+ const contents = map({
1590
1077
  $metadata: deserializeMetadata(output),
1591
- domainAssociation: undefined,
1592
- };
1078
+ });
1593
1079
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1594
- if (data.domainAssociation !== undefined && data.domainAssociation !== null) {
1080
+ if (data.domainAssociation != null) {
1595
1081
  contents.domainAssociation = deserializeAws_restJson1DomainAssociation(data.domainAssociation, context);
1596
1082
  }
1597
- return Promise.resolve(contents);
1083
+ return contents;
1598
1084
  };
1599
1085
  exports.deserializeAws_restJson1CreateDomainAssociationCommand = deserializeAws_restJson1CreateDomainAssociationCommand;
1600
1086
  const deserializeAws_restJson1CreateDomainAssociationCommandError = async (output, context) => {
@@ -1602,7 +1088,6 @@ const deserializeAws_restJson1CreateDomainAssociationCommandError = async (outpu
1602
1088
  ...output,
1603
1089
  body: await parseBody(output.body, context),
1604
1090
  };
1605
- let response;
1606
1091
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1607
1092
  switch (errorCode) {
1608
1093
  case "BadRequestException":
@@ -1625,29 +1110,26 @@ const deserializeAws_restJson1CreateDomainAssociationCommandError = async (outpu
1625
1110
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1626
1111
  default:
1627
1112
  const parsedBody = parsedOutput.body;
1628
- const $metadata = deserializeMetadata(output);
1629
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1630
- response = new AmplifyServiceException_1.AmplifyServiceException({
1631
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1632
- $fault: "client",
1633
- $metadata,
1113
+ (0, smithy_client_1.throwDefaultError)({
1114
+ output,
1115
+ parsedBody,
1116
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1117
+ errorCode,
1634
1118
  });
1635
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1636
1119
  }
1637
1120
  };
1638
1121
  const deserializeAws_restJson1CreateWebhookCommand = async (output, context) => {
1639
1122
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1640
1123
  return deserializeAws_restJson1CreateWebhookCommandError(output, context);
1641
1124
  }
1642
- const contents = {
1125
+ const contents = map({
1643
1126
  $metadata: deserializeMetadata(output),
1644
- webhook: undefined,
1645
- };
1127
+ });
1646
1128
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1647
- if (data.webhook !== undefined && data.webhook !== null) {
1129
+ if (data.webhook != null) {
1648
1130
  contents.webhook = deserializeAws_restJson1Webhook(data.webhook, context);
1649
1131
  }
1650
- return Promise.resolve(contents);
1132
+ return contents;
1651
1133
  };
1652
1134
  exports.deserializeAws_restJson1CreateWebhookCommand = deserializeAws_restJson1CreateWebhookCommand;
1653
1135
  const deserializeAws_restJson1CreateWebhookCommandError = async (output, context) => {
@@ -1655,7 +1137,6 @@ const deserializeAws_restJson1CreateWebhookCommandError = async (output, context
1655
1137
  ...output,
1656
1138
  body: await parseBody(output.body, context),
1657
1139
  };
1658
- let response;
1659
1140
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1660
1141
  switch (errorCode) {
1661
1142
  case "BadRequestException":
@@ -1678,29 +1159,26 @@ const deserializeAws_restJson1CreateWebhookCommandError = async (output, context
1678
1159
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1679
1160
  default:
1680
1161
  const parsedBody = parsedOutput.body;
1681
- const $metadata = deserializeMetadata(output);
1682
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1683
- response = new AmplifyServiceException_1.AmplifyServiceException({
1684
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1685
- $fault: "client",
1686
- $metadata,
1162
+ (0, smithy_client_1.throwDefaultError)({
1163
+ output,
1164
+ parsedBody,
1165
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1166
+ errorCode,
1687
1167
  });
1688
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1689
1168
  }
1690
1169
  };
1691
1170
  const deserializeAws_restJson1DeleteAppCommand = async (output, context) => {
1692
1171
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1693
1172
  return deserializeAws_restJson1DeleteAppCommandError(output, context);
1694
1173
  }
1695
- const contents = {
1174
+ const contents = map({
1696
1175
  $metadata: deserializeMetadata(output),
1697
- app: undefined,
1698
- };
1176
+ });
1699
1177
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1700
- if (data.app !== undefined && data.app !== null) {
1178
+ if (data.app != null) {
1701
1179
  contents.app = deserializeAws_restJson1App(data.app, context);
1702
1180
  }
1703
- return Promise.resolve(contents);
1181
+ return contents;
1704
1182
  };
1705
1183
  exports.deserializeAws_restJson1DeleteAppCommand = deserializeAws_restJson1DeleteAppCommand;
1706
1184
  const deserializeAws_restJson1DeleteAppCommandError = async (output, context) => {
@@ -1708,7 +1186,6 @@ const deserializeAws_restJson1DeleteAppCommandError = async (output, context) =>
1708
1186
  ...output,
1709
1187
  body: await parseBody(output.body, context),
1710
1188
  };
1711
- let response;
1712
1189
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1713
1190
  switch (errorCode) {
1714
1191
  case "BadRequestException":
@@ -1728,29 +1205,26 @@ const deserializeAws_restJson1DeleteAppCommandError = async (output, context) =>
1728
1205
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1729
1206
  default:
1730
1207
  const parsedBody = parsedOutput.body;
1731
- const $metadata = deserializeMetadata(output);
1732
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1733
- response = new AmplifyServiceException_1.AmplifyServiceException({
1734
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1735
- $fault: "client",
1736
- $metadata,
1208
+ (0, smithy_client_1.throwDefaultError)({
1209
+ output,
1210
+ parsedBody,
1211
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1212
+ errorCode,
1737
1213
  });
1738
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1739
1214
  }
1740
1215
  };
1741
1216
  const deserializeAws_restJson1DeleteBackendEnvironmentCommand = async (output, context) => {
1742
1217
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1743
1218
  return deserializeAws_restJson1DeleteBackendEnvironmentCommandError(output, context);
1744
1219
  }
1745
- const contents = {
1220
+ const contents = map({
1746
1221
  $metadata: deserializeMetadata(output),
1747
- backendEnvironment: undefined,
1748
- };
1222
+ });
1749
1223
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1750
- if (data.backendEnvironment !== undefined && data.backendEnvironment !== null) {
1224
+ if (data.backendEnvironment != null) {
1751
1225
  contents.backendEnvironment = deserializeAws_restJson1BackendEnvironment(data.backendEnvironment, context);
1752
1226
  }
1753
- return Promise.resolve(contents);
1227
+ return contents;
1754
1228
  };
1755
1229
  exports.deserializeAws_restJson1DeleteBackendEnvironmentCommand = deserializeAws_restJson1DeleteBackendEnvironmentCommand;
1756
1230
  const deserializeAws_restJson1DeleteBackendEnvironmentCommandError = async (output, context) => {
@@ -1758,7 +1232,6 @@ const deserializeAws_restJson1DeleteBackendEnvironmentCommandError = async (outp
1758
1232
  ...output,
1759
1233
  body: await parseBody(output.body, context),
1760
1234
  };
1761
- let response;
1762
1235
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1763
1236
  switch (errorCode) {
1764
1237
  case "BadRequestException":
@@ -1778,29 +1251,26 @@ const deserializeAws_restJson1DeleteBackendEnvironmentCommandError = async (outp
1778
1251
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1779
1252
  default:
1780
1253
  const parsedBody = parsedOutput.body;
1781
- const $metadata = deserializeMetadata(output);
1782
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1783
- response = new AmplifyServiceException_1.AmplifyServiceException({
1784
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1785
- $fault: "client",
1786
- $metadata,
1254
+ (0, smithy_client_1.throwDefaultError)({
1255
+ output,
1256
+ parsedBody,
1257
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1258
+ errorCode,
1787
1259
  });
1788
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1789
1260
  }
1790
1261
  };
1791
1262
  const deserializeAws_restJson1DeleteBranchCommand = async (output, context) => {
1792
1263
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1793
1264
  return deserializeAws_restJson1DeleteBranchCommandError(output, context);
1794
1265
  }
1795
- const contents = {
1266
+ const contents = map({
1796
1267
  $metadata: deserializeMetadata(output),
1797
- branch: undefined,
1798
- };
1268
+ });
1799
1269
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1800
- if (data.branch !== undefined && data.branch !== null) {
1270
+ if (data.branch != null) {
1801
1271
  contents.branch = deserializeAws_restJson1Branch(data.branch, context);
1802
1272
  }
1803
- return Promise.resolve(contents);
1273
+ return contents;
1804
1274
  };
1805
1275
  exports.deserializeAws_restJson1DeleteBranchCommand = deserializeAws_restJson1DeleteBranchCommand;
1806
1276
  const deserializeAws_restJson1DeleteBranchCommandError = async (output, context) => {
@@ -1808,7 +1278,6 @@ const deserializeAws_restJson1DeleteBranchCommandError = async (output, context)
1808
1278
  ...output,
1809
1279
  body: await parseBody(output.body, context),
1810
1280
  };
1811
- let response;
1812
1281
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1813
1282
  switch (errorCode) {
1814
1283
  case "BadRequestException":
@@ -1828,29 +1297,26 @@ const deserializeAws_restJson1DeleteBranchCommandError = async (output, context)
1828
1297
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1829
1298
  default:
1830
1299
  const parsedBody = parsedOutput.body;
1831
- const $metadata = deserializeMetadata(output);
1832
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1833
- response = new AmplifyServiceException_1.AmplifyServiceException({
1834
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1835
- $fault: "client",
1836
- $metadata,
1300
+ (0, smithy_client_1.throwDefaultError)({
1301
+ output,
1302
+ parsedBody,
1303
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1304
+ errorCode,
1837
1305
  });
1838
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1839
1306
  }
1840
1307
  };
1841
1308
  const deserializeAws_restJson1DeleteDomainAssociationCommand = async (output, context) => {
1842
1309
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1843
1310
  return deserializeAws_restJson1DeleteDomainAssociationCommandError(output, context);
1844
1311
  }
1845
- const contents = {
1312
+ const contents = map({
1846
1313
  $metadata: deserializeMetadata(output),
1847
- domainAssociation: undefined,
1848
- };
1314
+ });
1849
1315
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1850
- if (data.domainAssociation !== undefined && data.domainAssociation !== null) {
1316
+ if (data.domainAssociation != null) {
1851
1317
  contents.domainAssociation = deserializeAws_restJson1DomainAssociation(data.domainAssociation, context);
1852
1318
  }
1853
- return Promise.resolve(contents);
1319
+ return contents;
1854
1320
  };
1855
1321
  exports.deserializeAws_restJson1DeleteDomainAssociationCommand = deserializeAws_restJson1DeleteDomainAssociationCommand;
1856
1322
  const deserializeAws_restJson1DeleteDomainAssociationCommandError = async (output, context) => {
@@ -1858,7 +1324,6 @@ const deserializeAws_restJson1DeleteDomainAssociationCommandError = async (outpu
1858
1324
  ...output,
1859
1325
  body: await parseBody(output.body, context),
1860
1326
  };
1861
- let response;
1862
1327
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1863
1328
  switch (errorCode) {
1864
1329
  case "BadRequestException":
@@ -1878,29 +1343,26 @@ const deserializeAws_restJson1DeleteDomainAssociationCommandError = async (outpu
1878
1343
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1879
1344
  default:
1880
1345
  const parsedBody = parsedOutput.body;
1881
- const $metadata = deserializeMetadata(output);
1882
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1883
- response = new AmplifyServiceException_1.AmplifyServiceException({
1884
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1885
- $fault: "client",
1886
- $metadata,
1346
+ (0, smithy_client_1.throwDefaultError)({
1347
+ output,
1348
+ parsedBody,
1349
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1350
+ errorCode,
1887
1351
  });
1888
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1889
1352
  }
1890
1353
  };
1891
1354
  const deserializeAws_restJson1DeleteJobCommand = async (output, context) => {
1892
1355
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1893
1356
  return deserializeAws_restJson1DeleteJobCommandError(output, context);
1894
1357
  }
1895
- const contents = {
1358
+ const contents = map({
1896
1359
  $metadata: deserializeMetadata(output),
1897
- jobSummary: undefined,
1898
- };
1360
+ });
1899
1361
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1900
- if (data.jobSummary !== undefined && data.jobSummary !== null) {
1362
+ if (data.jobSummary != null) {
1901
1363
  contents.jobSummary = deserializeAws_restJson1JobSummary(data.jobSummary, context);
1902
1364
  }
1903
- return Promise.resolve(contents);
1365
+ return contents;
1904
1366
  };
1905
1367
  exports.deserializeAws_restJson1DeleteJobCommand = deserializeAws_restJson1DeleteJobCommand;
1906
1368
  const deserializeAws_restJson1DeleteJobCommandError = async (output, context) => {
@@ -1908,7 +1370,6 @@ const deserializeAws_restJson1DeleteJobCommandError = async (output, context) =>
1908
1370
  ...output,
1909
1371
  body: await parseBody(output.body, context),
1910
1372
  };
1911
- let response;
1912
1373
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1913
1374
  switch (errorCode) {
1914
1375
  case "BadRequestException":
@@ -1928,29 +1389,26 @@ const deserializeAws_restJson1DeleteJobCommandError = async (output, context) =>
1928
1389
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1929
1390
  default:
1930
1391
  const parsedBody = parsedOutput.body;
1931
- const $metadata = deserializeMetadata(output);
1932
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1933
- response = new AmplifyServiceException_1.AmplifyServiceException({
1934
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1935
- $fault: "client",
1936
- $metadata,
1392
+ (0, smithy_client_1.throwDefaultError)({
1393
+ output,
1394
+ parsedBody,
1395
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1396
+ errorCode,
1937
1397
  });
1938
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1939
1398
  }
1940
1399
  };
1941
1400
  const deserializeAws_restJson1DeleteWebhookCommand = async (output, context) => {
1942
1401
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1943
1402
  return deserializeAws_restJson1DeleteWebhookCommandError(output, context);
1944
1403
  }
1945
- const contents = {
1404
+ const contents = map({
1946
1405
  $metadata: deserializeMetadata(output),
1947
- webhook: undefined,
1948
- };
1406
+ });
1949
1407
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1950
- if (data.webhook !== undefined && data.webhook !== null) {
1408
+ if (data.webhook != null) {
1951
1409
  contents.webhook = deserializeAws_restJson1Webhook(data.webhook, context);
1952
1410
  }
1953
- return Promise.resolve(contents);
1411
+ return contents;
1954
1412
  };
1955
1413
  exports.deserializeAws_restJson1DeleteWebhookCommand = deserializeAws_restJson1DeleteWebhookCommand;
1956
1414
  const deserializeAws_restJson1DeleteWebhookCommandError = async (output, context) => {
@@ -1958,7 +1416,6 @@ const deserializeAws_restJson1DeleteWebhookCommandError = async (output, context
1958
1416
  ...output,
1959
1417
  body: await parseBody(output.body, context),
1960
1418
  };
1961
- let response;
1962
1419
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1963
1420
  switch (errorCode) {
1964
1421
  case "BadRequestException":
@@ -1978,29 +1435,26 @@ const deserializeAws_restJson1DeleteWebhookCommandError = async (output, context
1978
1435
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1979
1436
  default:
1980
1437
  const parsedBody = parsedOutput.body;
1981
- const $metadata = deserializeMetadata(output);
1982
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1983
- response = new AmplifyServiceException_1.AmplifyServiceException({
1984
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1985
- $fault: "client",
1986
- $metadata,
1438
+ (0, smithy_client_1.throwDefaultError)({
1439
+ output,
1440
+ parsedBody,
1441
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1442
+ errorCode,
1987
1443
  });
1988
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1989
1444
  }
1990
1445
  };
1991
1446
  const deserializeAws_restJson1GenerateAccessLogsCommand = async (output, context) => {
1992
1447
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1993
1448
  return deserializeAws_restJson1GenerateAccessLogsCommandError(output, context);
1994
1449
  }
1995
- const contents = {
1450
+ const contents = map({
1996
1451
  $metadata: deserializeMetadata(output),
1997
- logUrl: undefined,
1998
- };
1452
+ });
1999
1453
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2000
- if (data.logUrl !== undefined && data.logUrl !== null) {
1454
+ if (data.logUrl != null) {
2001
1455
  contents.logUrl = (0, smithy_client_1.expectString)(data.logUrl);
2002
1456
  }
2003
- return Promise.resolve(contents);
1457
+ return contents;
2004
1458
  };
2005
1459
  exports.deserializeAws_restJson1GenerateAccessLogsCommand = deserializeAws_restJson1GenerateAccessLogsCommand;
2006
1460
  const deserializeAws_restJson1GenerateAccessLogsCommandError = async (output, context) => {
@@ -2008,7 +1462,6 @@ const deserializeAws_restJson1GenerateAccessLogsCommandError = async (output, co
2008
1462
  ...output,
2009
1463
  body: await parseBody(output.body, context),
2010
1464
  };
2011
- let response;
2012
1465
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2013
1466
  switch (errorCode) {
2014
1467
  case "BadRequestException":
@@ -2025,29 +1478,26 @@ const deserializeAws_restJson1GenerateAccessLogsCommandError = async (output, co
2025
1478
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2026
1479
  default:
2027
1480
  const parsedBody = parsedOutput.body;
2028
- const $metadata = deserializeMetadata(output);
2029
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2030
- response = new AmplifyServiceException_1.AmplifyServiceException({
2031
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2032
- $fault: "client",
2033
- $metadata,
1481
+ (0, smithy_client_1.throwDefaultError)({
1482
+ output,
1483
+ parsedBody,
1484
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1485
+ errorCode,
2034
1486
  });
2035
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2036
1487
  }
2037
1488
  };
2038
1489
  const deserializeAws_restJson1GetAppCommand = async (output, context) => {
2039
1490
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2040
1491
  return deserializeAws_restJson1GetAppCommandError(output, context);
2041
1492
  }
2042
- const contents = {
1493
+ const contents = map({
2043
1494
  $metadata: deserializeMetadata(output),
2044
- app: undefined,
2045
- };
1495
+ });
2046
1496
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2047
- if (data.app !== undefined && data.app !== null) {
1497
+ if (data.app != null) {
2048
1498
  contents.app = deserializeAws_restJson1App(data.app, context);
2049
1499
  }
2050
- return Promise.resolve(contents);
1500
+ return contents;
2051
1501
  };
2052
1502
  exports.deserializeAws_restJson1GetAppCommand = deserializeAws_restJson1GetAppCommand;
2053
1503
  const deserializeAws_restJson1GetAppCommandError = async (output, context) => {
@@ -2055,7 +1505,6 @@ const deserializeAws_restJson1GetAppCommandError = async (output, context) => {
2055
1505
  ...output,
2056
1506
  body: await parseBody(output.body, context),
2057
1507
  };
2058
- let response;
2059
1508
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2060
1509
  switch (errorCode) {
2061
1510
  case "BadRequestException":
@@ -2072,33 +1521,29 @@ const deserializeAws_restJson1GetAppCommandError = async (output, context) => {
2072
1521
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2073
1522
  default:
2074
1523
  const parsedBody = parsedOutput.body;
2075
- const $metadata = deserializeMetadata(output);
2076
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2077
- response = new AmplifyServiceException_1.AmplifyServiceException({
2078
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2079
- $fault: "client",
2080
- $metadata,
1524
+ (0, smithy_client_1.throwDefaultError)({
1525
+ output,
1526
+ parsedBody,
1527
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1528
+ errorCode,
2081
1529
  });
2082
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2083
1530
  }
2084
1531
  };
2085
1532
  const deserializeAws_restJson1GetArtifactUrlCommand = async (output, context) => {
2086
1533
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2087
1534
  return deserializeAws_restJson1GetArtifactUrlCommandError(output, context);
2088
1535
  }
2089
- const contents = {
1536
+ const contents = map({
2090
1537
  $metadata: deserializeMetadata(output),
2091
- artifactId: undefined,
2092
- artifactUrl: undefined,
2093
- };
1538
+ });
2094
1539
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2095
- if (data.artifactId !== undefined && data.artifactId !== null) {
1540
+ if (data.artifactId != null) {
2096
1541
  contents.artifactId = (0, smithy_client_1.expectString)(data.artifactId);
2097
1542
  }
2098
- if (data.artifactUrl !== undefined && data.artifactUrl !== null) {
1543
+ if (data.artifactUrl != null) {
2099
1544
  contents.artifactUrl = (0, smithy_client_1.expectString)(data.artifactUrl);
2100
1545
  }
2101
- return Promise.resolve(contents);
1546
+ return contents;
2102
1547
  };
2103
1548
  exports.deserializeAws_restJson1GetArtifactUrlCommand = deserializeAws_restJson1GetArtifactUrlCommand;
2104
1549
  const deserializeAws_restJson1GetArtifactUrlCommandError = async (output, context) => {
@@ -2106,7 +1551,6 @@ const deserializeAws_restJson1GetArtifactUrlCommandError = async (output, contex
2106
1551
  ...output,
2107
1552
  body: await parseBody(output.body, context),
2108
1553
  };
2109
- let response;
2110
1554
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2111
1555
  switch (errorCode) {
2112
1556
  case "BadRequestException":
@@ -2126,29 +1570,26 @@ const deserializeAws_restJson1GetArtifactUrlCommandError = async (output, contex
2126
1570
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2127
1571
  default:
2128
1572
  const parsedBody = parsedOutput.body;
2129
- const $metadata = deserializeMetadata(output);
2130
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2131
- response = new AmplifyServiceException_1.AmplifyServiceException({
2132
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2133
- $fault: "client",
2134
- $metadata,
1573
+ (0, smithy_client_1.throwDefaultError)({
1574
+ output,
1575
+ parsedBody,
1576
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1577
+ errorCode,
2135
1578
  });
2136
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2137
1579
  }
2138
1580
  };
2139
1581
  const deserializeAws_restJson1GetBackendEnvironmentCommand = async (output, context) => {
2140
1582
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2141
1583
  return deserializeAws_restJson1GetBackendEnvironmentCommandError(output, context);
2142
1584
  }
2143
- const contents = {
1585
+ const contents = map({
2144
1586
  $metadata: deserializeMetadata(output),
2145
- backendEnvironment: undefined,
2146
- };
1587
+ });
2147
1588
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2148
- if (data.backendEnvironment !== undefined && data.backendEnvironment !== null) {
1589
+ if (data.backendEnvironment != null) {
2149
1590
  contents.backendEnvironment = deserializeAws_restJson1BackendEnvironment(data.backendEnvironment, context);
2150
1591
  }
2151
- return Promise.resolve(contents);
1592
+ return contents;
2152
1593
  };
2153
1594
  exports.deserializeAws_restJson1GetBackendEnvironmentCommand = deserializeAws_restJson1GetBackendEnvironmentCommand;
2154
1595
  const deserializeAws_restJson1GetBackendEnvironmentCommandError = async (output, context) => {
@@ -2156,7 +1597,6 @@ const deserializeAws_restJson1GetBackendEnvironmentCommandError = async (output,
2156
1597
  ...output,
2157
1598
  body: await parseBody(output.body, context),
2158
1599
  };
2159
- let response;
2160
1600
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2161
1601
  switch (errorCode) {
2162
1602
  case "BadRequestException":
@@ -2173,29 +1613,26 @@ const deserializeAws_restJson1GetBackendEnvironmentCommandError = async (output,
2173
1613
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2174
1614
  default:
2175
1615
  const parsedBody = parsedOutput.body;
2176
- const $metadata = deserializeMetadata(output);
2177
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2178
- response = new AmplifyServiceException_1.AmplifyServiceException({
2179
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2180
- $fault: "client",
2181
- $metadata,
1616
+ (0, smithy_client_1.throwDefaultError)({
1617
+ output,
1618
+ parsedBody,
1619
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1620
+ errorCode,
2182
1621
  });
2183
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2184
1622
  }
2185
1623
  };
2186
1624
  const deserializeAws_restJson1GetBranchCommand = async (output, context) => {
2187
1625
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2188
1626
  return deserializeAws_restJson1GetBranchCommandError(output, context);
2189
1627
  }
2190
- const contents = {
1628
+ const contents = map({
2191
1629
  $metadata: deserializeMetadata(output),
2192
- branch: undefined,
2193
- };
1630
+ });
2194
1631
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2195
- if (data.branch !== undefined && data.branch !== null) {
1632
+ if (data.branch != null) {
2196
1633
  contents.branch = deserializeAws_restJson1Branch(data.branch, context);
2197
1634
  }
2198
- return Promise.resolve(contents);
1635
+ return contents;
2199
1636
  };
2200
1637
  exports.deserializeAws_restJson1GetBranchCommand = deserializeAws_restJson1GetBranchCommand;
2201
1638
  const deserializeAws_restJson1GetBranchCommandError = async (output, context) => {
@@ -2203,7 +1640,6 @@ const deserializeAws_restJson1GetBranchCommandError = async (output, context) =>
2203
1640
  ...output,
2204
1641
  body: await parseBody(output.body, context),
2205
1642
  };
2206
- let response;
2207
1643
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2208
1644
  switch (errorCode) {
2209
1645
  case "BadRequestException":
@@ -2220,29 +1656,26 @@ const deserializeAws_restJson1GetBranchCommandError = async (output, context) =>
2220
1656
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2221
1657
  default:
2222
1658
  const parsedBody = parsedOutput.body;
2223
- const $metadata = deserializeMetadata(output);
2224
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2225
- response = new AmplifyServiceException_1.AmplifyServiceException({
2226
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2227
- $fault: "client",
2228
- $metadata,
1659
+ (0, smithy_client_1.throwDefaultError)({
1660
+ output,
1661
+ parsedBody,
1662
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1663
+ errorCode,
2229
1664
  });
2230
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2231
1665
  }
2232
1666
  };
2233
1667
  const deserializeAws_restJson1GetDomainAssociationCommand = async (output, context) => {
2234
1668
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2235
1669
  return deserializeAws_restJson1GetDomainAssociationCommandError(output, context);
2236
1670
  }
2237
- const contents = {
1671
+ const contents = map({
2238
1672
  $metadata: deserializeMetadata(output),
2239
- domainAssociation: undefined,
2240
- };
1673
+ });
2241
1674
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2242
- if (data.domainAssociation !== undefined && data.domainAssociation !== null) {
1675
+ if (data.domainAssociation != null) {
2243
1676
  contents.domainAssociation = deserializeAws_restJson1DomainAssociation(data.domainAssociation, context);
2244
1677
  }
2245
- return Promise.resolve(contents);
1678
+ return contents;
2246
1679
  };
2247
1680
  exports.deserializeAws_restJson1GetDomainAssociationCommand = deserializeAws_restJson1GetDomainAssociationCommand;
2248
1681
  const deserializeAws_restJson1GetDomainAssociationCommandError = async (output, context) => {
@@ -2250,7 +1683,6 @@ const deserializeAws_restJson1GetDomainAssociationCommandError = async (output,
2250
1683
  ...output,
2251
1684
  body: await parseBody(output.body, context),
2252
1685
  };
2253
- let response;
2254
1686
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2255
1687
  switch (errorCode) {
2256
1688
  case "BadRequestException":
@@ -2267,29 +1699,26 @@ const deserializeAws_restJson1GetDomainAssociationCommandError = async (output,
2267
1699
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2268
1700
  default:
2269
1701
  const parsedBody = parsedOutput.body;
2270
- const $metadata = deserializeMetadata(output);
2271
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2272
- response = new AmplifyServiceException_1.AmplifyServiceException({
2273
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2274
- $fault: "client",
2275
- $metadata,
1702
+ (0, smithy_client_1.throwDefaultError)({
1703
+ output,
1704
+ parsedBody,
1705
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1706
+ errorCode,
2276
1707
  });
2277
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2278
1708
  }
2279
1709
  };
2280
1710
  const deserializeAws_restJson1GetJobCommand = async (output, context) => {
2281
1711
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2282
1712
  return deserializeAws_restJson1GetJobCommandError(output, context);
2283
1713
  }
2284
- const contents = {
1714
+ const contents = map({
2285
1715
  $metadata: deserializeMetadata(output),
2286
- job: undefined,
2287
- };
1716
+ });
2288
1717
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2289
- if (data.job !== undefined && data.job !== null) {
1718
+ if (data.job != null) {
2290
1719
  contents.job = deserializeAws_restJson1Job(data.job, context);
2291
1720
  }
2292
- return Promise.resolve(contents);
1721
+ return contents;
2293
1722
  };
2294
1723
  exports.deserializeAws_restJson1GetJobCommand = deserializeAws_restJson1GetJobCommand;
2295
1724
  const deserializeAws_restJson1GetJobCommandError = async (output, context) => {
@@ -2297,7 +1726,6 @@ const deserializeAws_restJson1GetJobCommandError = async (output, context) => {
2297
1726
  ...output,
2298
1727
  body: await parseBody(output.body, context),
2299
1728
  };
2300
- let response;
2301
1729
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2302
1730
  switch (errorCode) {
2303
1731
  case "BadRequestException":
@@ -2317,29 +1745,26 @@ const deserializeAws_restJson1GetJobCommandError = async (output, context) => {
2317
1745
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2318
1746
  default:
2319
1747
  const parsedBody = parsedOutput.body;
2320
- const $metadata = deserializeMetadata(output);
2321
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2322
- response = new AmplifyServiceException_1.AmplifyServiceException({
2323
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2324
- $fault: "client",
2325
- $metadata,
1748
+ (0, smithy_client_1.throwDefaultError)({
1749
+ output,
1750
+ parsedBody,
1751
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1752
+ errorCode,
2326
1753
  });
2327
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2328
1754
  }
2329
1755
  };
2330
1756
  const deserializeAws_restJson1GetWebhookCommand = async (output, context) => {
2331
1757
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2332
1758
  return deserializeAws_restJson1GetWebhookCommandError(output, context);
2333
1759
  }
2334
- const contents = {
1760
+ const contents = map({
2335
1761
  $metadata: deserializeMetadata(output),
2336
- webhook: undefined,
2337
- };
1762
+ });
2338
1763
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2339
- if (data.webhook !== undefined && data.webhook !== null) {
1764
+ if (data.webhook != null) {
2340
1765
  contents.webhook = deserializeAws_restJson1Webhook(data.webhook, context);
2341
1766
  }
2342
- return Promise.resolve(contents);
1767
+ return contents;
2343
1768
  };
2344
1769
  exports.deserializeAws_restJson1GetWebhookCommand = deserializeAws_restJson1GetWebhookCommand;
2345
1770
  const deserializeAws_restJson1GetWebhookCommandError = async (output, context) => {
@@ -2347,7 +1772,6 @@ const deserializeAws_restJson1GetWebhookCommandError = async (output, context) =
2347
1772
  ...output,
2348
1773
  body: await parseBody(output.body, context),
2349
1774
  };
2350
- let response;
2351
1775
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2352
1776
  switch (errorCode) {
2353
1777
  case "BadRequestException":
@@ -2367,33 +1791,29 @@ const deserializeAws_restJson1GetWebhookCommandError = async (output, context) =
2367
1791
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2368
1792
  default:
2369
1793
  const parsedBody = parsedOutput.body;
2370
- const $metadata = deserializeMetadata(output);
2371
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2372
- response = new AmplifyServiceException_1.AmplifyServiceException({
2373
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2374
- $fault: "client",
2375
- $metadata,
1794
+ (0, smithy_client_1.throwDefaultError)({
1795
+ output,
1796
+ parsedBody,
1797
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1798
+ errorCode,
2376
1799
  });
2377
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2378
1800
  }
2379
1801
  };
2380
1802
  const deserializeAws_restJson1ListAppsCommand = async (output, context) => {
2381
1803
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2382
1804
  return deserializeAws_restJson1ListAppsCommandError(output, context);
2383
1805
  }
2384
- const contents = {
1806
+ const contents = map({
2385
1807
  $metadata: deserializeMetadata(output),
2386
- apps: undefined,
2387
- nextToken: undefined,
2388
- };
1808
+ });
2389
1809
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2390
- if (data.apps !== undefined && data.apps !== null) {
1810
+ if (data.apps != null) {
2391
1811
  contents.apps = deserializeAws_restJson1Apps(data.apps, context);
2392
1812
  }
2393
- if (data.nextToken !== undefined && data.nextToken !== null) {
1813
+ if (data.nextToken != null) {
2394
1814
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2395
1815
  }
2396
- return Promise.resolve(contents);
1816
+ return contents;
2397
1817
  };
2398
1818
  exports.deserializeAws_restJson1ListAppsCommand = deserializeAws_restJson1ListAppsCommand;
2399
1819
  const deserializeAws_restJson1ListAppsCommandError = async (output, context) => {
@@ -2401,7 +1821,6 @@ const deserializeAws_restJson1ListAppsCommandError = async (output, context) =>
2401
1821
  ...output,
2402
1822
  body: await parseBody(output.body, context),
2403
1823
  };
2404
- let response;
2405
1824
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2406
1825
  switch (errorCode) {
2407
1826
  case "BadRequestException":
@@ -2415,33 +1834,29 @@ const deserializeAws_restJson1ListAppsCommandError = async (output, context) =>
2415
1834
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2416
1835
  default:
2417
1836
  const parsedBody = parsedOutput.body;
2418
- const $metadata = deserializeMetadata(output);
2419
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2420
- response = new AmplifyServiceException_1.AmplifyServiceException({
2421
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2422
- $fault: "client",
2423
- $metadata,
1837
+ (0, smithy_client_1.throwDefaultError)({
1838
+ output,
1839
+ parsedBody,
1840
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1841
+ errorCode,
2424
1842
  });
2425
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2426
1843
  }
2427
1844
  };
2428
1845
  const deserializeAws_restJson1ListArtifactsCommand = async (output, context) => {
2429
1846
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2430
1847
  return deserializeAws_restJson1ListArtifactsCommandError(output, context);
2431
1848
  }
2432
- const contents = {
1849
+ const contents = map({
2433
1850
  $metadata: deserializeMetadata(output),
2434
- artifacts: undefined,
2435
- nextToken: undefined,
2436
- };
1851
+ });
2437
1852
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2438
- if (data.artifacts !== undefined && data.artifacts !== null) {
1853
+ if (data.artifacts != null) {
2439
1854
  contents.artifacts = deserializeAws_restJson1Artifacts(data.artifacts, context);
2440
1855
  }
2441
- if (data.nextToken !== undefined && data.nextToken !== null) {
1856
+ if (data.nextToken != null) {
2442
1857
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2443
1858
  }
2444
- return Promise.resolve(contents);
1859
+ return contents;
2445
1860
  };
2446
1861
  exports.deserializeAws_restJson1ListArtifactsCommand = deserializeAws_restJson1ListArtifactsCommand;
2447
1862
  const deserializeAws_restJson1ListArtifactsCommandError = async (output, context) => {
@@ -2449,7 +1864,6 @@ const deserializeAws_restJson1ListArtifactsCommandError = async (output, context
2449
1864
  ...output,
2450
1865
  body: await parseBody(output.body, context),
2451
1866
  };
2452
- let response;
2453
1867
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2454
1868
  switch (errorCode) {
2455
1869
  case "BadRequestException":
@@ -2466,33 +1880,29 @@ const deserializeAws_restJson1ListArtifactsCommandError = async (output, context
2466
1880
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2467
1881
  default:
2468
1882
  const parsedBody = parsedOutput.body;
2469
- const $metadata = deserializeMetadata(output);
2470
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2471
- response = new AmplifyServiceException_1.AmplifyServiceException({
2472
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2473
- $fault: "client",
2474
- $metadata,
1883
+ (0, smithy_client_1.throwDefaultError)({
1884
+ output,
1885
+ parsedBody,
1886
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1887
+ errorCode,
2475
1888
  });
2476
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2477
1889
  }
2478
1890
  };
2479
1891
  const deserializeAws_restJson1ListBackendEnvironmentsCommand = async (output, context) => {
2480
1892
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2481
1893
  return deserializeAws_restJson1ListBackendEnvironmentsCommandError(output, context);
2482
1894
  }
2483
- const contents = {
1895
+ const contents = map({
2484
1896
  $metadata: deserializeMetadata(output),
2485
- backendEnvironments: undefined,
2486
- nextToken: undefined,
2487
- };
1897
+ });
2488
1898
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2489
- if (data.backendEnvironments !== undefined && data.backendEnvironments !== null) {
1899
+ if (data.backendEnvironments != null) {
2490
1900
  contents.backendEnvironments = deserializeAws_restJson1BackendEnvironments(data.backendEnvironments, context);
2491
1901
  }
2492
- if (data.nextToken !== undefined && data.nextToken !== null) {
1902
+ if (data.nextToken != null) {
2493
1903
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2494
1904
  }
2495
- return Promise.resolve(contents);
1905
+ return contents;
2496
1906
  };
2497
1907
  exports.deserializeAws_restJson1ListBackendEnvironmentsCommand = deserializeAws_restJson1ListBackendEnvironmentsCommand;
2498
1908
  const deserializeAws_restJson1ListBackendEnvironmentsCommandError = async (output, context) => {
@@ -2500,7 +1910,6 @@ const deserializeAws_restJson1ListBackendEnvironmentsCommandError = async (outpu
2500
1910
  ...output,
2501
1911
  body: await parseBody(output.body, context),
2502
1912
  };
2503
- let response;
2504
1913
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2505
1914
  switch (errorCode) {
2506
1915
  case "BadRequestException":
@@ -2514,33 +1923,29 @@ const deserializeAws_restJson1ListBackendEnvironmentsCommandError = async (outpu
2514
1923
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2515
1924
  default:
2516
1925
  const parsedBody = parsedOutput.body;
2517
- const $metadata = deserializeMetadata(output);
2518
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2519
- response = new AmplifyServiceException_1.AmplifyServiceException({
2520
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2521
- $fault: "client",
2522
- $metadata,
1926
+ (0, smithy_client_1.throwDefaultError)({
1927
+ output,
1928
+ parsedBody,
1929
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1930
+ errorCode,
2523
1931
  });
2524
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2525
1932
  }
2526
1933
  };
2527
1934
  const deserializeAws_restJson1ListBranchesCommand = async (output, context) => {
2528
1935
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2529
1936
  return deserializeAws_restJson1ListBranchesCommandError(output, context);
2530
1937
  }
2531
- const contents = {
1938
+ const contents = map({
2532
1939
  $metadata: deserializeMetadata(output),
2533
- branches: undefined,
2534
- nextToken: undefined,
2535
- };
1940
+ });
2536
1941
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2537
- if (data.branches !== undefined && data.branches !== null) {
1942
+ if (data.branches != null) {
2538
1943
  contents.branches = deserializeAws_restJson1Branches(data.branches, context);
2539
1944
  }
2540
- if (data.nextToken !== undefined && data.nextToken !== null) {
1945
+ if (data.nextToken != null) {
2541
1946
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2542
1947
  }
2543
- return Promise.resolve(contents);
1948
+ return contents;
2544
1949
  };
2545
1950
  exports.deserializeAws_restJson1ListBranchesCommand = deserializeAws_restJson1ListBranchesCommand;
2546
1951
  const deserializeAws_restJson1ListBranchesCommandError = async (output, context) => {
@@ -2548,7 +1953,6 @@ const deserializeAws_restJson1ListBranchesCommandError = async (output, context)
2548
1953
  ...output,
2549
1954
  body: await parseBody(output.body, context),
2550
1955
  };
2551
- let response;
2552
1956
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2553
1957
  switch (errorCode) {
2554
1958
  case "BadRequestException":
@@ -2562,33 +1966,29 @@ const deserializeAws_restJson1ListBranchesCommandError = async (output, context)
2562
1966
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2563
1967
  default:
2564
1968
  const parsedBody = parsedOutput.body;
2565
- const $metadata = deserializeMetadata(output);
2566
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2567
- response = new AmplifyServiceException_1.AmplifyServiceException({
2568
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2569
- $fault: "client",
2570
- $metadata,
1969
+ (0, smithy_client_1.throwDefaultError)({
1970
+ output,
1971
+ parsedBody,
1972
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
1973
+ errorCode,
2571
1974
  });
2572
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2573
1975
  }
2574
1976
  };
2575
1977
  const deserializeAws_restJson1ListDomainAssociationsCommand = async (output, context) => {
2576
1978
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2577
1979
  return deserializeAws_restJson1ListDomainAssociationsCommandError(output, context);
2578
1980
  }
2579
- const contents = {
1981
+ const contents = map({
2580
1982
  $metadata: deserializeMetadata(output),
2581
- domainAssociations: undefined,
2582
- nextToken: undefined,
2583
- };
1983
+ });
2584
1984
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2585
- if (data.domainAssociations !== undefined && data.domainAssociations !== null) {
1985
+ if (data.domainAssociations != null) {
2586
1986
  contents.domainAssociations = deserializeAws_restJson1DomainAssociations(data.domainAssociations, context);
2587
1987
  }
2588
- if (data.nextToken !== undefined && data.nextToken !== null) {
1988
+ if (data.nextToken != null) {
2589
1989
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2590
1990
  }
2591
- return Promise.resolve(contents);
1991
+ return contents;
2592
1992
  };
2593
1993
  exports.deserializeAws_restJson1ListDomainAssociationsCommand = deserializeAws_restJson1ListDomainAssociationsCommand;
2594
1994
  const deserializeAws_restJson1ListDomainAssociationsCommandError = async (output, context) => {
@@ -2596,7 +1996,6 @@ const deserializeAws_restJson1ListDomainAssociationsCommandError = async (output
2596
1996
  ...output,
2597
1997
  body: await parseBody(output.body, context),
2598
1998
  };
2599
- let response;
2600
1999
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2601
2000
  switch (errorCode) {
2602
2001
  case "BadRequestException":
@@ -2610,33 +2009,29 @@ const deserializeAws_restJson1ListDomainAssociationsCommandError = async (output
2610
2009
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2611
2010
  default:
2612
2011
  const parsedBody = parsedOutput.body;
2613
- const $metadata = deserializeMetadata(output);
2614
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2615
- response = new AmplifyServiceException_1.AmplifyServiceException({
2616
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2617
- $fault: "client",
2618
- $metadata,
2012
+ (0, smithy_client_1.throwDefaultError)({
2013
+ output,
2014
+ parsedBody,
2015
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2016
+ errorCode,
2619
2017
  });
2620
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2621
2018
  }
2622
2019
  };
2623
2020
  const deserializeAws_restJson1ListJobsCommand = async (output, context) => {
2624
2021
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2625
2022
  return deserializeAws_restJson1ListJobsCommandError(output, context);
2626
2023
  }
2627
- const contents = {
2024
+ const contents = map({
2628
2025
  $metadata: deserializeMetadata(output),
2629
- jobSummaries: undefined,
2630
- nextToken: undefined,
2631
- };
2026
+ });
2632
2027
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2633
- if (data.jobSummaries !== undefined && data.jobSummaries !== null) {
2028
+ if (data.jobSummaries != null) {
2634
2029
  contents.jobSummaries = deserializeAws_restJson1JobSummaries(data.jobSummaries, context);
2635
2030
  }
2636
- if (data.nextToken !== undefined && data.nextToken !== null) {
2031
+ if (data.nextToken != null) {
2637
2032
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2638
2033
  }
2639
- return Promise.resolve(contents);
2034
+ return contents;
2640
2035
  };
2641
2036
  exports.deserializeAws_restJson1ListJobsCommand = deserializeAws_restJson1ListJobsCommand;
2642
2037
  const deserializeAws_restJson1ListJobsCommandError = async (output, context) => {
@@ -2644,7 +2039,6 @@ const deserializeAws_restJson1ListJobsCommandError = async (output, context) =>
2644
2039
  ...output,
2645
2040
  body: await parseBody(output.body, context),
2646
2041
  };
2647
- let response;
2648
2042
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2649
2043
  switch (errorCode) {
2650
2044
  case "BadRequestException":
@@ -2661,29 +2055,26 @@ const deserializeAws_restJson1ListJobsCommandError = async (output, context) =>
2661
2055
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2662
2056
  default:
2663
2057
  const parsedBody = parsedOutput.body;
2664
- const $metadata = deserializeMetadata(output);
2665
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2666
- response = new AmplifyServiceException_1.AmplifyServiceException({
2667
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2668
- $fault: "client",
2669
- $metadata,
2058
+ (0, smithy_client_1.throwDefaultError)({
2059
+ output,
2060
+ parsedBody,
2061
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2062
+ errorCode,
2670
2063
  });
2671
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2672
2064
  }
2673
2065
  };
2674
2066
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2675
2067
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2676
2068
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2677
2069
  }
2678
- const contents = {
2070
+ const contents = map({
2679
2071
  $metadata: deserializeMetadata(output),
2680
- tags: undefined,
2681
- };
2072
+ });
2682
2073
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2683
- if (data.tags !== undefined && data.tags !== null) {
2074
+ if (data.tags != null) {
2684
2075
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
2685
2076
  }
2686
- return Promise.resolve(contents);
2077
+ return contents;
2687
2078
  };
2688
2079
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2689
2080
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2691,7 +2082,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2691
2082
  ...output,
2692
2083
  body: await parseBody(output.body, context),
2693
2084
  };
2694
- let response;
2695
2085
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2696
2086
  switch (errorCode) {
2697
2087
  case "BadRequestException":
@@ -2705,33 +2095,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2705
2095
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2706
2096
  default:
2707
2097
  const parsedBody = parsedOutput.body;
2708
- const $metadata = deserializeMetadata(output);
2709
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2710
- response = new AmplifyServiceException_1.AmplifyServiceException({
2711
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2712
- $fault: "client",
2713
- $metadata,
2098
+ (0, smithy_client_1.throwDefaultError)({
2099
+ output,
2100
+ parsedBody,
2101
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2102
+ errorCode,
2714
2103
  });
2715
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2716
2104
  }
2717
2105
  };
2718
2106
  const deserializeAws_restJson1ListWebhooksCommand = async (output, context) => {
2719
2107
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2720
2108
  return deserializeAws_restJson1ListWebhooksCommandError(output, context);
2721
2109
  }
2722
- const contents = {
2110
+ const contents = map({
2723
2111
  $metadata: deserializeMetadata(output),
2724
- nextToken: undefined,
2725
- webhooks: undefined,
2726
- };
2112
+ });
2727
2113
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2728
- if (data.nextToken !== undefined && data.nextToken !== null) {
2114
+ if (data.nextToken != null) {
2729
2115
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2730
2116
  }
2731
- if (data.webhooks !== undefined && data.webhooks !== null) {
2117
+ if (data.webhooks != null) {
2732
2118
  contents.webhooks = deserializeAws_restJson1Webhooks(data.webhooks, context);
2733
2119
  }
2734
- return Promise.resolve(contents);
2120
+ return contents;
2735
2121
  };
2736
2122
  exports.deserializeAws_restJson1ListWebhooksCommand = deserializeAws_restJson1ListWebhooksCommand;
2737
2123
  const deserializeAws_restJson1ListWebhooksCommandError = async (output, context) => {
@@ -2739,7 +2125,6 @@ const deserializeAws_restJson1ListWebhooksCommandError = async (output, context)
2739
2125
  ...output,
2740
2126
  body: await parseBody(output.body, context),
2741
2127
  };
2742
- let response;
2743
2128
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2744
2129
  switch (errorCode) {
2745
2130
  case "BadRequestException":
@@ -2756,29 +2141,26 @@ const deserializeAws_restJson1ListWebhooksCommandError = async (output, context)
2756
2141
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2757
2142
  default:
2758
2143
  const parsedBody = parsedOutput.body;
2759
- const $metadata = deserializeMetadata(output);
2760
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2761
- response = new AmplifyServiceException_1.AmplifyServiceException({
2762
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2763
- $fault: "client",
2764
- $metadata,
2144
+ (0, smithy_client_1.throwDefaultError)({
2145
+ output,
2146
+ parsedBody,
2147
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2148
+ errorCode,
2765
2149
  });
2766
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2767
2150
  }
2768
2151
  };
2769
2152
  const deserializeAws_restJson1StartDeploymentCommand = async (output, context) => {
2770
2153
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2771
2154
  return deserializeAws_restJson1StartDeploymentCommandError(output, context);
2772
2155
  }
2773
- const contents = {
2156
+ const contents = map({
2774
2157
  $metadata: deserializeMetadata(output),
2775
- jobSummary: undefined,
2776
- };
2158
+ });
2777
2159
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2778
- if (data.jobSummary !== undefined && data.jobSummary !== null) {
2160
+ if (data.jobSummary != null) {
2779
2161
  contents.jobSummary = deserializeAws_restJson1JobSummary(data.jobSummary, context);
2780
2162
  }
2781
- return Promise.resolve(contents);
2163
+ return contents;
2782
2164
  };
2783
2165
  exports.deserializeAws_restJson1StartDeploymentCommand = deserializeAws_restJson1StartDeploymentCommand;
2784
2166
  const deserializeAws_restJson1StartDeploymentCommandError = async (output, context) => {
@@ -2786,7 +2168,6 @@ const deserializeAws_restJson1StartDeploymentCommandError = async (output, conte
2786
2168
  ...output,
2787
2169
  body: await parseBody(output.body, context),
2788
2170
  };
2789
- let response;
2790
2171
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2791
2172
  switch (errorCode) {
2792
2173
  case "BadRequestException":
@@ -2806,29 +2187,26 @@ const deserializeAws_restJson1StartDeploymentCommandError = async (output, conte
2806
2187
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2807
2188
  default:
2808
2189
  const parsedBody = parsedOutput.body;
2809
- const $metadata = deserializeMetadata(output);
2810
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2811
- response = new AmplifyServiceException_1.AmplifyServiceException({
2812
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2813
- $fault: "client",
2814
- $metadata,
2190
+ (0, smithy_client_1.throwDefaultError)({
2191
+ output,
2192
+ parsedBody,
2193
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2194
+ errorCode,
2815
2195
  });
2816
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2817
2196
  }
2818
2197
  };
2819
2198
  const deserializeAws_restJson1StartJobCommand = async (output, context) => {
2820
2199
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2821
2200
  return deserializeAws_restJson1StartJobCommandError(output, context);
2822
2201
  }
2823
- const contents = {
2202
+ const contents = map({
2824
2203
  $metadata: deserializeMetadata(output),
2825
- jobSummary: undefined,
2826
- };
2204
+ });
2827
2205
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2828
- if (data.jobSummary !== undefined && data.jobSummary !== null) {
2206
+ if (data.jobSummary != null) {
2829
2207
  contents.jobSummary = deserializeAws_restJson1JobSummary(data.jobSummary, context);
2830
2208
  }
2831
- return Promise.resolve(contents);
2209
+ return contents;
2832
2210
  };
2833
2211
  exports.deserializeAws_restJson1StartJobCommand = deserializeAws_restJson1StartJobCommand;
2834
2212
  const deserializeAws_restJson1StartJobCommandError = async (output, context) => {
@@ -2836,7 +2214,6 @@ const deserializeAws_restJson1StartJobCommandError = async (output, context) =>
2836
2214
  ...output,
2837
2215
  body: await parseBody(output.body, context),
2838
2216
  };
2839
- let response;
2840
2217
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2841
2218
  switch (errorCode) {
2842
2219
  case "BadRequestException":
@@ -2856,29 +2233,26 @@ const deserializeAws_restJson1StartJobCommandError = async (output, context) =>
2856
2233
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2857
2234
  default:
2858
2235
  const parsedBody = parsedOutput.body;
2859
- const $metadata = deserializeMetadata(output);
2860
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2861
- response = new AmplifyServiceException_1.AmplifyServiceException({
2862
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2863
- $fault: "client",
2864
- $metadata,
2236
+ (0, smithy_client_1.throwDefaultError)({
2237
+ output,
2238
+ parsedBody,
2239
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2240
+ errorCode,
2865
2241
  });
2866
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2867
2242
  }
2868
2243
  };
2869
2244
  const deserializeAws_restJson1StopJobCommand = async (output, context) => {
2870
2245
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2871
2246
  return deserializeAws_restJson1StopJobCommandError(output, context);
2872
2247
  }
2873
- const contents = {
2248
+ const contents = map({
2874
2249
  $metadata: deserializeMetadata(output),
2875
- jobSummary: undefined,
2876
- };
2250
+ });
2877
2251
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2878
- if (data.jobSummary !== undefined && data.jobSummary !== null) {
2252
+ if (data.jobSummary != null) {
2879
2253
  contents.jobSummary = deserializeAws_restJson1JobSummary(data.jobSummary, context);
2880
2254
  }
2881
- return Promise.resolve(contents);
2255
+ return contents;
2882
2256
  };
2883
2257
  exports.deserializeAws_restJson1StopJobCommand = deserializeAws_restJson1StopJobCommand;
2884
2258
  const deserializeAws_restJson1StopJobCommandError = async (output, context) => {
@@ -2886,7 +2260,6 @@ const deserializeAws_restJson1StopJobCommandError = async (output, context) => {
2886
2260
  ...output,
2887
2261
  body: await parseBody(output.body, context),
2888
2262
  };
2889
- let response;
2890
2263
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2891
2264
  switch (errorCode) {
2892
2265
  case "BadRequestException":
@@ -2906,25 +2279,23 @@ const deserializeAws_restJson1StopJobCommandError = async (output, context) => {
2906
2279
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2907
2280
  default:
2908
2281
  const parsedBody = parsedOutput.body;
2909
- const $metadata = deserializeMetadata(output);
2910
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2911
- response = new AmplifyServiceException_1.AmplifyServiceException({
2912
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2913
- $fault: "client",
2914
- $metadata,
2282
+ (0, smithy_client_1.throwDefaultError)({
2283
+ output,
2284
+ parsedBody,
2285
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2286
+ errorCode,
2915
2287
  });
2916
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2917
2288
  }
2918
2289
  };
2919
2290
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2920
2291
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2921
2292
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2922
2293
  }
2923
- const contents = {
2294
+ const contents = map({
2924
2295
  $metadata: deserializeMetadata(output),
2925
- };
2296
+ });
2926
2297
  await collectBody(output.body, context);
2927
- return Promise.resolve(contents);
2298
+ return contents;
2928
2299
  };
2929
2300
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2930
2301
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2932,7 +2303,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2932
2303
  ...output,
2933
2304
  body: await parseBody(output.body, context),
2934
2305
  };
2935
- let response;
2936
2306
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2937
2307
  switch (errorCode) {
2938
2308
  case "BadRequestException":
@@ -2946,25 +2316,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2946
2316
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2947
2317
  default:
2948
2318
  const parsedBody = parsedOutput.body;
2949
- const $metadata = deserializeMetadata(output);
2950
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2951
- response = new AmplifyServiceException_1.AmplifyServiceException({
2952
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2953
- $fault: "client",
2954
- $metadata,
2319
+ (0, smithy_client_1.throwDefaultError)({
2320
+ output,
2321
+ parsedBody,
2322
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2323
+ errorCode,
2955
2324
  });
2956
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2957
2325
  }
2958
2326
  };
2959
2327
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2960
2328
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2961
2329
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2962
2330
  }
2963
- const contents = {
2331
+ const contents = map({
2964
2332
  $metadata: deserializeMetadata(output),
2965
- };
2333
+ });
2966
2334
  await collectBody(output.body, context);
2967
- return Promise.resolve(contents);
2335
+ return contents;
2968
2336
  };
2969
2337
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2970
2338
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2972,7 +2340,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2972
2340
  ...output,
2973
2341
  body: await parseBody(output.body, context),
2974
2342
  };
2975
- let response;
2976
2343
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2977
2344
  switch (errorCode) {
2978
2345
  case "BadRequestException":
@@ -2986,29 +2353,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2986
2353
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2987
2354
  default:
2988
2355
  const parsedBody = parsedOutput.body;
2989
- const $metadata = deserializeMetadata(output);
2990
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2991
- response = new AmplifyServiceException_1.AmplifyServiceException({
2992
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2993
- $fault: "client",
2994
- $metadata,
2356
+ (0, smithy_client_1.throwDefaultError)({
2357
+ output,
2358
+ parsedBody,
2359
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2360
+ errorCode,
2995
2361
  });
2996
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2997
2362
  }
2998
2363
  };
2999
2364
  const deserializeAws_restJson1UpdateAppCommand = async (output, context) => {
3000
2365
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3001
2366
  return deserializeAws_restJson1UpdateAppCommandError(output, context);
3002
2367
  }
3003
- const contents = {
2368
+ const contents = map({
3004
2369
  $metadata: deserializeMetadata(output),
3005
- app: undefined,
3006
- };
2370
+ });
3007
2371
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3008
- if (data.app !== undefined && data.app !== null) {
2372
+ if (data.app != null) {
3009
2373
  contents.app = deserializeAws_restJson1App(data.app, context);
3010
2374
  }
3011
- return Promise.resolve(contents);
2375
+ return contents;
3012
2376
  };
3013
2377
  exports.deserializeAws_restJson1UpdateAppCommand = deserializeAws_restJson1UpdateAppCommand;
3014
2378
  const deserializeAws_restJson1UpdateAppCommandError = async (output, context) => {
@@ -3016,7 +2380,6 @@ const deserializeAws_restJson1UpdateAppCommandError = async (output, context) =>
3016
2380
  ...output,
3017
2381
  body: await parseBody(output.body, context),
3018
2382
  };
3019
- let response;
3020
2383
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3021
2384
  switch (errorCode) {
3022
2385
  case "BadRequestException":
@@ -3033,29 +2396,26 @@ const deserializeAws_restJson1UpdateAppCommandError = async (output, context) =>
3033
2396
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3034
2397
  default:
3035
2398
  const parsedBody = parsedOutput.body;
3036
- const $metadata = deserializeMetadata(output);
3037
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3038
- response = new AmplifyServiceException_1.AmplifyServiceException({
3039
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3040
- $fault: "client",
3041
- $metadata,
2399
+ (0, smithy_client_1.throwDefaultError)({
2400
+ output,
2401
+ parsedBody,
2402
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2403
+ errorCode,
3042
2404
  });
3043
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3044
2405
  }
3045
2406
  };
3046
2407
  const deserializeAws_restJson1UpdateBranchCommand = async (output, context) => {
3047
2408
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3048
2409
  return deserializeAws_restJson1UpdateBranchCommandError(output, context);
3049
2410
  }
3050
- const contents = {
2411
+ const contents = map({
3051
2412
  $metadata: deserializeMetadata(output),
3052
- branch: undefined,
3053
- };
2413
+ });
3054
2414
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3055
- if (data.branch !== undefined && data.branch !== null) {
2415
+ if (data.branch != null) {
3056
2416
  contents.branch = deserializeAws_restJson1Branch(data.branch, context);
3057
2417
  }
3058
- return Promise.resolve(contents);
2418
+ return contents;
3059
2419
  };
3060
2420
  exports.deserializeAws_restJson1UpdateBranchCommand = deserializeAws_restJson1UpdateBranchCommand;
3061
2421
  const deserializeAws_restJson1UpdateBranchCommandError = async (output, context) => {
@@ -3063,7 +2423,6 @@ const deserializeAws_restJson1UpdateBranchCommandError = async (output, context)
3063
2423
  ...output,
3064
2424
  body: await parseBody(output.body, context),
3065
2425
  };
3066
- let response;
3067
2426
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3068
2427
  switch (errorCode) {
3069
2428
  case "BadRequestException":
@@ -3083,29 +2442,26 @@ const deserializeAws_restJson1UpdateBranchCommandError = async (output, context)
3083
2442
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3084
2443
  default:
3085
2444
  const parsedBody = parsedOutput.body;
3086
- const $metadata = deserializeMetadata(output);
3087
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3088
- response = new AmplifyServiceException_1.AmplifyServiceException({
3089
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3090
- $fault: "client",
3091
- $metadata,
2445
+ (0, smithy_client_1.throwDefaultError)({
2446
+ output,
2447
+ parsedBody,
2448
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2449
+ errorCode,
3092
2450
  });
3093
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3094
2451
  }
3095
2452
  };
3096
2453
  const deserializeAws_restJson1UpdateDomainAssociationCommand = async (output, context) => {
3097
2454
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3098
2455
  return deserializeAws_restJson1UpdateDomainAssociationCommandError(output, context);
3099
2456
  }
3100
- const contents = {
2457
+ const contents = map({
3101
2458
  $metadata: deserializeMetadata(output),
3102
- domainAssociation: undefined,
3103
- };
2459
+ });
3104
2460
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3105
- if (data.domainAssociation !== undefined && data.domainAssociation !== null) {
2461
+ if (data.domainAssociation != null) {
3106
2462
  contents.domainAssociation = deserializeAws_restJson1DomainAssociation(data.domainAssociation, context);
3107
2463
  }
3108
- return Promise.resolve(contents);
2464
+ return contents;
3109
2465
  };
3110
2466
  exports.deserializeAws_restJson1UpdateDomainAssociationCommand = deserializeAws_restJson1UpdateDomainAssociationCommand;
3111
2467
  const deserializeAws_restJson1UpdateDomainAssociationCommandError = async (output, context) => {
@@ -3113,7 +2469,6 @@ const deserializeAws_restJson1UpdateDomainAssociationCommandError = async (outpu
3113
2469
  ...output,
3114
2470
  body: await parseBody(output.body, context),
3115
2471
  };
3116
- let response;
3117
2472
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3118
2473
  switch (errorCode) {
3119
2474
  case "BadRequestException":
@@ -3133,29 +2488,26 @@ const deserializeAws_restJson1UpdateDomainAssociationCommandError = async (outpu
3133
2488
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3134
2489
  default:
3135
2490
  const parsedBody = parsedOutput.body;
3136
- const $metadata = deserializeMetadata(output);
3137
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3138
- response = new AmplifyServiceException_1.AmplifyServiceException({
3139
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3140
- $fault: "client",
3141
- $metadata,
2491
+ (0, smithy_client_1.throwDefaultError)({
2492
+ output,
2493
+ parsedBody,
2494
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2495
+ errorCode,
3142
2496
  });
3143
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3144
2497
  }
3145
2498
  };
3146
2499
  const deserializeAws_restJson1UpdateWebhookCommand = async (output, context) => {
3147
2500
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3148
2501
  return deserializeAws_restJson1UpdateWebhookCommandError(output, context);
3149
2502
  }
3150
- const contents = {
2503
+ const contents = map({
3151
2504
  $metadata: deserializeMetadata(output),
3152
- webhook: undefined,
3153
- };
2505
+ });
3154
2506
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3155
- if (data.webhook !== undefined && data.webhook !== null) {
2507
+ if (data.webhook != null) {
3156
2508
  contents.webhook = deserializeAws_restJson1Webhook(data.webhook, context);
3157
2509
  }
3158
- return Promise.resolve(contents);
2510
+ return contents;
3159
2511
  };
3160
2512
  exports.deserializeAws_restJson1UpdateWebhookCommand = deserializeAws_restJson1UpdateWebhookCommand;
3161
2513
  const deserializeAws_restJson1UpdateWebhookCommandError = async (output, context) => {
@@ -3163,7 +2515,6 @@ const deserializeAws_restJson1UpdateWebhookCommandError = async (output, context
3163
2515
  ...output,
3164
2516
  body: await parseBody(output.body, context),
3165
2517
  };
3166
- let response;
3167
2518
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3168
2519
  switch (errorCode) {
3169
2520
  case "BadRequestException":
@@ -3183,20 +2534,19 @@ const deserializeAws_restJson1UpdateWebhookCommandError = async (output, context
3183
2534
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3184
2535
  default:
3185
2536
  const parsedBody = parsedOutput.body;
3186
- const $metadata = deserializeMetadata(output);
3187
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3188
- response = new AmplifyServiceException_1.AmplifyServiceException({
3189
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3190
- $fault: "client",
3191
- $metadata,
2537
+ (0, smithy_client_1.throwDefaultError)({
2538
+ output,
2539
+ parsedBody,
2540
+ exceptionCtor: AmplifyServiceException_1.AmplifyServiceException,
2541
+ errorCode,
3192
2542
  });
3193
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3194
2543
  }
3195
2544
  };
2545
+ const map = smithy_client_1.map;
3196
2546
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
3197
- const contents = {};
2547
+ const contents = map({});
3198
2548
  const data = parsedOutput.body;
3199
- if (data.message !== undefined && data.message !== null) {
2549
+ if (data.message != null) {
3200
2550
  contents.message = (0, smithy_client_1.expectString)(data.message);
3201
2551
  }
3202
2552
  const exception = new models_0_1.BadRequestException({
@@ -3206,9 +2556,9 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
3206
2556
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3207
2557
  };
3208
2558
  const deserializeAws_restJson1DependentServiceFailureExceptionResponse = async (parsedOutput, context) => {
3209
- const contents = {};
2559
+ const contents = map({});
3210
2560
  const data = parsedOutput.body;
3211
- if (data.message !== undefined && data.message !== null) {
2561
+ if (data.message != null) {
3212
2562
  contents.message = (0, smithy_client_1.expectString)(data.message);
3213
2563
  }
3214
2564
  const exception = new models_0_1.DependentServiceFailureException({
@@ -3218,9 +2568,9 @@ const deserializeAws_restJson1DependentServiceFailureExceptionResponse = async (
3218
2568
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3219
2569
  };
3220
2570
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
3221
- const contents = {};
2571
+ const contents = map({});
3222
2572
  const data = parsedOutput.body;
3223
- if (data.message !== undefined && data.message !== null) {
2573
+ if (data.message != null) {
3224
2574
  contents.message = (0, smithy_client_1.expectString)(data.message);
3225
2575
  }
3226
2576
  const exception = new models_0_1.InternalFailureException({
@@ -3230,9 +2580,9 @@ const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOu
3230
2580
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3231
2581
  };
3232
2582
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
3233
- const contents = {};
2583
+ const contents = map({});
3234
2584
  const data = parsedOutput.body;
3235
- if (data.message !== undefined && data.message !== null) {
2585
+ if (data.message != null) {
3236
2586
  contents.message = (0, smithy_client_1.expectString)(data.message);
3237
2587
  }
3238
2588
  const exception = new models_0_1.LimitExceededException({
@@ -3242,9 +2592,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
3242
2592
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3243
2593
  };
3244
2594
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
3245
- const contents = {};
2595
+ const contents = map({});
3246
2596
  const data = parsedOutput.body;
3247
- if (data.message !== undefined && data.message !== null) {
2597
+ if (data.message != null) {
3248
2598
  contents.message = (0, smithy_client_1.expectString)(data.message);
3249
2599
  }
3250
2600
  const exception = new models_0_1.NotFoundException({
@@ -3254,12 +2604,12 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
3254
2604
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3255
2605
  };
3256
2606
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
3257
- const contents = {};
2607
+ const contents = map({});
3258
2608
  const data = parsedOutput.body;
3259
- if (data.code !== undefined && data.code !== null) {
2609
+ if (data.code != null) {
3260
2610
  contents.code = (0, smithy_client_1.expectString)(data.code);
3261
2611
  }
3262
- if (data.message !== undefined && data.message !== null) {
2612
+ if (data.message != null) {
3263
2613
  contents.message = (0, smithy_client_1.expectString)(data.message);
3264
2614
  }
3265
2615
  const exception = new models_0_1.ResourceNotFoundException({
@@ -3269,9 +2619,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
3269
2619
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3270
2620
  };
3271
2621
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
3272
- const contents = {};
2622
+ const contents = map({});
3273
2623
  const data = parsedOutput.body;
3274
- if (data.message !== undefined && data.message !== null) {
2624
+ if (data.message != null) {
3275
2625
  contents.message = (0, smithy_client_1.expectString)(data.message);
3276
2626
  }
3277
2627
  const exception = new models_0_1.UnauthorizedException({
@@ -3300,9 +2650,6 @@ const serializeAws_restJson1AutoBranchCreationPatterns = (input, context) => {
3300
2650
  return input
3301
2651
  .filter((e) => e != null)
3302
2652
  .map((entry) => {
3303
- if (entry === null) {
3304
- return null;
3305
- }
3306
2653
  return entry;
3307
2654
  });
3308
2655
  };
@@ -3310,9 +2657,6 @@ const serializeAws_restJson1AutoSubDomainCreationPatterns = (input, context) =>
3310
2657
  return input
3311
2658
  .filter((e) => e != null)
3312
2659
  .map((entry) => {
3313
- if (entry === null) {
3314
- return null;
3315
- }
3316
2660
  return entry;
3317
2661
  });
3318
2662
  };
@@ -3328,9 +2672,6 @@ const serializeAws_restJson1CustomRules = (input, context) => {
3328
2672
  return input
3329
2673
  .filter((e) => e != null)
3330
2674
  .map((entry) => {
3331
- if (entry === null) {
3332
- return null;
3333
- }
3334
2675
  return serializeAws_restJson1CustomRule(entry, context);
3335
2676
  });
3336
2677
  };
@@ -3366,9 +2707,6 @@ const serializeAws_restJson1SubDomainSettings = (input, context) => {
3366
2707
  return input
3367
2708
  .filter((e) => e != null)
3368
2709
  .map((entry) => {
3369
- if (entry === null) {
3370
- return null;
3371
- }
3372
2710
  return serializeAws_restJson1SubDomainSetting(entry, context);
3373
2711
  });
3374
2712
  };