@aws-sdk/client-amplifybackend 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.
@@ -13,26 +13,8 @@ const serializeAws_restJson1CloneBackendCommand = async (input, context) => {
13
13
  };
14
14
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
15
15
  "/backend/{AppId}/environments/{BackendEnvironmentName}/clone";
16
- if (input.AppId !== undefined) {
17
- const labelValue = input.AppId;
18
- if (labelValue.length <= 0) {
19
- throw new Error("Empty value provided for input HTTP label: AppId.");
20
- }
21
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
22
- }
23
- else {
24
- throw new Error("No value provided for input HTTP label: AppId.");
25
- }
26
- if (input.BackendEnvironmentName !== undefined) {
27
- const labelValue = input.BackendEnvironmentName;
28
- if (labelValue.length <= 0) {
29
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
30
- }
31
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
32
- }
33
- else {
34
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
35
- }
16
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
17
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
36
18
  let body;
37
19
  body = JSON.stringify({
38
20
  ...(input.TargetEnvironmentName != null && { targetEnvironmentName: input.TargetEnvironmentName }),
@@ -81,16 +63,7 @@ const serializeAws_restJson1CreateBackendAPICommand = async (input, context) =>
81
63
  "content-type": "application/json",
82
64
  };
83
65
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/api";
84
- if (input.AppId !== undefined) {
85
- const labelValue = input.AppId;
86
- if (labelValue.length <= 0) {
87
- throw new Error("Empty value provided for input HTTP label: AppId.");
88
- }
89
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
90
- }
91
- else {
92
- throw new Error("No value provided for input HTTP label: AppId.");
93
- }
66
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
94
67
  let body;
95
68
  body = JSON.stringify({
96
69
  ...(input.BackendEnvironmentName != null && { backendEnvironmentName: input.BackendEnvironmentName }),
@@ -116,16 +89,7 @@ const serializeAws_restJson1CreateBackendAuthCommand = async (input, context) =>
116
89
  "content-type": "application/json",
117
90
  };
118
91
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/auth";
119
- if (input.AppId !== undefined) {
120
- const labelValue = input.AppId;
121
- if (labelValue.length <= 0) {
122
- throw new Error("Empty value provided for input HTTP label: AppId.");
123
- }
124
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
125
- }
126
- else {
127
- throw new Error("No value provided for input HTTP label: AppId.");
128
- }
92
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
129
93
  let body;
130
94
  body = JSON.stringify({
131
95
  ...(input.BackendEnvironmentName != null && { backendEnvironmentName: input.BackendEnvironmentName }),
@@ -151,16 +115,7 @@ const serializeAws_restJson1CreateBackendConfigCommand = async (input, context)
151
115
  "content-type": "application/json",
152
116
  };
153
117
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/config";
154
- if (input.AppId !== undefined) {
155
- const labelValue = input.AppId;
156
- if (labelValue.length <= 0) {
157
- throw new Error("Empty value provided for input HTTP label: AppId.");
158
- }
159
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
160
- }
161
- else {
162
- throw new Error("No value provided for input HTTP label: AppId.");
163
- }
118
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
164
119
  let body;
165
120
  body = JSON.stringify({
166
121
  ...(input.BackendManagerAppId != null && { backendManagerAppId: input.BackendManagerAppId }),
@@ -182,16 +137,7 @@ const serializeAws_restJson1CreateBackendStorageCommand = async (input, context)
182
137
  "content-type": "application/json",
183
138
  };
184
139
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/storage";
185
- if (input.AppId !== undefined) {
186
- const labelValue = input.AppId;
187
- if (labelValue.length <= 0) {
188
- throw new Error("Empty value provided for input HTTP label: AppId.");
189
- }
190
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
191
- }
192
- else {
193
- throw new Error("No value provided for input HTTP label: AppId.");
194
- }
140
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
195
141
  let body;
196
142
  body = JSON.stringify({
197
143
  ...(input.BackendEnvironmentName != null && { backendEnvironmentName: input.BackendEnvironmentName }),
@@ -215,16 +161,7 @@ const serializeAws_restJson1CreateTokenCommand = async (input, context) => {
215
161
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
216
162
  const headers = {};
217
163
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/challenge";
218
- if (input.AppId !== undefined) {
219
- const labelValue = input.AppId;
220
- if (labelValue.length <= 0) {
221
- throw new Error("Empty value provided for input HTTP label: AppId.");
222
- }
223
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
224
- }
225
- else {
226
- throw new Error("No value provided for input HTTP label: AppId.");
227
- }
164
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
228
165
  let body;
229
166
  return new protocol_http_1.HttpRequest({
230
167
  protocol,
@@ -242,26 +179,8 @@ const serializeAws_restJson1DeleteBackendCommand = async (input, context) => {
242
179
  const headers = {};
243
180
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
244
181
  "/backend/{AppId}/environments/{BackendEnvironmentName}/remove";
245
- if (input.AppId !== undefined) {
246
- const labelValue = input.AppId;
247
- if (labelValue.length <= 0) {
248
- throw new Error("Empty value provided for input HTTP label: AppId.");
249
- }
250
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
251
- }
252
- else {
253
- throw new Error("No value provided for input HTTP label: AppId.");
254
- }
255
- if (input.BackendEnvironmentName !== undefined) {
256
- const labelValue = input.BackendEnvironmentName;
257
- if (labelValue.length <= 0) {
258
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
259
- }
260
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
261
- }
262
- else {
263
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
264
- }
182
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
183
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
265
184
  let body;
266
185
  return new protocol_http_1.HttpRequest({
267
186
  protocol,
@@ -281,26 +200,8 @@ const serializeAws_restJson1DeleteBackendAPICommand = async (input, context) =>
281
200
  };
282
201
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
283
202
  "/backend/{AppId}/api/{BackendEnvironmentName}/remove";
284
- if (input.AppId !== undefined) {
285
- const labelValue = input.AppId;
286
- if (labelValue.length <= 0) {
287
- throw new Error("Empty value provided for input HTTP label: AppId.");
288
- }
289
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
290
- }
291
- else {
292
- throw new Error("No value provided for input HTTP label: AppId.");
293
- }
294
- if (input.BackendEnvironmentName !== undefined) {
295
- const labelValue = input.BackendEnvironmentName;
296
- if (labelValue.length <= 0) {
297
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
298
- }
299
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
300
- }
301
- else {
302
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
303
- }
203
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
204
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
304
205
  let body;
305
206
  body = JSON.stringify({
306
207
  ...(input.ResourceConfig != null && {
@@ -326,26 +227,8 @@ const serializeAws_restJson1DeleteBackendAuthCommand = async (input, context) =>
326
227
  };
327
228
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
328
229
  "/backend/{AppId}/auth/{BackendEnvironmentName}/remove";
329
- if (input.AppId !== undefined) {
330
- const labelValue = input.AppId;
331
- if (labelValue.length <= 0) {
332
- throw new Error("Empty value provided for input HTTP label: AppId.");
333
- }
334
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
335
- }
336
- else {
337
- throw new Error("No value provided for input HTTP label: AppId.");
338
- }
339
- if (input.BackendEnvironmentName !== undefined) {
340
- const labelValue = input.BackendEnvironmentName;
341
- if (labelValue.length <= 0) {
342
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
343
- }
344
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
345
- }
346
- else {
347
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
348
- }
230
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
231
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
349
232
  let body;
350
233
  body = JSON.stringify({
351
234
  ...(input.ResourceName != null && { resourceName: input.ResourceName }),
@@ -368,26 +251,8 @@ const serializeAws_restJson1DeleteBackendStorageCommand = async (input, context)
368
251
  };
369
252
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
370
253
  "/backend/{AppId}/storage/{BackendEnvironmentName}/remove";
371
- if (input.AppId !== undefined) {
372
- const labelValue = input.AppId;
373
- if (labelValue.length <= 0) {
374
- throw new Error("Empty value provided for input HTTP label: AppId.");
375
- }
376
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
377
- }
378
- else {
379
- throw new Error("No value provided for input HTTP label: AppId.");
380
- }
381
- if (input.BackendEnvironmentName !== undefined) {
382
- const labelValue = input.BackendEnvironmentName;
383
- if (labelValue.length <= 0) {
384
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
385
- }
386
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
387
- }
388
- else {
389
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
390
- }
254
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
255
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
391
256
  let body;
392
257
  body = JSON.stringify({
393
258
  ...(input.ResourceName != null && { resourceName: input.ResourceName }),
@@ -409,26 +274,8 @@ const serializeAws_restJson1DeleteTokenCommand = async (input, context) => {
409
274
  const headers = {};
410
275
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
411
276
  "/backend/{AppId}/challenge/{SessionId}/remove";
412
- if (input.AppId !== undefined) {
413
- const labelValue = input.AppId;
414
- if (labelValue.length <= 0) {
415
- throw new Error("Empty value provided for input HTTP label: AppId.");
416
- }
417
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
418
- }
419
- else {
420
- throw new Error("No value provided for input HTTP label: AppId.");
421
- }
422
- if (input.SessionId !== undefined) {
423
- const labelValue = input.SessionId;
424
- if (labelValue.length <= 0) {
425
- throw new Error("Empty value provided for input HTTP label: SessionId.");
426
- }
427
- resolvedPath = resolvedPath.replace("{SessionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
428
- }
429
- else {
430
- throw new Error("No value provided for input HTTP label: SessionId.");
431
- }
277
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
278
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SessionId", () => input.SessionId, "{SessionId}", false);
432
279
  let body;
433
280
  return new protocol_http_1.HttpRequest({
434
281
  protocol,
@@ -448,26 +295,8 @@ const serializeAws_restJson1GenerateBackendAPIModelsCommand = async (input, cont
448
295
  };
449
296
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
450
297
  "/backend/{AppId}/api/{BackendEnvironmentName}/generateModels";
451
- if (input.AppId !== undefined) {
452
- const labelValue = input.AppId;
453
- if (labelValue.length <= 0) {
454
- throw new Error("Empty value provided for input HTTP label: AppId.");
455
- }
456
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
457
- }
458
- else {
459
- throw new Error("No value provided for input HTTP label: AppId.");
460
- }
461
- if (input.BackendEnvironmentName !== undefined) {
462
- const labelValue = input.BackendEnvironmentName;
463
- if (labelValue.length <= 0) {
464
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
465
- }
466
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
467
- }
468
- else {
469
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
470
- }
298
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
299
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
471
300
  let body;
472
301
  body = JSON.stringify({
473
302
  ...(input.ResourceName != null && { resourceName: input.ResourceName }),
@@ -489,16 +318,7 @@ const serializeAws_restJson1GetBackendCommand = async (input, context) => {
489
318
  "content-type": "application/json",
490
319
  };
491
320
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/details";
492
- if (input.AppId !== undefined) {
493
- const labelValue = input.AppId;
494
- if (labelValue.length <= 0) {
495
- throw new Error("Empty value provided for input HTTP label: AppId.");
496
- }
497
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
498
- }
499
- else {
500
- throw new Error("No value provided for input HTTP label: AppId.");
501
- }
321
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
502
322
  let body;
503
323
  body = JSON.stringify({
504
324
  ...(input.BackendEnvironmentName != null && { backendEnvironmentName: input.BackendEnvironmentName }),
@@ -521,26 +341,8 @@ const serializeAws_restJson1GetBackendAPICommand = async (input, context) => {
521
341
  };
522
342
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
523
343
  "/backend/{AppId}/api/{BackendEnvironmentName}/details";
524
- if (input.AppId !== undefined) {
525
- const labelValue = input.AppId;
526
- if (labelValue.length <= 0) {
527
- throw new Error("Empty value provided for input HTTP label: AppId.");
528
- }
529
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
530
- }
531
- else {
532
- throw new Error("No value provided for input HTTP label: AppId.");
533
- }
534
- if (input.BackendEnvironmentName !== undefined) {
535
- const labelValue = input.BackendEnvironmentName;
536
- if (labelValue.length <= 0) {
537
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
538
- }
539
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
540
- }
541
- else {
542
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
543
- }
344
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
345
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
544
346
  let body;
545
347
  body = JSON.stringify({
546
348
  ...(input.ResourceConfig != null && {
@@ -566,26 +368,8 @@ const serializeAws_restJson1GetBackendAPIModelsCommand = async (input, context)
566
368
  };
567
369
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
568
370
  "/backend/{AppId}/api/{BackendEnvironmentName}/getModels";
569
- if (input.AppId !== undefined) {
570
- const labelValue = input.AppId;
571
- if (labelValue.length <= 0) {
572
- throw new Error("Empty value provided for input HTTP label: AppId.");
573
- }
574
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
575
- }
576
- else {
577
- throw new Error("No value provided for input HTTP label: AppId.");
578
- }
579
- if (input.BackendEnvironmentName !== undefined) {
580
- const labelValue = input.BackendEnvironmentName;
581
- if (labelValue.length <= 0) {
582
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
583
- }
584
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
585
- }
586
- else {
587
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
588
- }
371
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
372
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
589
373
  let body;
590
374
  body = JSON.stringify({
591
375
  ...(input.ResourceName != null && { resourceName: input.ResourceName }),
@@ -608,26 +392,8 @@ const serializeAws_restJson1GetBackendAuthCommand = async (input, context) => {
608
392
  };
609
393
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
610
394
  "/backend/{AppId}/auth/{BackendEnvironmentName}/details";
611
- if (input.AppId !== undefined) {
612
- const labelValue = input.AppId;
613
- if (labelValue.length <= 0) {
614
- throw new Error("Empty value provided for input HTTP label: AppId.");
615
- }
616
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
617
- }
618
- else {
619
- throw new Error("No value provided for input HTTP label: AppId.");
620
- }
621
- if (input.BackendEnvironmentName !== undefined) {
622
- const labelValue = input.BackendEnvironmentName;
623
- if (labelValue.length <= 0) {
624
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
625
- }
626
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
627
- }
628
- else {
629
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
630
- }
395
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
396
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
631
397
  let body;
632
398
  body = JSON.stringify({
633
399
  ...(input.ResourceName != null && { resourceName: input.ResourceName }),
@@ -648,36 +414,9 @@ const serializeAws_restJson1GetBackendJobCommand = async (input, context) => {
648
414
  const headers = {};
649
415
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
650
416
  "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}";
651
- if (input.AppId !== undefined) {
652
- const labelValue = input.AppId;
653
- if (labelValue.length <= 0) {
654
- throw new Error("Empty value provided for input HTTP label: AppId.");
655
- }
656
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
657
- }
658
- else {
659
- throw new Error("No value provided for input HTTP label: AppId.");
660
- }
661
- if (input.BackendEnvironmentName !== undefined) {
662
- const labelValue = input.BackendEnvironmentName;
663
- if (labelValue.length <= 0) {
664
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
665
- }
666
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
667
- }
668
- else {
669
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
670
- }
671
- if (input.JobId !== undefined) {
672
- const labelValue = input.JobId;
673
- if (labelValue.length <= 0) {
674
- throw new Error("Empty value provided for input HTTP label: JobId.");
675
- }
676
- resolvedPath = resolvedPath.replace("{JobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
677
- }
678
- else {
679
- throw new Error("No value provided for input HTTP label: JobId.");
680
- }
417
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
418
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
419
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "JobId", () => input.JobId, "{JobId}", false);
681
420
  let body;
682
421
  return new protocol_http_1.HttpRequest({
683
422
  protocol,
@@ -697,26 +436,8 @@ const serializeAws_restJson1GetBackendStorageCommand = async (input, context) =>
697
436
  };
698
437
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
699
438
  "/backend/{AppId}/storage/{BackendEnvironmentName}/details";
700
- if (input.AppId !== undefined) {
701
- const labelValue = input.AppId;
702
- if (labelValue.length <= 0) {
703
- throw new Error("Empty value provided for input HTTP label: AppId.");
704
- }
705
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
706
- }
707
- else {
708
- throw new Error("No value provided for input HTTP label: AppId.");
709
- }
710
- if (input.BackendEnvironmentName !== undefined) {
711
- const labelValue = input.BackendEnvironmentName;
712
- if (labelValue.length <= 0) {
713
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
714
- }
715
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
716
- }
717
- else {
718
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
719
- }
439
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
440
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
720
441
  let body;
721
442
  body = JSON.stringify({
722
443
  ...(input.ResourceName != null && { resourceName: input.ResourceName }),
@@ -736,26 +457,8 @@ const serializeAws_restJson1GetTokenCommand = async (input, context) => {
736
457
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
737
458
  const headers = {};
738
459
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/challenge/{SessionId}";
739
- if (input.AppId !== undefined) {
740
- const labelValue = input.AppId;
741
- if (labelValue.length <= 0) {
742
- throw new Error("Empty value provided for input HTTP label: AppId.");
743
- }
744
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
745
- }
746
- else {
747
- throw new Error("No value provided for input HTTP label: AppId.");
748
- }
749
- if (input.SessionId !== undefined) {
750
- const labelValue = input.SessionId;
751
- if (labelValue.length <= 0) {
752
- throw new Error("Empty value provided for input HTTP label: SessionId.");
753
- }
754
- resolvedPath = resolvedPath.replace("{SessionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
755
- }
756
- else {
757
- throw new Error("No value provided for input HTTP label: SessionId.");
758
- }
460
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
461
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SessionId", () => input.SessionId, "{SessionId}", false);
759
462
  let body;
760
463
  return new protocol_http_1.HttpRequest({
761
464
  protocol,
@@ -775,26 +478,8 @@ const serializeAws_restJson1ImportBackendAuthCommand = async (input, context) =>
775
478
  };
776
479
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
777
480
  "/backend/{AppId}/auth/{BackendEnvironmentName}/import";
778
- if (input.AppId !== undefined) {
779
- const labelValue = input.AppId;
780
- if (labelValue.length <= 0) {
781
- throw new Error("Empty value provided for input HTTP label: AppId.");
782
- }
783
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
784
- }
785
- else {
786
- throw new Error("No value provided for input HTTP label: AppId.");
787
- }
788
- if (input.BackendEnvironmentName !== undefined) {
789
- const labelValue = input.BackendEnvironmentName;
790
- if (labelValue.length <= 0) {
791
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
792
- }
793
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
794
- }
795
- else {
796
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
797
- }
481
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
482
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
798
483
  let body;
799
484
  body = JSON.stringify({
800
485
  ...(input.IdentityPoolId != null && { identityPoolId: input.IdentityPoolId }),
@@ -820,26 +505,8 @@ const serializeAws_restJson1ImportBackendStorageCommand = async (input, context)
820
505
  };
821
506
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
822
507
  "/backend/{AppId}/storage/{BackendEnvironmentName}/import";
823
- if (input.AppId !== undefined) {
824
- const labelValue = input.AppId;
825
- if (labelValue.length <= 0) {
826
- throw new Error("Empty value provided for input HTTP label: AppId.");
827
- }
828
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
829
- }
830
- else {
831
- throw new Error("No value provided for input HTTP label: AppId.");
832
- }
833
- if (input.BackendEnvironmentName !== undefined) {
834
- const labelValue = input.BackendEnvironmentName;
835
- if (labelValue.length <= 0) {
836
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
837
- }
838
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
839
- }
840
- else {
841
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
842
- }
508
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
509
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
843
510
  let body;
844
511
  body = JSON.stringify({
845
512
  ...(input.BucketName != null && { bucketName: input.BucketName }),
@@ -863,26 +530,8 @@ const serializeAws_restJson1ListBackendJobsCommand = async (input, context) => {
863
530
  };
864
531
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
865
532
  "/backend/{AppId}/job/{BackendEnvironmentName}";
866
- if (input.AppId !== undefined) {
867
- const labelValue = input.AppId;
868
- if (labelValue.length <= 0) {
869
- throw new Error("Empty value provided for input HTTP label: AppId.");
870
- }
871
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
872
- }
873
- else {
874
- throw new Error("No value provided for input HTTP label: AppId.");
875
- }
876
- if (input.BackendEnvironmentName !== undefined) {
877
- const labelValue = input.BackendEnvironmentName;
878
- if (labelValue.length <= 0) {
879
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
880
- }
881
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
882
- }
883
- else {
884
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
885
- }
533
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
534
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
886
535
  let body;
887
536
  body = JSON.stringify({
888
537
  ...(input.JobId != null && { jobId: input.JobId }),
@@ -929,16 +578,7 @@ const serializeAws_restJson1RemoveAllBackendsCommand = async (input, context) =>
929
578
  "content-type": "application/json",
930
579
  };
931
580
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/remove";
932
- if (input.AppId !== undefined) {
933
- const labelValue = input.AppId;
934
- if (labelValue.length <= 0) {
935
- throw new Error("Empty value provided for input HTTP label: AppId.");
936
- }
937
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
938
- }
939
- else {
940
- throw new Error("No value provided for input HTTP label: AppId.");
941
- }
581
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
942
582
  let body;
943
583
  body = JSON.stringify({
944
584
  ...(input.CleanAmplifyApp != null && { cleanAmplifyApp: input.CleanAmplifyApp }),
@@ -958,16 +598,7 @@ const serializeAws_restJson1RemoveBackendConfigCommand = async (input, context)
958
598
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
959
599
  const headers = {};
960
600
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/config/remove";
961
- if (input.AppId !== undefined) {
962
- const labelValue = input.AppId;
963
- if (labelValue.length <= 0) {
964
- throw new Error("Empty value provided for input HTTP label: AppId.");
965
- }
966
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
967
- }
968
- else {
969
- throw new Error("No value provided for input HTTP label: AppId.");
970
- }
601
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
971
602
  let body;
972
603
  return new protocol_http_1.HttpRequest({
973
604
  protocol,
@@ -987,26 +618,8 @@ const serializeAws_restJson1UpdateBackendAPICommand = async (input, context) =>
987
618
  };
988
619
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
989
620
  "/backend/{AppId}/api/{BackendEnvironmentName}";
990
- if (input.AppId !== undefined) {
991
- const labelValue = input.AppId;
992
- if (labelValue.length <= 0) {
993
- throw new Error("Empty value provided for input HTTP label: AppId.");
994
- }
995
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
996
- }
997
- else {
998
- throw new Error("No value provided for input HTTP label: AppId.");
999
- }
1000
- if (input.BackendEnvironmentName !== undefined) {
1001
- const labelValue = input.BackendEnvironmentName;
1002
- if (labelValue.length <= 0) {
1003
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
1004
- }
1005
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1006
- }
1007
- else {
1008
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
1009
- }
621
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
622
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
1010
623
  let body;
1011
624
  body = JSON.stringify({
1012
625
  ...(input.ResourceConfig != null && {
@@ -1032,26 +645,8 @@ const serializeAws_restJson1UpdateBackendAuthCommand = async (input, context) =>
1032
645
  };
1033
646
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1034
647
  "/backend/{AppId}/auth/{BackendEnvironmentName}";
1035
- if (input.AppId !== undefined) {
1036
- const labelValue = input.AppId;
1037
- if (labelValue.length <= 0) {
1038
- throw new Error("Empty value provided for input HTTP label: AppId.");
1039
- }
1040
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1041
- }
1042
- else {
1043
- throw new Error("No value provided for input HTTP label: AppId.");
1044
- }
1045
- if (input.BackendEnvironmentName !== undefined) {
1046
- const labelValue = input.BackendEnvironmentName;
1047
- if (labelValue.length <= 0) {
1048
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
1049
- }
1050
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1051
- }
1052
- else {
1053
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
1054
- }
648
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
649
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
1055
650
  let body;
1056
651
  body = JSON.stringify({
1057
652
  ...(input.ResourceConfig != null && {
@@ -1076,16 +671,7 @@ const serializeAws_restJson1UpdateBackendConfigCommand = async (input, context)
1076
671
  "content-type": "application/json",
1077
672
  };
1078
673
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/config/update";
1079
- if (input.AppId !== undefined) {
1080
- const labelValue = input.AppId;
1081
- if (labelValue.length <= 0) {
1082
- throw new Error("Empty value provided for input HTTP label: AppId.");
1083
- }
1084
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1085
- }
1086
- else {
1087
- throw new Error("No value provided for input HTTP label: AppId.");
1088
- }
674
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
1089
675
  let body;
1090
676
  body = JSON.stringify({
1091
677
  ...(input.LoginAuthConfig != null && {
@@ -1110,36 +696,9 @@ const serializeAws_restJson1UpdateBackendJobCommand = async (input, context) =>
1110
696
  };
1111
697
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1112
698
  "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}";
1113
- if (input.AppId !== undefined) {
1114
- const labelValue = input.AppId;
1115
- if (labelValue.length <= 0) {
1116
- throw new Error("Empty value provided for input HTTP label: AppId.");
1117
- }
1118
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1119
- }
1120
- else {
1121
- throw new Error("No value provided for input HTTP label: AppId.");
1122
- }
1123
- if (input.BackendEnvironmentName !== undefined) {
1124
- const labelValue = input.BackendEnvironmentName;
1125
- if (labelValue.length <= 0) {
1126
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
1127
- }
1128
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1129
- }
1130
- else {
1131
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
1132
- }
1133
- if (input.JobId !== undefined) {
1134
- const labelValue = input.JobId;
1135
- if (labelValue.length <= 0) {
1136
- throw new Error("Empty value provided for input HTTP label: JobId.");
1137
- }
1138
- resolvedPath = resolvedPath.replace("{JobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1139
- }
1140
- else {
1141
- throw new Error("No value provided for input HTTP label: JobId.");
1142
- }
699
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
700
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
701
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "JobId", () => input.JobId, "{JobId}", false);
1143
702
  let body;
1144
703
  body = JSON.stringify({
1145
704
  ...(input.Operation != null && { operation: input.Operation }),
@@ -1163,26 +722,8 @@ const serializeAws_restJson1UpdateBackendStorageCommand = async (input, context)
1163
722
  };
1164
723
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1165
724
  "/backend/{AppId}/storage/{BackendEnvironmentName}";
1166
- if (input.AppId !== undefined) {
1167
- const labelValue = input.AppId;
1168
- if (labelValue.length <= 0) {
1169
- throw new Error("Empty value provided for input HTTP label: AppId.");
1170
- }
1171
- resolvedPath = resolvedPath.replace("{AppId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1172
- }
1173
- else {
1174
- throw new Error("No value provided for input HTTP label: AppId.");
1175
- }
1176
- if (input.BackendEnvironmentName !== undefined) {
1177
- const labelValue = input.BackendEnvironmentName;
1178
- if (labelValue.length <= 0) {
1179
- throw new Error("Empty value provided for input HTTP label: BackendEnvironmentName.");
1180
- }
1181
- resolvedPath = resolvedPath.replace("{BackendEnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1182
- }
1183
- else {
1184
- throw new Error("No value provided for input HTTP label: BackendEnvironmentName.");
1185
- }
725
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AppId", () => input.AppId, "{AppId}", false);
726
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BackendEnvironmentName", () => input.BackendEnvironmentName, "{BackendEnvironmentName}", false);
1186
727
  let body;
1187
728
  body = JSON.stringify({
1188
729
  ...(input.ResourceConfig != null && {
@@ -1205,35 +746,29 @@ const deserializeAws_restJson1CloneBackendCommand = async (output, context) => {
1205
746
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1206
747
  return deserializeAws_restJson1CloneBackendCommandError(output, context);
1207
748
  }
1208
- const contents = {
749
+ const contents = map({
1209
750
  $metadata: deserializeMetadata(output),
1210
- AppId: undefined,
1211
- BackendEnvironmentName: undefined,
1212
- Error: undefined,
1213
- JobId: undefined,
1214
- Operation: undefined,
1215
- Status: undefined,
1216
- };
751
+ });
1217
752
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1218
- if (data.appId !== undefined && data.appId !== null) {
753
+ if (data.appId != null) {
1219
754
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1220
755
  }
1221
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
756
+ if (data.backendEnvironmentName != null) {
1222
757
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1223
758
  }
1224
- if (data.error !== undefined && data.error !== null) {
759
+ if (data.error != null) {
1225
760
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1226
761
  }
1227
- if (data.jobId !== undefined && data.jobId !== null) {
762
+ if (data.jobId != null) {
1228
763
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1229
764
  }
1230
- if (data.operation !== undefined && data.operation !== null) {
765
+ if (data.operation != null) {
1231
766
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1232
767
  }
1233
- if (data.status !== undefined && data.status !== null) {
768
+ if (data.status != null) {
1234
769
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1235
770
  }
1236
- return Promise.resolve(contents);
771
+ return contents;
1237
772
  };
1238
773
  exports.deserializeAws_restJson1CloneBackendCommand = deserializeAws_restJson1CloneBackendCommand;
1239
774
  const deserializeAws_restJson1CloneBackendCommandError = async (output, context) => {
@@ -1241,7 +776,6 @@ const deserializeAws_restJson1CloneBackendCommandError = async (output, context)
1241
776
  ...output,
1242
777
  body: await parseBody(output.body, context),
1243
778
  };
1244
- let response;
1245
779
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1246
780
  switch (errorCode) {
1247
781
  case "BadRequestException":
@@ -1258,49 +792,41 @@ const deserializeAws_restJson1CloneBackendCommandError = async (output, context)
1258
792
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1259
793
  default:
1260
794
  const parsedBody = parsedOutput.body;
1261
- const $metadata = deserializeMetadata(output);
1262
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1263
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1264
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1265
- $fault: "client",
1266
- $metadata,
795
+ (0, smithy_client_1.throwDefaultError)({
796
+ output,
797
+ parsedBody,
798
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
799
+ errorCode,
1267
800
  });
1268
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1269
801
  }
1270
802
  };
1271
803
  const deserializeAws_restJson1CreateBackendCommand = async (output, context) => {
1272
804
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1273
805
  return deserializeAws_restJson1CreateBackendCommandError(output, context);
1274
806
  }
1275
- const contents = {
807
+ const contents = map({
1276
808
  $metadata: deserializeMetadata(output),
1277
- AppId: undefined,
1278
- BackendEnvironmentName: undefined,
1279
- Error: undefined,
1280
- JobId: undefined,
1281
- Operation: undefined,
1282
- Status: undefined,
1283
- };
809
+ });
1284
810
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1285
- if (data.appId !== undefined && data.appId !== null) {
811
+ if (data.appId != null) {
1286
812
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1287
813
  }
1288
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
814
+ if (data.backendEnvironmentName != null) {
1289
815
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1290
816
  }
1291
- if (data.error !== undefined && data.error !== null) {
817
+ if (data.error != null) {
1292
818
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1293
819
  }
1294
- if (data.jobId !== undefined && data.jobId !== null) {
820
+ if (data.jobId != null) {
1295
821
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1296
822
  }
1297
- if (data.operation !== undefined && data.operation !== null) {
823
+ if (data.operation != null) {
1298
824
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1299
825
  }
1300
- if (data.status !== undefined && data.status !== null) {
826
+ if (data.status != null) {
1301
827
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1302
828
  }
1303
- return Promise.resolve(contents);
829
+ return contents;
1304
830
  };
1305
831
  exports.deserializeAws_restJson1CreateBackendCommand = deserializeAws_restJson1CreateBackendCommand;
1306
832
  const deserializeAws_restJson1CreateBackendCommandError = async (output, context) => {
@@ -1308,7 +834,6 @@ const deserializeAws_restJson1CreateBackendCommandError = async (output, context
1308
834
  ...output,
1309
835
  body: await parseBody(output.body, context),
1310
836
  };
1311
- let response;
1312
837
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1313
838
  switch (errorCode) {
1314
839
  case "BadRequestException":
@@ -1325,49 +850,41 @@ const deserializeAws_restJson1CreateBackendCommandError = async (output, context
1325
850
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1326
851
  default:
1327
852
  const parsedBody = parsedOutput.body;
1328
- const $metadata = deserializeMetadata(output);
1329
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1330
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1331
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1332
- $fault: "client",
1333
- $metadata,
853
+ (0, smithy_client_1.throwDefaultError)({
854
+ output,
855
+ parsedBody,
856
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
857
+ errorCode,
1334
858
  });
1335
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1336
859
  }
1337
860
  };
1338
861
  const deserializeAws_restJson1CreateBackendAPICommand = async (output, context) => {
1339
862
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1340
863
  return deserializeAws_restJson1CreateBackendAPICommandError(output, context);
1341
864
  }
1342
- const contents = {
865
+ const contents = map({
1343
866
  $metadata: deserializeMetadata(output),
1344
- AppId: undefined,
1345
- BackendEnvironmentName: undefined,
1346
- Error: undefined,
1347
- JobId: undefined,
1348
- Operation: undefined,
1349
- Status: undefined,
1350
- };
867
+ });
1351
868
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1352
- if (data.appId !== undefined && data.appId !== null) {
869
+ if (data.appId != null) {
1353
870
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1354
871
  }
1355
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
872
+ if (data.backendEnvironmentName != null) {
1356
873
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1357
874
  }
1358
- if (data.error !== undefined && data.error !== null) {
875
+ if (data.error != null) {
1359
876
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1360
877
  }
1361
- if (data.jobId !== undefined && data.jobId !== null) {
878
+ if (data.jobId != null) {
1362
879
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1363
880
  }
1364
- if (data.operation !== undefined && data.operation !== null) {
881
+ if (data.operation != null) {
1365
882
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1366
883
  }
1367
- if (data.status !== undefined && data.status !== null) {
884
+ if (data.status != null) {
1368
885
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1369
886
  }
1370
- return Promise.resolve(contents);
887
+ return contents;
1371
888
  };
1372
889
  exports.deserializeAws_restJson1CreateBackendAPICommand = deserializeAws_restJson1CreateBackendAPICommand;
1373
890
  const deserializeAws_restJson1CreateBackendAPICommandError = async (output, context) => {
@@ -1375,7 +892,6 @@ const deserializeAws_restJson1CreateBackendAPICommandError = async (output, cont
1375
892
  ...output,
1376
893
  body: await parseBody(output.body, context),
1377
894
  };
1378
- let response;
1379
895
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1380
896
  switch (errorCode) {
1381
897
  case "BadRequestException":
@@ -1392,49 +908,41 @@ const deserializeAws_restJson1CreateBackendAPICommandError = async (output, cont
1392
908
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1393
909
  default:
1394
910
  const parsedBody = parsedOutput.body;
1395
- const $metadata = deserializeMetadata(output);
1396
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1397
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1398
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1399
- $fault: "client",
1400
- $metadata,
911
+ (0, smithy_client_1.throwDefaultError)({
912
+ output,
913
+ parsedBody,
914
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
915
+ errorCode,
1401
916
  });
1402
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1403
917
  }
1404
918
  };
1405
919
  const deserializeAws_restJson1CreateBackendAuthCommand = async (output, context) => {
1406
920
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1407
921
  return deserializeAws_restJson1CreateBackendAuthCommandError(output, context);
1408
922
  }
1409
- const contents = {
923
+ const contents = map({
1410
924
  $metadata: deserializeMetadata(output),
1411
- AppId: undefined,
1412
- BackendEnvironmentName: undefined,
1413
- Error: undefined,
1414
- JobId: undefined,
1415
- Operation: undefined,
1416
- Status: undefined,
1417
- };
925
+ });
1418
926
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1419
- if (data.appId !== undefined && data.appId !== null) {
927
+ if (data.appId != null) {
1420
928
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1421
929
  }
1422
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
930
+ if (data.backendEnvironmentName != null) {
1423
931
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1424
932
  }
1425
- if (data.error !== undefined && data.error !== null) {
933
+ if (data.error != null) {
1426
934
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1427
935
  }
1428
- if (data.jobId !== undefined && data.jobId !== null) {
936
+ if (data.jobId != null) {
1429
937
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1430
938
  }
1431
- if (data.operation !== undefined && data.operation !== null) {
939
+ if (data.operation != null) {
1432
940
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1433
941
  }
1434
- if (data.status !== undefined && data.status !== null) {
942
+ if (data.status != null) {
1435
943
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1436
944
  }
1437
- return Promise.resolve(contents);
945
+ return contents;
1438
946
  };
1439
947
  exports.deserializeAws_restJson1CreateBackendAuthCommand = deserializeAws_restJson1CreateBackendAuthCommand;
1440
948
  const deserializeAws_restJson1CreateBackendAuthCommandError = async (output, context) => {
@@ -1442,7 +950,6 @@ const deserializeAws_restJson1CreateBackendAuthCommandError = async (output, con
1442
950
  ...output,
1443
951
  body: await parseBody(output.body, context),
1444
952
  };
1445
- let response;
1446
953
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1447
954
  switch (errorCode) {
1448
955
  case "BadRequestException":
@@ -1459,41 +966,35 @@ const deserializeAws_restJson1CreateBackendAuthCommandError = async (output, con
1459
966
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1460
967
  default:
1461
968
  const parsedBody = parsedOutput.body;
1462
- const $metadata = deserializeMetadata(output);
1463
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1464
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1465
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1466
- $fault: "client",
1467
- $metadata,
969
+ (0, smithy_client_1.throwDefaultError)({
970
+ output,
971
+ parsedBody,
972
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
973
+ errorCode,
1468
974
  });
1469
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1470
975
  }
1471
976
  };
1472
977
  const deserializeAws_restJson1CreateBackendConfigCommand = async (output, context) => {
1473
978
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1474
979
  return deserializeAws_restJson1CreateBackendConfigCommandError(output, context);
1475
980
  }
1476
- const contents = {
981
+ const contents = map({
1477
982
  $metadata: deserializeMetadata(output),
1478
- AppId: undefined,
1479
- BackendEnvironmentName: undefined,
1480
- JobId: undefined,
1481
- Status: undefined,
1482
- };
983
+ });
1483
984
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1484
- if (data.appId !== undefined && data.appId !== null) {
985
+ if (data.appId != null) {
1485
986
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1486
987
  }
1487
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
988
+ if (data.backendEnvironmentName != null) {
1488
989
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1489
990
  }
1490
- if (data.jobId !== undefined && data.jobId !== null) {
991
+ if (data.jobId != null) {
1491
992
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1492
993
  }
1493
- if (data.status !== undefined && data.status !== null) {
994
+ if (data.status != null) {
1494
995
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1495
996
  }
1496
- return Promise.resolve(contents);
997
+ return contents;
1497
998
  };
1498
999
  exports.deserializeAws_restJson1CreateBackendConfigCommand = deserializeAws_restJson1CreateBackendConfigCommand;
1499
1000
  const deserializeAws_restJson1CreateBackendConfigCommandError = async (output, context) => {
@@ -1501,7 +1002,6 @@ const deserializeAws_restJson1CreateBackendConfigCommandError = async (output, c
1501
1002
  ...output,
1502
1003
  body: await parseBody(output.body, context),
1503
1004
  };
1504
- let response;
1505
1005
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1506
1006
  switch (errorCode) {
1507
1007
  case "BadRequestException":
@@ -1518,41 +1018,35 @@ const deserializeAws_restJson1CreateBackendConfigCommandError = async (output, c
1518
1018
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1519
1019
  default:
1520
1020
  const parsedBody = parsedOutput.body;
1521
- const $metadata = deserializeMetadata(output);
1522
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1523
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1524
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1525
- $fault: "client",
1526
- $metadata,
1021
+ (0, smithy_client_1.throwDefaultError)({
1022
+ output,
1023
+ parsedBody,
1024
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1025
+ errorCode,
1527
1026
  });
1528
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1529
1027
  }
1530
1028
  };
1531
1029
  const deserializeAws_restJson1CreateBackendStorageCommand = async (output, context) => {
1532
1030
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1533
1031
  return deserializeAws_restJson1CreateBackendStorageCommandError(output, context);
1534
1032
  }
1535
- const contents = {
1033
+ const contents = map({
1536
1034
  $metadata: deserializeMetadata(output),
1537
- AppId: undefined,
1538
- BackendEnvironmentName: undefined,
1539
- JobId: undefined,
1540
- Status: undefined,
1541
- };
1035
+ });
1542
1036
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1543
- if (data.appId !== undefined && data.appId !== null) {
1037
+ if (data.appId != null) {
1544
1038
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1545
1039
  }
1546
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1040
+ if (data.backendEnvironmentName != null) {
1547
1041
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1548
1042
  }
1549
- if (data.jobId !== undefined && data.jobId !== null) {
1043
+ if (data.jobId != null) {
1550
1044
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1551
1045
  }
1552
- if (data.status !== undefined && data.status !== null) {
1046
+ if (data.status != null) {
1553
1047
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1554
1048
  }
1555
- return Promise.resolve(contents);
1049
+ return contents;
1556
1050
  };
1557
1051
  exports.deserializeAws_restJson1CreateBackendStorageCommand = deserializeAws_restJson1CreateBackendStorageCommand;
1558
1052
  const deserializeAws_restJson1CreateBackendStorageCommandError = async (output, context) => {
@@ -1560,7 +1054,6 @@ const deserializeAws_restJson1CreateBackendStorageCommandError = async (output,
1560
1054
  ...output,
1561
1055
  body: await parseBody(output.body, context),
1562
1056
  };
1563
- let response;
1564
1057
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1565
1058
  switch (errorCode) {
1566
1059
  case "BadRequestException":
@@ -1577,41 +1070,35 @@ const deserializeAws_restJson1CreateBackendStorageCommandError = async (output,
1577
1070
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1578
1071
  default:
1579
1072
  const parsedBody = parsedOutput.body;
1580
- const $metadata = deserializeMetadata(output);
1581
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1582
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1583
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1584
- $fault: "client",
1585
- $metadata,
1073
+ (0, smithy_client_1.throwDefaultError)({
1074
+ output,
1075
+ parsedBody,
1076
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1077
+ errorCode,
1586
1078
  });
1587
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1588
1079
  }
1589
1080
  };
1590
1081
  const deserializeAws_restJson1CreateTokenCommand = async (output, context) => {
1591
1082
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1592
1083
  return deserializeAws_restJson1CreateTokenCommandError(output, context);
1593
1084
  }
1594
- const contents = {
1085
+ const contents = map({
1595
1086
  $metadata: deserializeMetadata(output),
1596
- AppId: undefined,
1597
- ChallengeCode: undefined,
1598
- SessionId: undefined,
1599
- Ttl: undefined,
1600
- };
1087
+ });
1601
1088
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1602
- if (data.appId !== undefined && data.appId !== null) {
1089
+ if (data.appId != null) {
1603
1090
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1604
1091
  }
1605
- if (data.challengeCode !== undefined && data.challengeCode !== null) {
1092
+ if (data.challengeCode != null) {
1606
1093
  contents.ChallengeCode = (0, smithy_client_1.expectString)(data.challengeCode);
1607
1094
  }
1608
- if (data.sessionId !== undefined && data.sessionId !== null) {
1095
+ if (data.sessionId != null) {
1609
1096
  contents.SessionId = (0, smithy_client_1.expectString)(data.sessionId);
1610
1097
  }
1611
- if (data.ttl !== undefined && data.ttl !== null) {
1098
+ if (data.ttl != null) {
1612
1099
  contents.Ttl = (0, smithy_client_1.expectString)(data.ttl);
1613
1100
  }
1614
- return Promise.resolve(contents);
1101
+ return contents;
1615
1102
  };
1616
1103
  exports.deserializeAws_restJson1CreateTokenCommand = deserializeAws_restJson1CreateTokenCommand;
1617
1104
  const deserializeAws_restJson1CreateTokenCommandError = async (output, context) => {
@@ -1619,7 +1106,6 @@ const deserializeAws_restJson1CreateTokenCommandError = async (output, context)
1619
1106
  ...output,
1620
1107
  body: await parseBody(output.body, context),
1621
1108
  };
1622
- let response;
1623
1109
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1624
1110
  switch (errorCode) {
1625
1111
  case "BadRequestException":
@@ -1636,49 +1122,41 @@ const deserializeAws_restJson1CreateTokenCommandError = async (output, context)
1636
1122
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1637
1123
  default:
1638
1124
  const parsedBody = parsedOutput.body;
1639
- const $metadata = deserializeMetadata(output);
1640
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1641
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1642
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1643
- $fault: "client",
1644
- $metadata,
1125
+ (0, smithy_client_1.throwDefaultError)({
1126
+ output,
1127
+ parsedBody,
1128
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1129
+ errorCode,
1645
1130
  });
1646
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1647
1131
  }
1648
1132
  };
1649
1133
  const deserializeAws_restJson1DeleteBackendCommand = async (output, context) => {
1650
1134
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1651
1135
  return deserializeAws_restJson1DeleteBackendCommandError(output, context);
1652
1136
  }
1653
- const contents = {
1137
+ const contents = map({
1654
1138
  $metadata: deserializeMetadata(output),
1655
- AppId: undefined,
1656
- BackendEnvironmentName: undefined,
1657
- Error: undefined,
1658
- JobId: undefined,
1659
- Operation: undefined,
1660
- Status: undefined,
1661
- };
1139
+ });
1662
1140
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1663
- if (data.appId !== undefined && data.appId !== null) {
1141
+ if (data.appId != null) {
1664
1142
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1665
1143
  }
1666
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1144
+ if (data.backendEnvironmentName != null) {
1667
1145
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1668
1146
  }
1669
- if (data.error !== undefined && data.error !== null) {
1147
+ if (data.error != null) {
1670
1148
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1671
1149
  }
1672
- if (data.jobId !== undefined && data.jobId !== null) {
1150
+ if (data.jobId != null) {
1673
1151
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1674
1152
  }
1675
- if (data.operation !== undefined && data.operation !== null) {
1153
+ if (data.operation != null) {
1676
1154
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1677
1155
  }
1678
- if (data.status !== undefined && data.status !== null) {
1156
+ if (data.status != null) {
1679
1157
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1680
1158
  }
1681
- return Promise.resolve(contents);
1159
+ return contents;
1682
1160
  };
1683
1161
  exports.deserializeAws_restJson1DeleteBackendCommand = deserializeAws_restJson1DeleteBackendCommand;
1684
1162
  const deserializeAws_restJson1DeleteBackendCommandError = async (output, context) => {
@@ -1686,7 +1164,6 @@ const deserializeAws_restJson1DeleteBackendCommandError = async (output, context
1686
1164
  ...output,
1687
1165
  body: await parseBody(output.body, context),
1688
1166
  };
1689
- let response;
1690
1167
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1691
1168
  switch (errorCode) {
1692
1169
  case "BadRequestException":
@@ -1703,49 +1180,41 @@ const deserializeAws_restJson1DeleteBackendCommandError = async (output, context
1703
1180
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1704
1181
  default:
1705
1182
  const parsedBody = parsedOutput.body;
1706
- const $metadata = deserializeMetadata(output);
1707
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1708
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1709
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1710
- $fault: "client",
1711
- $metadata,
1183
+ (0, smithy_client_1.throwDefaultError)({
1184
+ output,
1185
+ parsedBody,
1186
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1187
+ errorCode,
1712
1188
  });
1713
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1714
1189
  }
1715
1190
  };
1716
1191
  const deserializeAws_restJson1DeleteBackendAPICommand = async (output, context) => {
1717
1192
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1718
1193
  return deserializeAws_restJson1DeleteBackendAPICommandError(output, context);
1719
1194
  }
1720
- const contents = {
1195
+ const contents = map({
1721
1196
  $metadata: deserializeMetadata(output),
1722
- AppId: undefined,
1723
- BackendEnvironmentName: undefined,
1724
- Error: undefined,
1725
- JobId: undefined,
1726
- Operation: undefined,
1727
- Status: undefined,
1728
- };
1197
+ });
1729
1198
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1730
- if (data.appId !== undefined && data.appId !== null) {
1199
+ if (data.appId != null) {
1731
1200
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1732
1201
  }
1733
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1202
+ if (data.backendEnvironmentName != null) {
1734
1203
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1735
1204
  }
1736
- if (data.error !== undefined && data.error !== null) {
1205
+ if (data.error != null) {
1737
1206
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1738
1207
  }
1739
- if (data.jobId !== undefined && data.jobId !== null) {
1208
+ if (data.jobId != null) {
1740
1209
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1741
1210
  }
1742
- if (data.operation !== undefined && data.operation !== null) {
1211
+ if (data.operation != null) {
1743
1212
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1744
1213
  }
1745
- if (data.status !== undefined && data.status !== null) {
1214
+ if (data.status != null) {
1746
1215
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1747
1216
  }
1748
- return Promise.resolve(contents);
1217
+ return contents;
1749
1218
  };
1750
1219
  exports.deserializeAws_restJson1DeleteBackendAPICommand = deserializeAws_restJson1DeleteBackendAPICommand;
1751
1220
  const deserializeAws_restJson1DeleteBackendAPICommandError = async (output, context) => {
@@ -1753,7 +1222,6 @@ const deserializeAws_restJson1DeleteBackendAPICommandError = async (output, cont
1753
1222
  ...output,
1754
1223
  body: await parseBody(output.body, context),
1755
1224
  };
1756
- let response;
1757
1225
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1758
1226
  switch (errorCode) {
1759
1227
  case "BadRequestException":
@@ -1770,49 +1238,41 @@ const deserializeAws_restJson1DeleteBackendAPICommandError = async (output, cont
1770
1238
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1771
1239
  default:
1772
1240
  const parsedBody = parsedOutput.body;
1773
- const $metadata = deserializeMetadata(output);
1774
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1775
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1776
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1777
- $fault: "client",
1778
- $metadata,
1241
+ (0, smithy_client_1.throwDefaultError)({
1242
+ output,
1243
+ parsedBody,
1244
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1245
+ errorCode,
1779
1246
  });
1780
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1781
1247
  }
1782
1248
  };
1783
1249
  const deserializeAws_restJson1DeleteBackendAuthCommand = async (output, context) => {
1784
1250
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1785
1251
  return deserializeAws_restJson1DeleteBackendAuthCommandError(output, context);
1786
1252
  }
1787
- const contents = {
1253
+ const contents = map({
1788
1254
  $metadata: deserializeMetadata(output),
1789
- AppId: undefined,
1790
- BackendEnvironmentName: undefined,
1791
- Error: undefined,
1792
- JobId: undefined,
1793
- Operation: undefined,
1794
- Status: undefined,
1795
- };
1255
+ });
1796
1256
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1797
- if (data.appId !== undefined && data.appId !== null) {
1257
+ if (data.appId != null) {
1798
1258
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1799
1259
  }
1800
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1260
+ if (data.backendEnvironmentName != null) {
1801
1261
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1802
1262
  }
1803
- if (data.error !== undefined && data.error !== null) {
1263
+ if (data.error != null) {
1804
1264
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1805
1265
  }
1806
- if (data.jobId !== undefined && data.jobId !== null) {
1266
+ if (data.jobId != null) {
1807
1267
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1808
1268
  }
1809
- if (data.operation !== undefined && data.operation !== null) {
1269
+ if (data.operation != null) {
1810
1270
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1811
1271
  }
1812
- if (data.status !== undefined && data.status !== null) {
1272
+ if (data.status != null) {
1813
1273
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1814
1274
  }
1815
- return Promise.resolve(contents);
1275
+ return contents;
1816
1276
  };
1817
1277
  exports.deserializeAws_restJson1DeleteBackendAuthCommand = deserializeAws_restJson1DeleteBackendAuthCommand;
1818
1278
  const deserializeAws_restJson1DeleteBackendAuthCommandError = async (output, context) => {
@@ -1820,7 +1280,6 @@ const deserializeAws_restJson1DeleteBackendAuthCommandError = async (output, con
1820
1280
  ...output,
1821
1281
  body: await parseBody(output.body, context),
1822
1282
  };
1823
- let response;
1824
1283
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1825
1284
  switch (errorCode) {
1826
1285
  case "BadRequestException":
@@ -1837,41 +1296,35 @@ const deserializeAws_restJson1DeleteBackendAuthCommandError = async (output, con
1837
1296
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1838
1297
  default:
1839
1298
  const parsedBody = parsedOutput.body;
1840
- const $metadata = deserializeMetadata(output);
1841
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1842
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1843
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1844
- $fault: "client",
1845
- $metadata,
1299
+ (0, smithy_client_1.throwDefaultError)({
1300
+ output,
1301
+ parsedBody,
1302
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1303
+ errorCode,
1846
1304
  });
1847
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1848
1305
  }
1849
1306
  };
1850
1307
  const deserializeAws_restJson1DeleteBackendStorageCommand = async (output, context) => {
1851
1308
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1852
1309
  return deserializeAws_restJson1DeleteBackendStorageCommandError(output, context);
1853
1310
  }
1854
- const contents = {
1311
+ const contents = map({
1855
1312
  $metadata: deserializeMetadata(output),
1856
- AppId: undefined,
1857
- BackendEnvironmentName: undefined,
1858
- JobId: undefined,
1859
- Status: undefined,
1860
- };
1313
+ });
1861
1314
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1862
- if (data.appId !== undefined && data.appId !== null) {
1315
+ if (data.appId != null) {
1863
1316
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1864
1317
  }
1865
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1318
+ if (data.backendEnvironmentName != null) {
1866
1319
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1867
1320
  }
1868
- if (data.jobId !== undefined && data.jobId !== null) {
1321
+ if (data.jobId != null) {
1869
1322
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1870
1323
  }
1871
- if (data.status !== undefined && data.status !== null) {
1324
+ if (data.status != null) {
1872
1325
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1873
1326
  }
1874
- return Promise.resolve(contents);
1327
+ return contents;
1875
1328
  };
1876
1329
  exports.deserializeAws_restJson1DeleteBackendStorageCommand = deserializeAws_restJson1DeleteBackendStorageCommand;
1877
1330
  const deserializeAws_restJson1DeleteBackendStorageCommandError = async (output, context) => {
@@ -1879,7 +1332,6 @@ const deserializeAws_restJson1DeleteBackendStorageCommandError = async (output,
1879
1332
  ...output,
1880
1333
  body: await parseBody(output.body, context),
1881
1334
  };
1882
- let response;
1883
1335
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1884
1336
  switch (errorCode) {
1885
1337
  case "BadRequestException":
@@ -1896,29 +1348,26 @@ const deserializeAws_restJson1DeleteBackendStorageCommandError = async (output,
1896
1348
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1897
1349
  default:
1898
1350
  const parsedBody = parsedOutput.body;
1899
- const $metadata = deserializeMetadata(output);
1900
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1901
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1902
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1903
- $fault: "client",
1904
- $metadata,
1351
+ (0, smithy_client_1.throwDefaultError)({
1352
+ output,
1353
+ parsedBody,
1354
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1355
+ errorCode,
1905
1356
  });
1906
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1907
1357
  }
1908
1358
  };
1909
1359
  const deserializeAws_restJson1DeleteTokenCommand = async (output, context) => {
1910
1360
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1911
1361
  return deserializeAws_restJson1DeleteTokenCommandError(output, context);
1912
1362
  }
1913
- const contents = {
1363
+ const contents = map({
1914
1364
  $metadata: deserializeMetadata(output),
1915
- IsSuccess: undefined,
1916
- };
1365
+ });
1917
1366
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1918
- if (data.isSuccess !== undefined && data.isSuccess !== null) {
1367
+ if (data.isSuccess != null) {
1919
1368
  contents.IsSuccess = (0, smithy_client_1.expectBoolean)(data.isSuccess);
1920
1369
  }
1921
- return Promise.resolve(contents);
1370
+ return contents;
1922
1371
  };
1923
1372
  exports.deserializeAws_restJson1DeleteTokenCommand = deserializeAws_restJson1DeleteTokenCommand;
1924
1373
  const deserializeAws_restJson1DeleteTokenCommandError = async (output, context) => {
@@ -1926,7 +1375,6 @@ const deserializeAws_restJson1DeleteTokenCommandError = async (output, context)
1926
1375
  ...output,
1927
1376
  body: await parseBody(output.body, context),
1928
1377
  };
1929
- let response;
1930
1378
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1931
1379
  switch (errorCode) {
1932
1380
  case "BadRequestException":
@@ -1943,49 +1391,41 @@ const deserializeAws_restJson1DeleteTokenCommandError = async (output, context)
1943
1391
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1944
1392
  default:
1945
1393
  const parsedBody = parsedOutput.body;
1946
- const $metadata = deserializeMetadata(output);
1947
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1948
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1949
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1950
- $fault: "client",
1951
- $metadata,
1394
+ (0, smithy_client_1.throwDefaultError)({
1395
+ output,
1396
+ parsedBody,
1397
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1398
+ errorCode,
1952
1399
  });
1953
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1954
1400
  }
1955
1401
  };
1956
1402
  const deserializeAws_restJson1GenerateBackendAPIModelsCommand = async (output, context) => {
1957
1403
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1958
1404
  return deserializeAws_restJson1GenerateBackendAPIModelsCommandError(output, context);
1959
1405
  }
1960
- const contents = {
1406
+ const contents = map({
1961
1407
  $metadata: deserializeMetadata(output),
1962
- AppId: undefined,
1963
- BackendEnvironmentName: undefined,
1964
- Error: undefined,
1965
- JobId: undefined,
1966
- Operation: undefined,
1967
- Status: undefined,
1968
- };
1408
+ });
1969
1409
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1970
- if (data.appId !== undefined && data.appId !== null) {
1410
+ if (data.appId != null) {
1971
1411
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
1972
1412
  }
1973
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1413
+ if (data.backendEnvironmentName != null) {
1974
1414
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
1975
1415
  }
1976
- if (data.error !== undefined && data.error !== null) {
1416
+ if (data.error != null) {
1977
1417
  contents.Error = (0, smithy_client_1.expectString)(data.error);
1978
1418
  }
1979
- if (data.jobId !== undefined && data.jobId !== null) {
1419
+ if (data.jobId != null) {
1980
1420
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
1981
1421
  }
1982
- if (data.operation !== undefined && data.operation !== null) {
1422
+ if (data.operation != null) {
1983
1423
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
1984
1424
  }
1985
- if (data.status !== undefined && data.status !== null) {
1425
+ if (data.status != null) {
1986
1426
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1987
1427
  }
1988
- return Promise.resolve(contents);
1428
+ return contents;
1989
1429
  };
1990
1430
  exports.deserializeAws_restJson1GenerateBackendAPIModelsCommand = deserializeAws_restJson1GenerateBackendAPIModelsCommand;
1991
1431
  const deserializeAws_restJson1GenerateBackendAPIModelsCommandError = async (output, context) => {
@@ -1993,7 +1433,6 @@ const deserializeAws_restJson1GenerateBackendAPIModelsCommandError = async (outp
1993
1433
  ...output,
1994
1434
  body: await parseBody(output.body, context),
1995
1435
  };
1996
- let response;
1997
1436
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1998
1437
  switch (errorCode) {
1999
1438
  case "BadRequestException":
@@ -2010,53 +1449,44 @@ const deserializeAws_restJson1GenerateBackendAPIModelsCommandError = async (outp
2010
1449
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2011
1450
  default:
2012
1451
  const parsedBody = parsedOutput.body;
2013
- const $metadata = deserializeMetadata(output);
2014
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2015
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2016
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2017
- $fault: "client",
2018
- $metadata,
1452
+ (0, smithy_client_1.throwDefaultError)({
1453
+ output,
1454
+ parsedBody,
1455
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1456
+ errorCode,
2019
1457
  });
2020
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2021
1458
  }
2022
1459
  };
2023
1460
  const deserializeAws_restJson1GetBackendCommand = async (output, context) => {
2024
1461
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2025
1462
  return deserializeAws_restJson1GetBackendCommandError(output, context);
2026
1463
  }
2027
- const contents = {
1464
+ const contents = map({
2028
1465
  $metadata: deserializeMetadata(output),
2029
- AmplifyFeatureFlags: undefined,
2030
- AmplifyMetaConfig: undefined,
2031
- AppId: undefined,
2032
- AppName: undefined,
2033
- BackendEnvironmentList: undefined,
2034
- BackendEnvironmentName: undefined,
2035
- Error: undefined,
2036
- };
1466
+ });
2037
1467
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2038
- if (data.amplifyFeatureFlags !== undefined && data.amplifyFeatureFlags !== null) {
1468
+ if (data.amplifyFeatureFlags != null) {
2039
1469
  contents.AmplifyFeatureFlags = (0, smithy_client_1.expectString)(data.amplifyFeatureFlags);
2040
1470
  }
2041
- if (data.amplifyMetaConfig !== undefined && data.amplifyMetaConfig !== null) {
1471
+ if (data.amplifyMetaConfig != null) {
2042
1472
  contents.AmplifyMetaConfig = (0, smithy_client_1.expectString)(data.amplifyMetaConfig);
2043
1473
  }
2044
- if (data.appId !== undefined && data.appId !== null) {
1474
+ if (data.appId != null) {
2045
1475
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2046
1476
  }
2047
- if (data.appName !== undefined && data.appName !== null) {
1477
+ if (data.appName != null) {
2048
1478
  contents.AppName = (0, smithy_client_1.expectString)(data.appName);
2049
1479
  }
2050
- if (data.backendEnvironmentList !== undefined && data.backendEnvironmentList !== null) {
1480
+ if (data.backendEnvironmentList != null) {
2051
1481
  contents.BackendEnvironmentList = deserializeAws_restJson1ListOf__string(data.backendEnvironmentList, context);
2052
1482
  }
2053
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1483
+ if (data.backendEnvironmentName != null) {
2054
1484
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2055
1485
  }
2056
- if (data.error !== undefined && data.error !== null) {
1486
+ if (data.error != null) {
2057
1487
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2058
1488
  }
2059
- return Promise.resolve(contents);
1489
+ return contents;
2060
1490
  };
2061
1491
  exports.deserializeAws_restJson1GetBackendCommand = deserializeAws_restJson1GetBackendCommand;
2062
1492
  const deserializeAws_restJson1GetBackendCommandError = async (output, context) => {
@@ -2064,7 +1494,6 @@ const deserializeAws_restJson1GetBackendCommandError = async (output, context) =
2064
1494
  ...output,
2065
1495
  body: await parseBody(output.body, context),
2066
1496
  };
2067
- let response;
2068
1497
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2069
1498
  switch (errorCode) {
2070
1499
  case "BadRequestException":
@@ -2081,45 +1510,38 @@ const deserializeAws_restJson1GetBackendCommandError = async (output, context) =
2081
1510
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2082
1511
  default:
2083
1512
  const parsedBody = parsedOutput.body;
2084
- const $metadata = deserializeMetadata(output);
2085
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2086
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2087
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2088
- $fault: "client",
2089
- $metadata,
1513
+ (0, smithy_client_1.throwDefaultError)({
1514
+ output,
1515
+ parsedBody,
1516
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1517
+ errorCode,
2090
1518
  });
2091
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2092
1519
  }
2093
1520
  };
2094
1521
  const deserializeAws_restJson1GetBackendAPICommand = async (output, context) => {
2095
1522
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2096
1523
  return deserializeAws_restJson1GetBackendAPICommandError(output, context);
2097
1524
  }
2098
- const contents = {
1525
+ const contents = map({
2099
1526
  $metadata: deserializeMetadata(output),
2100
- AppId: undefined,
2101
- BackendEnvironmentName: undefined,
2102
- Error: undefined,
2103
- ResourceConfig: undefined,
2104
- ResourceName: undefined,
2105
- };
1527
+ });
2106
1528
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2107
- if (data.appId !== undefined && data.appId !== null) {
1529
+ if (data.appId != null) {
2108
1530
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2109
1531
  }
2110
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1532
+ if (data.backendEnvironmentName != null) {
2111
1533
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2112
1534
  }
2113
- if (data.error !== undefined && data.error !== null) {
1535
+ if (data.error != null) {
2114
1536
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2115
1537
  }
2116
- if (data.resourceConfig !== undefined && data.resourceConfig !== null) {
1538
+ if (data.resourceConfig != null) {
2117
1539
  contents.ResourceConfig = deserializeAws_restJson1BackendAPIResourceConfig(data.resourceConfig, context);
2118
1540
  }
2119
- if (data.resourceName !== undefined && data.resourceName !== null) {
1541
+ if (data.resourceName != null) {
2120
1542
  contents.ResourceName = (0, smithy_client_1.expectString)(data.resourceName);
2121
1543
  }
2122
- return Promise.resolve(contents);
1544
+ return contents;
2123
1545
  };
2124
1546
  exports.deserializeAws_restJson1GetBackendAPICommand = deserializeAws_restJson1GetBackendAPICommand;
2125
1547
  const deserializeAws_restJson1GetBackendAPICommandError = async (output, context) => {
@@ -2127,7 +1549,6 @@ const deserializeAws_restJson1GetBackendAPICommandError = async (output, context
2127
1549
  ...output,
2128
1550
  body: await parseBody(output.body, context),
2129
1551
  };
2130
- let response;
2131
1552
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2132
1553
  switch (errorCode) {
2133
1554
  case "BadRequestException":
@@ -2144,33 +1565,29 @@ const deserializeAws_restJson1GetBackendAPICommandError = async (output, context
2144
1565
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2145
1566
  default:
2146
1567
  const parsedBody = parsedOutput.body;
2147
- const $metadata = deserializeMetadata(output);
2148
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2149
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2150
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2151
- $fault: "client",
2152
- $metadata,
1568
+ (0, smithy_client_1.throwDefaultError)({
1569
+ output,
1570
+ parsedBody,
1571
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1572
+ errorCode,
2153
1573
  });
2154
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2155
1574
  }
2156
1575
  };
2157
1576
  const deserializeAws_restJson1GetBackendAPIModelsCommand = async (output, context) => {
2158
1577
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2159
1578
  return deserializeAws_restJson1GetBackendAPIModelsCommandError(output, context);
2160
1579
  }
2161
- const contents = {
1580
+ const contents = map({
2162
1581
  $metadata: deserializeMetadata(output),
2163
- Models: undefined,
2164
- Status: undefined,
2165
- };
1582
+ });
2166
1583
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2167
- if (data.models !== undefined && data.models !== null) {
1584
+ if (data.models != null) {
2168
1585
  contents.Models = (0, smithy_client_1.expectString)(data.models);
2169
1586
  }
2170
- if (data.status !== undefined && data.status !== null) {
1587
+ if (data.status != null) {
2171
1588
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2172
1589
  }
2173
- return Promise.resolve(contents);
1590
+ return contents;
2174
1591
  };
2175
1592
  exports.deserializeAws_restJson1GetBackendAPIModelsCommand = deserializeAws_restJson1GetBackendAPIModelsCommand;
2176
1593
  const deserializeAws_restJson1GetBackendAPIModelsCommandError = async (output, context) => {
@@ -2178,7 +1595,6 @@ const deserializeAws_restJson1GetBackendAPIModelsCommandError = async (output, c
2178
1595
  ...output,
2179
1596
  body: await parseBody(output.body, context),
2180
1597
  };
2181
- let response;
2182
1598
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2183
1599
  switch (errorCode) {
2184
1600
  case "BadRequestException":
@@ -2195,45 +1611,38 @@ const deserializeAws_restJson1GetBackendAPIModelsCommandError = async (output, c
2195
1611
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2196
1612
  default:
2197
1613
  const parsedBody = parsedOutput.body;
2198
- const $metadata = deserializeMetadata(output);
2199
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2200
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2201
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2202
- $fault: "client",
2203
- $metadata,
1614
+ (0, smithy_client_1.throwDefaultError)({
1615
+ output,
1616
+ parsedBody,
1617
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1618
+ errorCode,
2204
1619
  });
2205
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2206
1620
  }
2207
1621
  };
2208
1622
  const deserializeAws_restJson1GetBackendAuthCommand = async (output, context) => {
2209
1623
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2210
1624
  return deserializeAws_restJson1GetBackendAuthCommandError(output, context);
2211
1625
  }
2212
- const contents = {
1626
+ const contents = map({
2213
1627
  $metadata: deserializeMetadata(output),
2214
- AppId: undefined,
2215
- BackendEnvironmentName: undefined,
2216
- Error: undefined,
2217
- ResourceConfig: undefined,
2218
- ResourceName: undefined,
2219
- };
1628
+ });
2220
1629
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2221
- if (data.appId !== undefined && data.appId !== null) {
1630
+ if (data.appId != null) {
2222
1631
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2223
1632
  }
2224
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1633
+ if (data.backendEnvironmentName != null) {
2225
1634
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2226
1635
  }
2227
- if (data.error !== undefined && data.error !== null) {
1636
+ if (data.error != null) {
2228
1637
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2229
1638
  }
2230
- if (data.resourceConfig !== undefined && data.resourceConfig !== null) {
1639
+ if (data.resourceConfig != null) {
2231
1640
  contents.ResourceConfig = deserializeAws_restJson1CreateBackendAuthResourceConfig(data.resourceConfig, context);
2232
1641
  }
2233
- if (data.resourceName !== undefined && data.resourceName !== null) {
1642
+ if (data.resourceName != null) {
2234
1643
  contents.ResourceName = (0, smithy_client_1.expectString)(data.resourceName);
2235
1644
  }
2236
- return Promise.resolve(contents);
1645
+ return contents;
2237
1646
  };
2238
1647
  exports.deserializeAws_restJson1GetBackendAuthCommand = deserializeAws_restJson1GetBackendAuthCommand;
2239
1648
  const deserializeAws_restJson1GetBackendAuthCommandError = async (output, context) => {
@@ -2241,7 +1650,6 @@ const deserializeAws_restJson1GetBackendAuthCommandError = async (output, contex
2241
1650
  ...output,
2242
1651
  body: await parseBody(output.body, context),
2243
1652
  };
2244
- let response;
2245
1653
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2246
1654
  switch (errorCode) {
2247
1655
  case "BadRequestException":
@@ -2258,57 +1666,47 @@ const deserializeAws_restJson1GetBackendAuthCommandError = async (output, contex
2258
1666
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2259
1667
  default:
2260
1668
  const parsedBody = parsedOutput.body;
2261
- const $metadata = deserializeMetadata(output);
2262
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2263
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2264
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2265
- $fault: "client",
2266
- $metadata,
1669
+ (0, smithy_client_1.throwDefaultError)({
1670
+ output,
1671
+ parsedBody,
1672
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1673
+ errorCode,
2267
1674
  });
2268
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2269
1675
  }
2270
1676
  };
2271
1677
  const deserializeAws_restJson1GetBackendJobCommand = async (output, context) => {
2272
1678
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2273
1679
  return deserializeAws_restJson1GetBackendJobCommandError(output, context);
2274
1680
  }
2275
- const contents = {
1681
+ const contents = map({
2276
1682
  $metadata: deserializeMetadata(output),
2277
- AppId: undefined,
2278
- BackendEnvironmentName: undefined,
2279
- CreateTime: undefined,
2280
- Error: undefined,
2281
- JobId: undefined,
2282
- Operation: undefined,
2283
- Status: undefined,
2284
- UpdateTime: undefined,
2285
- };
1683
+ });
2286
1684
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2287
- if (data.appId !== undefined && data.appId !== null) {
1685
+ if (data.appId != null) {
2288
1686
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2289
1687
  }
2290
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1688
+ if (data.backendEnvironmentName != null) {
2291
1689
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2292
1690
  }
2293
- if (data.createTime !== undefined && data.createTime !== null) {
1691
+ if (data.createTime != null) {
2294
1692
  contents.CreateTime = (0, smithy_client_1.expectString)(data.createTime);
2295
1693
  }
2296
- if (data.error !== undefined && data.error !== null) {
1694
+ if (data.error != null) {
2297
1695
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2298
1696
  }
2299
- if (data.jobId !== undefined && data.jobId !== null) {
1697
+ if (data.jobId != null) {
2300
1698
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
2301
1699
  }
2302
- if (data.operation !== undefined && data.operation !== null) {
1700
+ if (data.operation != null) {
2303
1701
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
2304
1702
  }
2305
- if (data.status !== undefined && data.status !== null) {
1703
+ if (data.status != null) {
2306
1704
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2307
1705
  }
2308
- if (data.updateTime !== undefined && data.updateTime !== null) {
1706
+ if (data.updateTime != null) {
2309
1707
  contents.UpdateTime = (0, smithy_client_1.expectString)(data.updateTime);
2310
1708
  }
2311
- return Promise.resolve(contents);
1709
+ return contents;
2312
1710
  };
2313
1711
  exports.deserializeAws_restJson1GetBackendJobCommand = deserializeAws_restJson1GetBackendJobCommand;
2314
1712
  const deserializeAws_restJson1GetBackendJobCommandError = async (output, context) => {
@@ -2316,7 +1714,6 @@ const deserializeAws_restJson1GetBackendJobCommandError = async (output, context
2316
1714
  ...output,
2317
1715
  body: await parseBody(output.body, context),
2318
1716
  };
2319
- let response;
2320
1717
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2321
1718
  switch (errorCode) {
2322
1719
  case "BadRequestException":
@@ -2333,41 +1730,35 @@ const deserializeAws_restJson1GetBackendJobCommandError = async (output, context
2333
1730
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2334
1731
  default:
2335
1732
  const parsedBody = parsedOutput.body;
2336
- const $metadata = deserializeMetadata(output);
2337
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2338
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2339
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2340
- $fault: "client",
2341
- $metadata,
1733
+ (0, smithy_client_1.throwDefaultError)({
1734
+ output,
1735
+ parsedBody,
1736
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1737
+ errorCode,
2342
1738
  });
2343
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2344
1739
  }
2345
1740
  };
2346
1741
  const deserializeAws_restJson1GetBackendStorageCommand = async (output, context) => {
2347
1742
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2348
1743
  return deserializeAws_restJson1GetBackendStorageCommandError(output, context);
2349
1744
  }
2350
- const contents = {
1745
+ const contents = map({
2351
1746
  $metadata: deserializeMetadata(output),
2352
- AppId: undefined,
2353
- BackendEnvironmentName: undefined,
2354
- ResourceConfig: undefined,
2355
- ResourceName: undefined,
2356
- };
1747
+ });
2357
1748
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2358
- if (data.appId !== undefined && data.appId !== null) {
1749
+ if (data.appId != null) {
2359
1750
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2360
1751
  }
2361
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1752
+ if (data.backendEnvironmentName != null) {
2362
1753
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2363
1754
  }
2364
- if (data.resourceConfig !== undefined && data.resourceConfig !== null) {
1755
+ if (data.resourceConfig != null) {
2365
1756
  contents.ResourceConfig = deserializeAws_restJson1GetBackendStorageResourceConfig(data.resourceConfig, context);
2366
1757
  }
2367
- if (data.resourceName !== undefined && data.resourceName !== null) {
1758
+ if (data.resourceName != null) {
2368
1759
  contents.ResourceName = (0, smithy_client_1.expectString)(data.resourceName);
2369
1760
  }
2370
- return Promise.resolve(contents);
1761
+ return contents;
2371
1762
  };
2372
1763
  exports.deserializeAws_restJson1GetBackendStorageCommand = deserializeAws_restJson1GetBackendStorageCommand;
2373
1764
  const deserializeAws_restJson1GetBackendStorageCommandError = async (output, context) => {
@@ -2375,7 +1766,6 @@ const deserializeAws_restJson1GetBackendStorageCommandError = async (output, con
2375
1766
  ...output,
2376
1767
  body: await parseBody(output.body, context),
2377
1768
  };
2378
- let response;
2379
1769
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2380
1770
  switch (errorCode) {
2381
1771
  case "BadRequestException":
@@ -2392,41 +1782,35 @@ const deserializeAws_restJson1GetBackendStorageCommandError = async (output, con
2392
1782
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2393
1783
  default:
2394
1784
  const parsedBody = parsedOutput.body;
2395
- const $metadata = deserializeMetadata(output);
2396
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2397
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2398
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2399
- $fault: "client",
2400
- $metadata,
1785
+ (0, smithy_client_1.throwDefaultError)({
1786
+ output,
1787
+ parsedBody,
1788
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1789
+ errorCode,
2401
1790
  });
2402
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2403
1791
  }
2404
1792
  };
2405
1793
  const deserializeAws_restJson1GetTokenCommand = async (output, context) => {
2406
1794
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2407
1795
  return deserializeAws_restJson1GetTokenCommandError(output, context);
2408
1796
  }
2409
- const contents = {
1797
+ const contents = map({
2410
1798
  $metadata: deserializeMetadata(output),
2411
- AppId: undefined,
2412
- ChallengeCode: undefined,
2413
- SessionId: undefined,
2414
- Ttl: undefined,
2415
- };
1799
+ });
2416
1800
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2417
- if (data.appId !== undefined && data.appId !== null) {
1801
+ if (data.appId != null) {
2418
1802
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2419
1803
  }
2420
- if (data.challengeCode !== undefined && data.challengeCode !== null) {
1804
+ if (data.challengeCode != null) {
2421
1805
  contents.ChallengeCode = (0, smithy_client_1.expectString)(data.challengeCode);
2422
1806
  }
2423
- if (data.sessionId !== undefined && data.sessionId !== null) {
1807
+ if (data.sessionId != null) {
2424
1808
  contents.SessionId = (0, smithy_client_1.expectString)(data.sessionId);
2425
1809
  }
2426
- if (data.ttl !== undefined && data.ttl !== null) {
1810
+ if (data.ttl != null) {
2427
1811
  contents.Ttl = (0, smithy_client_1.expectString)(data.ttl);
2428
1812
  }
2429
- return Promise.resolve(contents);
1813
+ return contents;
2430
1814
  };
2431
1815
  exports.deserializeAws_restJson1GetTokenCommand = deserializeAws_restJson1GetTokenCommand;
2432
1816
  const deserializeAws_restJson1GetTokenCommandError = async (output, context) => {
@@ -2434,7 +1818,6 @@ const deserializeAws_restJson1GetTokenCommandError = async (output, context) =>
2434
1818
  ...output,
2435
1819
  body: await parseBody(output.body, context),
2436
1820
  };
2437
- let response;
2438
1821
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2439
1822
  switch (errorCode) {
2440
1823
  case "BadRequestException":
@@ -2451,49 +1834,41 @@ const deserializeAws_restJson1GetTokenCommandError = async (output, context) =>
2451
1834
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2452
1835
  default:
2453
1836
  const parsedBody = parsedOutput.body;
2454
- const $metadata = deserializeMetadata(output);
2455
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2456
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2457
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2458
- $fault: "client",
2459
- $metadata,
1837
+ (0, smithy_client_1.throwDefaultError)({
1838
+ output,
1839
+ parsedBody,
1840
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1841
+ errorCode,
2460
1842
  });
2461
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2462
1843
  }
2463
1844
  };
2464
1845
  const deserializeAws_restJson1ImportBackendAuthCommand = async (output, context) => {
2465
1846
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2466
1847
  return deserializeAws_restJson1ImportBackendAuthCommandError(output, context);
2467
1848
  }
2468
- const contents = {
1849
+ const contents = map({
2469
1850
  $metadata: deserializeMetadata(output),
2470
- AppId: undefined,
2471
- BackendEnvironmentName: undefined,
2472
- Error: undefined,
2473
- JobId: undefined,
2474
- Operation: undefined,
2475
- Status: undefined,
2476
- };
1851
+ });
2477
1852
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2478
- if (data.appId !== undefined && data.appId !== null) {
1853
+ if (data.appId != null) {
2479
1854
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2480
1855
  }
2481
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1856
+ if (data.backendEnvironmentName != null) {
2482
1857
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2483
1858
  }
2484
- if (data.error !== undefined && data.error !== null) {
1859
+ if (data.error != null) {
2485
1860
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2486
1861
  }
2487
- if (data.jobId !== undefined && data.jobId !== null) {
1862
+ if (data.jobId != null) {
2488
1863
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
2489
1864
  }
2490
- if (data.operation !== undefined && data.operation !== null) {
1865
+ if (data.operation != null) {
2491
1866
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
2492
1867
  }
2493
- if (data.status !== undefined && data.status !== null) {
1868
+ if (data.status != null) {
2494
1869
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2495
1870
  }
2496
- return Promise.resolve(contents);
1871
+ return contents;
2497
1872
  };
2498
1873
  exports.deserializeAws_restJson1ImportBackendAuthCommand = deserializeAws_restJson1ImportBackendAuthCommand;
2499
1874
  const deserializeAws_restJson1ImportBackendAuthCommandError = async (output, context) => {
@@ -2501,7 +1876,6 @@ const deserializeAws_restJson1ImportBackendAuthCommandError = async (output, con
2501
1876
  ...output,
2502
1877
  body: await parseBody(output.body, context),
2503
1878
  };
2504
- let response;
2505
1879
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2506
1880
  switch (errorCode) {
2507
1881
  case "BadRequestException":
@@ -2518,41 +1892,35 @@ const deserializeAws_restJson1ImportBackendAuthCommandError = async (output, con
2518
1892
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2519
1893
  default:
2520
1894
  const parsedBody = parsedOutput.body;
2521
- const $metadata = deserializeMetadata(output);
2522
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2523
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2524
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2525
- $fault: "client",
2526
- $metadata,
1895
+ (0, smithy_client_1.throwDefaultError)({
1896
+ output,
1897
+ parsedBody,
1898
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1899
+ errorCode,
2527
1900
  });
2528
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2529
1901
  }
2530
1902
  };
2531
1903
  const deserializeAws_restJson1ImportBackendStorageCommand = async (output, context) => {
2532
1904
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2533
1905
  return deserializeAws_restJson1ImportBackendStorageCommandError(output, context);
2534
1906
  }
2535
- const contents = {
1907
+ const contents = map({
2536
1908
  $metadata: deserializeMetadata(output),
2537
- AppId: undefined,
2538
- BackendEnvironmentName: undefined,
2539
- JobId: undefined,
2540
- Status: undefined,
2541
- };
1909
+ });
2542
1910
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2543
- if (data.appId !== undefined && data.appId !== null) {
1911
+ if (data.appId != null) {
2544
1912
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2545
1913
  }
2546
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
1914
+ if (data.backendEnvironmentName != null) {
2547
1915
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2548
1916
  }
2549
- if (data.jobId !== undefined && data.jobId !== null) {
1917
+ if (data.jobId != null) {
2550
1918
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
2551
1919
  }
2552
- if (data.status !== undefined && data.status !== null) {
1920
+ if (data.status != null) {
2553
1921
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2554
1922
  }
2555
- return Promise.resolve(contents);
1923
+ return contents;
2556
1924
  };
2557
1925
  exports.deserializeAws_restJson1ImportBackendStorageCommand = deserializeAws_restJson1ImportBackendStorageCommand;
2558
1926
  const deserializeAws_restJson1ImportBackendStorageCommandError = async (output, context) => {
@@ -2560,7 +1928,6 @@ const deserializeAws_restJson1ImportBackendStorageCommandError = async (output,
2560
1928
  ...output,
2561
1929
  body: await parseBody(output.body, context),
2562
1930
  };
2563
- let response;
2564
1931
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2565
1932
  switch (errorCode) {
2566
1933
  case "BadRequestException":
@@ -2577,33 +1944,29 @@ const deserializeAws_restJson1ImportBackendStorageCommandError = async (output,
2577
1944
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2578
1945
  default:
2579
1946
  const parsedBody = parsedOutput.body;
2580
- const $metadata = deserializeMetadata(output);
2581
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2582
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2583
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2584
- $fault: "client",
2585
- $metadata,
1947
+ (0, smithy_client_1.throwDefaultError)({
1948
+ output,
1949
+ parsedBody,
1950
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1951
+ errorCode,
2586
1952
  });
2587
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2588
1953
  }
2589
1954
  };
2590
1955
  const deserializeAws_restJson1ListBackendJobsCommand = async (output, context) => {
2591
1956
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2592
1957
  return deserializeAws_restJson1ListBackendJobsCommandError(output, context);
2593
1958
  }
2594
- const contents = {
1959
+ const contents = map({
2595
1960
  $metadata: deserializeMetadata(output),
2596
- Jobs: undefined,
2597
- NextToken: undefined,
2598
- };
1961
+ });
2599
1962
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2600
- if (data.jobs !== undefined && data.jobs !== null) {
1963
+ if (data.jobs != null) {
2601
1964
  contents.Jobs = deserializeAws_restJson1ListOfBackendJobRespObj(data.jobs, context);
2602
1965
  }
2603
- if (data.nextToken !== undefined && data.nextToken !== null) {
1966
+ if (data.nextToken != null) {
2604
1967
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2605
1968
  }
2606
- return Promise.resolve(contents);
1969
+ return contents;
2607
1970
  };
2608
1971
  exports.deserializeAws_restJson1ListBackendJobsCommand = deserializeAws_restJson1ListBackendJobsCommand;
2609
1972
  const deserializeAws_restJson1ListBackendJobsCommandError = async (output, context) => {
@@ -2611,7 +1974,6 @@ const deserializeAws_restJson1ListBackendJobsCommandError = async (output, conte
2611
1974
  ...output,
2612
1975
  body: await parseBody(output.body, context),
2613
1976
  };
2614
- let response;
2615
1977
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2616
1978
  switch (errorCode) {
2617
1979
  case "BadRequestException":
@@ -2628,33 +1990,29 @@ const deserializeAws_restJson1ListBackendJobsCommandError = async (output, conte
2628
1990
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2629
1991
  default:
2630
1992
  const parsedBody = parsedOutput.body;
2631
- const $metadata = deserializeMetadata(output);
2632
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2633
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2634
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2635
- $fault: "client",
2636
- $metadata,
1993
+ (0, smithy_client_1.throwDefaultError)({
1994
+ output,
1995
+ parsedBody,
1996
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
1997
+ errorCode,
2637
1998
  });
2638
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2639
1999
  }
2640
2000
  };
2641
2001
  const deserializeAws_restJson1ListS3BucketsCommand = async (output, context) => {
2642
2002
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2643
2003
  return deserializeAws_restJson1ListS3BucketsCommandError(output, context);
2644
2004
  }
2645
- const contents = {
2005
+ const contents = map({
2646
2006
  $metadata: deserializeMetadata(output),
2647
- Buckets: undefined,
2648
- NextToken: undefined,
2649
- };
2007
+ });
2650
2008
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2651
- if (data.buckets !== undefined && data.buckets !== null) {
2009
+ if (data.buckets != null) {
2652
2010
  contents.Buckets = deserializeAws_restJson1ListOfS3BucketInfo(data.buckets, context);
2653
2011
  }
2654
- if (data.nextToken !== undefined && data.nextToken !== null) {
2012
+ if (data.nextToken != null) {
2655
2013
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2656
2014
  }
2657
- return Promise.resolve(contents);
2015
+ return contents;
2658
2016
  };
2659
2017
  exports.deserializeAws_restJson1ListS3BucketsCommand = deserializeAws_restJson1ListS3BucketsCommand;
2660
2018
  const deserializeAws_restJson1ListS3BucketsCommandError = async (output, context) => {
@@ -2662,7 +2020,6 @@ const deserializeAws_restJson1ListS3BucketsCommandError = async (output, context
2662
2020
  ...output,
2663
2021
  body: await parseBody(output.body, context),
2664
2022
  };
2665
- let response;
2666
2023
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2667
2024
  switch (errorCode) {
2668
2025
  case "BadRequestException":
@@ -2679,45 +2036,38 @@ const deserializeAws_restJson1ListS3BucketsCommandError = async (output, context
2679
2036
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2680
2037
  default:
2681
2038
  const parsedBody = parsedOutput.body;
2682
- const $metadata = deserializeMetadata(output);
2683
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2684
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2685
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2686
- $fault: "client",
2687
- $metadata,
2039
+ (0, smithy_client_1.throwDefaultError)({
2040
+ output,
2041
+ parsedBody,
2042
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2043
+ errorCode,
2688
2044
  });
2689
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2690
2045
  }
2691
2046
  };
2692
2047
  const deserializeAws_restJson1RemoveAllBackendsCommand = async (output, context) => {
2693
2048
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2694
2049
  return deserializeAws_restJson1RemoveAllBackendsCommandError(output, context);
2695
2050
  }
2696
- const contents = {
2051
+ const contents = map({
2697
2052
  $metadata: deserializeMetadata(output),
2698
- AppId: undefined,
2699
- Error: undefined,
2700
- JobId: undefined,
2701
- Operation: undefined,
2702
- Status: undefined,
2703
- };
2053
+ });
2704
2054
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2705
- if (data.appId !== undefined && data.appId !== null) {
2055
+ if (data.appId != null) {
2706
2056
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2707
2057
  }
2708
- if (data.error !== undefined && data.error !== null) {
2058
+ if (data.error != null) {
2709
2059
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2710
2060
  }
2711
- if (data.jobId !== undefined && data.jobId !== null) {
2061
+ if (data.jobId != null) {
2712
2062
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
2713
2063
  }
2714
- if (data.operation !== undefined && data.operation !== null) {
2064
+ if (data.operation != null) {
2715
2065
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
2716
2066
  }
2717
- if (data.status !== undefined && data.status !== null) {
2067
+ if (data.status != null) {
2718
2068
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2719
2069
  }
2720
- return Promise.resolve(contents);
2070
+ return contents;
2721
2071
  };
2722
2072
  exports.deserializeAws_restJson1RemoveAllBackendsCommand = deserializeAws_restJson1RemoveAllBackendsCommand;
2723
2073
  const deserializeAws_restJson1RemoveAllBackendsCommandError = async (output, context) => {
@@ -2725,7 +2075,6 @@ const deserializeAws_restJson1RemoveAllBackendsCommandError = async (output, con
2725
2075
  ...output,
2726
2076
  body: await parseBody(output.body, context),
2727
2077
  };
2728
- let response;
2729
2078
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2730
2079
  switch (errorCode) {
2731
2080
  case "BadRequestException":
@@ -2742,29 +2091,26 @@ const deserializeAws_restJson1RemoveAllBackendsCommandError = async (output, con
2742
2091
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2743
2092
  default:
2744
2093
  const parsedBody = parsedOutput.body;
2745
- const $metadata = deserializeMetadata(output);
2746
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2747
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2748
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2749
- $fault: "client",
2750
- $metadata,
2094
+ (0, smithy_client_1.throwDefaultError)({
2095
+ output,
2096
+ parsedBody,
2097
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2098
+ errorCode,
2751
2099
  });
2752
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2753
2100
  }
2754
2101
  };
2755
2102
  const deserializeAws_restJson1RemoveBackendConfigCommand = async (output, context) => {
2756
2103
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2757
2104
  return deserializeAws_restJson1RemoveBackendConfigCommandError(output, context);
2758
2105
  }
2759
- const contents = {
2106
+ const contents = map({
2760
2107
  $metadata: deserializeMetadata(output),
2761
- Error: undefined,
2762
- };
2108
+ });
2763
2109
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2764
- if (data.error !== undefined && data.error !== null) {
2110
+ if (data.error != null) {
2765
2111
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2766
2112
  }
2767
- return Promise.resolve(contents);
2113
+ return contents;
2768
2114
  };
2769
2115
  exports.deserializeAws_restJson1RemoveBackendConfigCommand = deserializeAws_restJson1RemoveBackendConfigCommand;
2770
2116
  const deserializeAws_restJson1RemoveBackendConfigCommandError = async (output, context) => {
@@ -2772,7 +2118,6 @@ const deserializeAws_restJson1RemoveBackendConfigCommandError = async (output, c
2772
2118
  ...output,
2773
2119
  body: await parseBody(output.body, context),
2774
2120
  };
2775
- let response;
2776
2121
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2777
2122
  switch (errorCode) {
2778
2123
  case "BadRequestException":
@@ -2789,49 +2134,41 @@ const deserializeAws_restJson1RemoveBackendConfigCommandError = async (output, c
2789
2134
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2790
2135
  default:
2791
2136
  const parsedBody = parsedOutput.body;
2792
- const $metadata = deserializeMetadata(output);
2793
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2794
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2795
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2796
- $fault: "client",
2797
- $metadata,
2137
+ (0, smithy_client_1.throwDefaultError)({
2138
+ output,
2139
+ parsedBody,
2140
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2141
+ errorCode,
2798
2142
  });
2799
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2800
2143
  }
2801
2144
  };
2802
2145
  const deserializeAws_restJson1UpdateBackendAPICommand = async (output, context) => {
2803
2146
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2804
2147
  return deserializeAws_restJson1UpdateBackendAPICommandError(output, context);
2805
2148
  }
2806
- const contents = {
2149
+ const contents = map({
2807
2150
  $metadata: deserializeMetadata(output),
2808
- AppId: undefined,
2809
- BackendEnvironmentName: undefined,
2810
- Error: undefined,
2811
- JobId: undefined,
2812
- Operation: undefined,
2813
- Status: undefined,
2814
- };
2151
+ });
2815
2152
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2816
- if (data.appId !== undefined && data.appId !== null) {
2153
+ if (data.appId != null) {
2817
2154
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2818
2155
  }
2819
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
2156
+ if (data.backendEnvironmentName != null) {
2820
2157
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2821
2158
  }
2822
- if (data.error !== undefined && data.error !== null) {
2159
+ if (data.error != null) {
2823
2160
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2824
2161
  }
2825
- if (data.jobId !== undefined && data.jobId !== null) {
2162
+ if (data.jobId != null) {
2826
2163
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
2827
2164
  }
2828
- if (data.operation !== undefined && data.operation !== null) {
2165
+ if (data.operation != null) {
2829
2166
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
2830
2167
  }
2831
- if (data.status !== undefined && data.status !== null) {
2168
+ if (data.status != null) {
2832
2169
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2833
2170
  }
2834
- return Promise.resolve(contents);
2171
+ return contents;
2835
2172
  };
2836
2173
  exports.deserializeAws_restJson1UpdateBackendAPICommand = deserializeAws_restJson1UpdateBackendAPICommand;
2837
2174
  const deserializeAws_restJson1UpdateBackendAPICommandError = async (output, context) => {
@@ -2839,7 +2176,6 @@ const deserializeAws_restJson1UpdateBackendAPICommandError = async (output, cont
2839
2176
  ...output,
2840
2177
  body: await parseBody(output.body, context),
2841
2178
  };
2842
- let response;
2843
2179
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2844
2180
  switch (errorCode) {
2845
2181
  case "BadRequestException":
@@ -2856,49 +2192,41 @@ const deserializeAws_restJson1UpdateBackendAPICommandError = async (output, cont
2856
2192
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2857
2193
  default:
2858
2194
  const parsedBody = parsedOutput.body;
2859
- const $metadata = deserializeMetadata(output);
2860
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2861
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2862
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2863
- $fault: "client",
2864
- $metadata,
2195
+ (0, smithy_client_1.throwDefaultError)({
2196
+ output,
2197
+ parsedBody,
2198
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2199
+ errorCode,
2865
2200
  });
2866
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2867
2201
  }
2868
2202
  };
2869
2203
  const deserializeAws_restJson1UpdateBackendAuthCommand = async (output, context) => {
2870
2204
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2871
2205
  return deserializeAws_restJson1UpdateBackendAuthCommandError(output, context);
2872
2206
  }
2873
- const contents = {
2207
+ const contents = map({
2874
2208
  $metadata: deserializeMetadata(output),
2875
- AppId: undefined,
2876
- BackendEnvironmentName: undefined,
2877
- Error: undefined,
2878
- JobId: undefined,
2879
- Operation: undefined,
2880
- Status: undefined,
2881
- };
2209
+ });
2882
2210
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2883
- if (data.appId !== undefined && data.appId !== null) {
2211
+ if (data.appId != null) {
2884
2212
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2885
2213
  }
2886
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
2214
+ if (data.backendEnvironmentName != null) {
2887
2215
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
2888
2216
  }
2889
- if (data.error !== undefined && data.error !== null) {
2217
+ if (data.error != null) {
2890
2218
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2891
2219
  }
2892
- if (data.jobId !== undefined && data.jobId !== null) {
2220
+ if (data.jobId != null) {
2893
2221
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
2894
2222
  }
2895
- if (data.operation !== undefined && data.operation !== null) {
2223
+ if (data.operation != null) {
2896
2224
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
2897
2225
  }
2898
- if (data.status !== undefined && data.status !== null) {
2226
+ if (data.status != null) {
2899
2227
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2900
2228
  }
2901
- return Promise.resolve(contents);
2229
+ return contents;
2902
2230
  };
2903
2231
  exports.deserializeAws_restJson1UpdateBackendAuthCommand = deserializeAws_restJson1UpdateBackendAuthCommand;
2904
2232
  const deserializeAws_restJson1UpdateBackendAuthCommandError = async (output, context) => {
@@ -2906,7 +2234,6 @@ const deserializeAws_restJson1UpdateBackendAuthCommandError = async (output, con
2906
2234
  ...output,
2907
2235
  body: await parseBody(output.body, context),
2908
2236
  };
2909
- let response;
2910
2237
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2911
2238
  switch (errorCode) {
2912
2239
  case "BadRequestException":
@@ -2923,41 +2250,35 @@ const deserializeAws_restJson1UpdateBackendAuthCommandError = async (output, con
2923
2250
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2924
2251
  default:
2925
2252
  const parsedBody = parsedOutput.body;
2926
- const $metadata = deserializeMetadata(output);
2927
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2928
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2929
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2930
- $fault: "client",
2931
- $metadata,
2253
+ (0, smithy_client_1.throwDefaultError)({
2254
+ output,
2255
+ parsedBody,
2256
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2257
+ errorCode,
2932
2258
  });
2933
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2934
2259
  }
2935
2260
  };
2936
2261
  const deserializeAws_restJson1UpdateBackendConfigCommand = async (output, context) => {
2937
2262
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2938
2263
  return deserializeAws_restJson1UpdateBackendConfigCommandError(output, context);
2939
2264
  }
2940
- const contents = {
2265
+ const contents = map({
2941
2266
  $metadata: deserializeMetadata(output),
2942
- AppId: undefined,
2943
- BackendManagerAppId: undefined,
2944
- Error: undefined,
2945
- LoginAuthConfig: undefined,
2946
- };
2267
+ });
2947
2268
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2948
- if (data.appId !== undefined && data.appId !== null) {
2269
+ if (data.appId != null) {
2949
2270
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
2950
2271
  }
2951
- if (data.backendManagerAppId !== undefined && data.backendManagerAppId !== null) {
2272
+ if (data.backendManagerAppId != null) {
2952
2273
  contents.BackendManagerAppId = (0, smithy_client_1.expectString)(data.backendManagerAppId);
2953
2274
  }
2954
- if (data.error !== undefined && data.error !== null) {
2275
+ if (data.error != null) {
2955
2276
  contents.Error = (0, smithy_client_1.expectString)(data.error);
2956
2277
  }
2957
- if (data.loginAuthConfig !== undefined && data.loginAuthConfig !== null) {
2278
+ if (data.loginAuthConfig != null) {
2958
2279
  contents.LoginAuthConfig = deserializeAws_restJson1LoginAuthConfigReqObj(data.loginAuthConfig, context);
2959
2280
  }
2960
- return Promise.resolve(contents);
2281
+ return contents;
2961
2282
  };
2962
2283
  exports.deserializeAws_restJson1UpdateBackendConfigCommand = deserializeAws_restJson1UpdateBackendConfigCommand;
2963
2284
  const deserializeAws_restJson1UpdateBackendConfigCommandError = async (output, context) => {
@@ -2965,7 +2286,6 @@ const deserializeAws_restJson1UpdateBackendConfigCommandError = async (output, c
2965
2286
  ...output,
2966
2287
  body: await parseBody(output.body, context),
2967
2288
  };
2968
- let response;
2969
2289
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2970
2290
  switch (errorCode) {
2971
2291
  case "BadRequestException":
@@ -2982,57 +2302,47 @@ const deserializeAws_restJson1UpdateBackendConfigCommandError = async (output, c
2982
2302
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2983
2303
  default:
2984
2304
  const parsedBody = parsedOutput.body;
2985
- const $metadata = deserializeMetadata(output);
2986
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2987
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2988
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2989
- $fault: "client",
2990
- $metadata,
2305
+ (0, smithy_client_1.throwDefaultError)({
2306
+ output,
2307
+ parsedBody,
2308
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2309
+ errorCode,
2991
2310
  });
2992
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2993
2311
  }
2994
2312
  };
2995
2313
  const deserializeAws_restJson1UpdateBackendJobCommand = async (output, context) => {
2996
2314
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2997
2315
  return deserializeAws_restJson1UpdateBackendJobCommandError(output, context);
2998
2316
  }
2999
- const contents = {
2317
+ const contents = map({
3000
2318
  $metadata: deserializeMetadata(output),
3001
- AppId: undefined,
3002
- BackendEnvironmentName: undefined,
3003
- CreateTime: undefined,
3004
- Error: undefined,
3005
- JobId: undefined,
3006
- Operation: undefined,
3007
- Status: undefined,
3008
- UpdateTime: undefined,
3009
- };
2319
+ });
3010
2320
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3011
- if (data.appId !== undefined && data.appId !== null) {
2321
+ if (data.appId != null) {
3012
2322
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
3013
2323
  }
3014
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
2324
+ if (data.backendEnvironmentName != null) {
3015
2325
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
3016
2326
  }
3017
- if (data.createTime !== undefined && data.createTime !== null) {
2327
+ if (data.createTime != null) {
3018
2328
  contents.CreateTime = (0, smithy_client_1.expectString)(data.createTime);
3019
2329
  }
3020
- if (data.error !== undefined && data.error !== null) {
2330
+ if (data.error != null) {
3021
2331
  contents.Error = (0, smithy_client_1.expectString)(data.error);
3022
2332
  }
3023
- if (data.jobId !== undefined && data.jobId !== null) {
2333
+ if (data.jobId != null) {
3024
2334
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
3025
2335
  }
3026
- if (data.operation !== undefined && data.operation !== null) {
2336
+ if (data.operation != null) {
3027
2337
  contents.Operation = (0, smithy_client_1.expectString)(data.operation);
3028
2338
  }
3029
- if (data.status !== undefined && data.status !== null) {
2339
+ if (data.status != null) {
3030
2340
  contents.Status = (0, smithy_client_1.expectString)(data.status);
3031
2341
  }
3032
- if (data.updateTime !== undefined && data.updateTime !== null) {
2342
+ if (data.updateTime != null) {
3033
2343
  contents.UpdateTime = (0, smithy_client_1.expectString)(data.updateTime);
3034
2344
  }
3035
- return Promise.resolve(contents);
2345
+ return contents;
3036
2346
  };
3037
2347
  exports.deserializeAws_restJson1UpdateBackendJobCommand = deserializeAws_restJson1UpdateBackendJobCommand;
3038
2348
  const deserializeAws_restJson1UpdateBackendJobCommandError = async (output, context) => {
@@ -3040,7 +2350,6 @@ const deserializeAws_restJson1UpdateBackendJobCommandError = async (output, cont
3040
2350
  ...output,
3041
2351
  body: await parseBody(output.body, context),
3042
2352
  };
3043
- let response;
3044
2353
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3045
2354
  switch (errorCode) {
3046
2355
  case "BadRequestException":
@@ -3057,41 +2366,35 @@ const deserializeAws_restJson1UpdateBackendJobCommandError = async (output, cont
3057
2366
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3058
2367
  default:
3059
2368
  const parsedBody = parsedOutput.body;
3060
- const $metadata = deserializeMetadata(output);
3061
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3062
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
3063
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3064
- $fault: "client",
3065
- $metadata,
2369
+ (0, smithy_client_1.throwDefaultError)({
2370
+ output,
2371
+ parsedBody,
2372
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2373
+ errorCode,
3066
2374
  });
3067
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3068
2375
  }
3069
2376
  };
3070
2377
  const deserializeAws_restJson1UpdateBackendStorageCommand = async (output, context) => {
3071
2378
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3072
2379
  return deserializeAws_restJson1UpdateBackendStorageCommandError(output, context);
3073
2380
  }
3074
- const contents = {
2381
+ const contents = map({
3075
2382
  $metadata: deserializeMetadata(output),
3076
- AppId: undefined,
3077
- BackendEnvironmentName: undefined,
3078
- JobId: undefined,
3079
- Status: undefined,
3080
- };
2383
+ });
3081
2384
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3082
- if (data.appId !== undefined && data.appId !== null) {
2385
+ if (data.appId != null) {
3083
2386
  contents.AppId = (0, smithy_client_1.expectString)(data.appId);
3084
2387
  }
3085
- if (data.backendEnvironmentName !== undefined && data.backendEnvironmentName !== null) {
2388
+ if (data.backendEnvironmentName != null) {
3086
2389
  contents.BackendEnvironmentName = (0, smithy_client_1.expectString)(data.backendEnvironmentName);
3087
2390
  }
3088
- if (data.jobId !== undefined && data.jobId !== null) {
2391
+ if (data.jobId != null) {
3089
2392
  contents.JobId = (0, smithy_client_1.expectString)(data.jobId);
3090
2393
  }
3091
- if (data.status !== undefined && data.status !== null) {
2394
+ if (data.status != null) {
3092
2395
  contents.Status = (0, smithy_client_1.expectString)(data.status);
3093
2396
  }
3094
- return Promise.resolve(contents);
2397
+ return contents;
3095
2398
  };
3096
2399
  exports.deserializeAws_restJson1UpdateBackendStorageCommand = deserializeAws_restJson1UpdateBackendStorageCommand;
3097
2400
  const deserializeAws_restJson1UpdateBackendStorageCommandError = async (output, context) => {
@@ -3099,7 +2402,6 @@ const deserializeAws_restJson1UpdateBackendStorageCommandError = async (output,
3099
2402
  ...output,
3100
2403
  body: await parseBody(output.body, context),
3101
2404
  };
3102
- let response;
3103
2405
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3104
2406
  switch (errorCode) {
3105
2407
  case "BadRequestException":
@@ -3116,20 +2418,19 @@ const deserializeAws_restJson1UpdateBackendStorageCommandError = async (output,
3116
2418
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3117
2419
  default:
3118
2420
  const parsedBody = parsedOutput.body;
3119
- const $metadata = deserializeMetadata(output);
3120
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3121
- response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
3122
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3123
- $fault: "client",
3124
- $metadata,
2421
+ (0, smithy_client_1.throwDefaultError)({
2422
+ output,
2423
+ parsedBody,
2424
+ exceptionCtor: AmplifyBackendServiceException_1.AmplifyBackendServiceException,
2425
+ errorCode,
3125
2426
  });
3126
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3127
2427
  }
3128
2428
  };
2429
+ const map = smithy_client_1.map;
3129
2430
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
3130
- const contents = {};
2431
+ const contents = map({});
3131
2432
  const data = parsedOutput.body;
3132
- if (data.message !== undefined && data.message !== null) {
2433
+ if (data.message != null) {
3133
2434
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3134
2435
  }
3135
2436
  const exception = new models_0_1.BadRequestException({
@@ -3139,9 +2440,9 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
3139
2440
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3140
2441
  };
3141
2442
  const deserializeAws_restJson1GatewayTimeoutExceptionResponse = async (parsedOutput, context) => {
3142
- const contents = {};
2443
+ const contents = map({});
3143
2444
  const data = parsedOutput.body;
3144
- if (data.message !== undefined && data.message !== null) {
2445
+ if (data.message != null) {
3145
2446
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3146
2447
  }
3147
2448
  const exception = new models_0_1.GatewayTimeoutException({
@@ -3151,12 +2452,12 @@ const deserializeAws_restJson1GatewayTimeoutExceptionResponse = async (parsedOut
3151
2452
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3152
2453
  };
3153
2454
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
3154
- const contents = {};
2455
+ const contents = map({});
3155
2456
  const data = parsedOutput.body;
3156
- if (data.message !== undefined && data.message !== null) {
2457
+ if (data.message != null) {
3157
2458
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3158
2459
  }
3159
- if (data.resourceType !== undefined && data.resourceType !== null) {
2460
+ if (data.resourceType != null) {
3160
2461
  contents.ResourceType = (0, smithy_client_1.expectString)(data.resourceType);
3161
2462
  }
3162
2463
  const exception = new models_0_1.NotFoundException({
@@ -3166,12 +2467,12 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
3166
2467
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3167
2468
  };
3168
2469
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
3169
- const contents = {};
2470
+ const contents = map({});
3170
2471
  const data = parsedOutput.body;
3171
- if (data.limitType !== undefined && data.limitType !== null) {
2472
+ if (data.limitType != null) {
3172
2473
  contents.LimitType = (0, smithy_client_1.expectString)(data.limitType);
3173
2474
  }
3174
- if (data.message !== undefined && data.message !== null) {
2475
+ if (data.message != null) {
3175
2476
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3176
2477
  }
3177
2478
  const exception = new models_0_1.TooManyRequestsException({
@@ -3352,9 +2653,6 @@ const serializeAws_restJson1ListOf__string = (input, context) => {
3352
2653
  return input
3353
2654
  .filter((e) => e != null)
3354
2655
  .map((entry) => {
3355
- if (entry === null) {
3356
- return null;
3357
- }
3358
2656
  return entry;
3359
2657
  });
3360
2658
  };
@@ -3362,9 +2660,6 @@ const serializeAws_restJson1ListOfAdditionalConstraintsElement = (input, context
3362
2660
  return input
3363
2661
  .filter((e) => e != null)
3364
2662
  .map((entry) => {
3365
- if (entry === null) {
3366
- return null;
3367
- }
3368
2663
  return entry;
3369
2664
  });
3370
2665
  };
@@ -3372,9 +2667,6 @@ const serializeAws_restJson1ListOfAuthenticatedElement = (input, context) => {
3372
2667
  return input
3373
2668
  .filter((e) => e != null)
3374
2669
  .map((entry) => {
3375
- if (entry === null) {
3376
- return null;
3377
- }
3378
2670
  return entry;
3379
2671
  });
3380
2672
  };
@@ -3382,9 +2674,6 @@ const serializeAws_restJson1ListOfBackendAPIAuthType = (input, context) => {
3382
2674
  return input
3383
2675
  .filter((e) => e != null)
3384
2676
  .map((entry) => {
3385
- if (entry === null) {
3386
- return null;
3387
- }
3388
2677
  return serializeAws_restJson1BackendAPIAuthType(entry, context);
3389
2678
  });
3390
2679
  };
@@ -3392,9 +2681,6 @@ const serializeAws_restJson1ListOfMfaTypesElement = (input, context) => {
3392
2681
  return input
3393
2682
  .filter((e) => e != null)
3394
2683
  .map((entry) => {
3395
- if (entry === null) {
3396
- return null;
3397
- }
3398
2684
  return entry;
3399
2685
  });
3400
2686
  };
@@ -3402,9 +2688,6 @@ const serializeAws_restJson1ListOfOAuthScopesElement = (input, context) => {
3402
2688
  return input
3403
2689
  .filter((e) => e != null)
3404
2690
  .map((entry) => {
3405
- if (entry === null) {
3406
- return null;
3407
- }
3408
2691
  return entry;
3409
2692
  });
3410
2693
  };
@@ -3412,9 +2695,6 @@ const serializeAws_restJson1ListOfRequiredSignUpAttributesElement = (input, cont
3412
2695
  return input
3413
2696
  .filter((e) => e != null)
3414
2697
  .map((entry) => {
3415
- if (entry === null) {
3416
- return null;
3417
- }
3418
2698
  return entry;
3419
2699
  });
3420
2700
  };
@@ -3422,9 +2702,6 @@ const serializeAws_restJson1ListOfUnAuthenticatedElement = (input, context) => {
3422
2702
  return input
3423
2703
  .filter((e) => e != null)
3424
2704
  .map((entry) => {
3425
- if (entry === null) {
3426
- return null;
3427
- }
3428
2705
  return entry;
3429
2706
  });
3430
2707
  };