@aws-sdk/client-appsync 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,16 +13,7 @@ const serializeAws_restJson1AssociateApiCommand = 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
  "/v1/domainnames/{domainName}/apiassociation";
16
- if (input.domainName !== undefined) {
17
- const labelValue = input.domainName;
18
- if (labelValue.length <= 0) {
19
- throw new Error("Empty value provided for input HTTP label: domainName.");
20
- }
21
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
22
- }
23
- else {
24
- throw new Error("No value provided for input HTTP label: domainName.");
25
- }
16
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
26
17
  let body;
27
18
  body = JSON.stringify({
28
19
  ...(input.apiId != null && { apiId: input.apiId }),
@@ -44,16 +35,7 @@ const serializeAws_restJson1CreateApiCacheCommand = async (input, context) => {
44
35
  "content-type": "application/json",
45
36
  };
46
37
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches";
47
- if (input.apiId !== undefined) {
48
- const labelValue = input.apiId;
49
- if (labelValue.length <= 0) {
50
- throw new Error("Empty value provided for input HTTP label: apiId.");
51
- }
52
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
53
- }
54
- else {
55
- throw new Error("No value provided for input HTTP label: apiId.");
56
- }
38
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
57
39
  let body;
58
40
  body = JSON.stringify({
59
41
  ...(input.apiCachingBehavior != null && { apiCachingBehavior: input.apiCachingBehavior }),
@@ -79,16 +61,7 @@ const serializeAws_restJson1CreateApiKeyCommand = async (input, context) => {
79
61
  "content-type": "application/json",
80
62
  };
81
63
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys";
82
- if (input.apiId !== undefined) {
83
- const labelValue = input.apiId;
84
- if (labelValue.length <= 0) {
85
- throw new Error("Empty value provided for input HTTP label: apiId.");
86
- }
87
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
88
- }
89
- else {
90
- throw new Error("No value provided for input HTTP label: apiId.");
91
- }
64
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
92
65
  let body;
93
66
  body = JSON.stringify({
94
67
  ...(input.description != null && { description: input.description }),
@@ -111,16 +84,7 @@ const serializeAws_restJson1CreateDataSourceCommand = async (input, context) =>
111
84
  "content-type": "application/json",
112
85
  };
113
86
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources";
114
- if (input.apiId !== undefined) {
115
- const labelValue = input.apiId;
116
- if (labelValue.length <= 0) {
117
- throw new Error("Empty value provided for input HTTP label: apiId.");
118
- }
119
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
120
- }
121
- else {
122
- throw new Error("No value provided for input HTTP label: apiId.");
123
- }
87
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
124
88
  let body;
125
89
  body = JSON.stringify({
126
90
  ...(input.description != null && { description: input.description }),
@@ -186,16 +150,7 @@ const serializeAws_restJson1CreateFunctionCommand = async (input, context) => {
186
150
  "content-type": "application/json",
187
151
  };
188
152
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions";
189
- if (input.apiId !== undefined) {
190
- const labelValue = input.apiId;
191
- if (labelValue.length <= 0) {
192
- throw new Error("Empty value provided for input HTTP label: apiId.");
193
- }
194
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
195
- }
196
- else {
197
- throw new Error("No value provided for input HTTP label: apiId.");
198
- }
153
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
199
154
  let body;
200
155
  body = JSON.stringify({
201
156
  ...(input.dataSourceName != null && { dataSourceName: input.dataSourceName }),
@@ -262,26 +217,8 @@ const serializeAws_restJson1CreateResolverCommand = async (input, context) => {
262
217
  };
263
218
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
264
219
  "/v1/apis/{apiId}/types/{typeName}/resolvers";
265
- if (input.apiId !== undefined) {
266
- const labelValue = input.apiId;
267
- if (labelValue.length <= 0) {
268
- throw new Error("Empty value provided for input HTTP label: apiId.");
269
- }
270
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
271
- }
272
- else {
273
- throw new Error("No value provided for input HTTP label: apiId.");
274
- }
275
- if (input.typeName !== undefined) {
276
- const labelValue = input.typeName;
277
- if (labelValue.length <= 0) {
278
- throw new Error("Empty value provided for input HTTP label: typeName.");
279
- }
280
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
281
- }
282
- else {
283
- throw new Error("No value provided for input HTTP label: typeName.");
284
- }
220
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
221
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
285
222
  let body;
286
223
  body = JSON.stringify({
287
224
  ...(input.cachingConfig != null && {
@@ -315,16 +252,7 @@ const serializeAws_restJson1CreateTypeCommand = async (input, context) => {
315
252
  "content-type": "application/json",
316
253
  };
317
254
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types";
318
- if (input.apiId !== undefined) {
319
- const labelValue = input.apiId;
320
- if (labelValue.length <= 0) {
321
- throw new Error("Empty value provided for input HTTP label: apiId.");
322
- }
323
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
324
- }
325
- else {
326
- throw new Error("No value provided for input HTTP label: apiId.");
327
- }
255
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
328
256
  let body;
329
257
  body = JSON.stringify({
330
258
  ...(input.definition != null && { definition: input.definition }),
@@ -345,16 +273,7 @@ const serializeAws_restJson1DeleteApiCacheCommand = async (input, context) => {
345
273
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
346
274
  const headers = {};
347
275
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches";
348
- if (input.apiId !== undefined) {
349
- const labelValue = input.apiId;
350
- if (labelValue.length <= 0) {
351
- throw new Error("Empty value provided for input HTTP label: apiId.");
352
- }
353
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
354
- }
355
- else {
356
- throw new Error("No value provided for input HTTP label: apiId.");
357
- }
276
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
358
277
  let body;
359
278
  return new protocol_http_1.HttpRequest({
360
279
  protocol,
@@ -371,26 +290,8 @@ const serializeAws_restJson1DeleteApiKeyCommand = async (input, context) => {
371
290
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
372
291
  const headers = {};
373
292
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys/{id}";
374
- if (input.apiId !== undefined) {
375
- const labelValue = input.apiId;
376
- if (labelValue.length <= 0) {
377
- throw new Error("Empty value provided for input HTTP label: apiId.");
378
- }
379
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
380
- }
381
- else {
382
- throw new Error("No value provided for input HTTP label: apiId.");
383
- }
384
- if (input.id !== undefined) {
385
- const labelValue = input.id;
386
- if (labelValue.length <= 0) {
387
- throw new Error("Empty value provided for input HTTP label: id.");
388
- }
389
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
390
- }
391
- else {
392
- throw new Error("No value provided for input HTTP label: id.");
393
- }
293
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
294
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
394
295
  let body;
395
296
  return new protocol_http_1.HttpRequest({
396
297
  protocol,
@@ -407,26 +308,8 @@ const serializeAws_restJson1DeleteDataSourceCommand = async (input, context) =>
407
308
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
408
309
  const headers = {};
409
310
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}";
410
- if (input.apiId !== undefined) {
411
- const labelValue = input.apiId;
412
- if (labelValue.length <= 0) {
413
- throw new Error("Empty value provided for input HTTP label: apiId.");
414
- }
415
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
416
- }
417
- else {
418
- throw new Error("No value provided for input HTTP label: apiId.");
419
- }
420
- if (input.name !== undefined) {
421
- const labelValue = input.name;
422
- if (labelValue.length <= 0) {
423
- throw new Error("Empty value provided for input HTTP label: name.");
424
- }
425
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
426
- }
427
- else {
428
- throw new Error("No value provided for input HTTP label: name.");
429
- }
311
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
312
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
430
313
  let body;
431
314
  return new protocol_http_1.HttpRequest({
432
315
  protocol,
@@ -443,16 +326,7 @@ const serializeAws_restJson1DeleteDomainNameCommand = async (input, context) =>
443
326
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
444
327
  const headers = {};
445
328
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames/{domainName}";
446
- if (input.domainName !== undefined) {
447
- const labelValue = input.domainName;
448
- if (labelValue.length <= 0) {
449
- throw new Error("Empty value provided for input HTTP label: domainName.");
450
- }
451
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
452
- }
453
- else {
454
- throw new Error("No value provided for input HTTP label: domainName.");
455
- }
329
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
456
330
  let body;
457
331
  return new protocol_http_1.HttpRequest({
458
332
  protocol,
@@ -469,26 +343,8 @@ const serializeAws_restJson1DeleteFunctionCommand = async (input, context) => {
469
343
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
470
344
  const headers = {};
471
345
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}";
472
- if (input.apiId !== undefined) {
473
- const labelValue = input.apiId;
474
- if (labelValue.length <= 0) {
475
- throw new Error("Empty value provided for input HTTP label: apiId.");
476
- }
477
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
478
- }
479
- else {
480
- throw new Error("No value provided for input HTTP label: apiId.");
481
- }
482
- if (input.functionId !== undefined) {
483
- const labelValue = input.functionId;
484
- if (labelValue.length <= 0) {
485
- throw new Error("Empty value provided for input HTTP label: functionId.");
486
- }
487
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
488
- }
489
- else {
490
- throw new Error("No value provided for input HTTP label: functionId.");
491
- }
346
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
347
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
492
348
  let body;
493
349
  return new protocol_http_1.HttpRequest({
494
350
  protocol,
@@ -505,16 +361,7 @@ const serializeAws_restJson1DeleteGraphqlApiCommand = async (input, context) =>
505
361
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
506
362
  const headers = {};
507
363
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}";
508
- if (input.apiId !== undefined) {
509
- const labelValue = input.apiId;
510
- if (labelValue.length <= 0) {
511
- throw new Error("Empty value provided for input HTTP label: apiId.");
512
- }
513
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
514
- }
515
- else {
516
- throw new Error("No value provided for input HTTP label: apiId.");
517
- }
364
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
518
365
  let body;
519
366
  return new protocol_http_1.HttpRequest({
520
367
  protocol,
@@ -532,36 +379,9 @@ const serializeAws_restJson1DeleteResolverCommand = async (input, context) => {
532
379
  const headers = {};
533
380
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
534
381
  "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}";
535
- if (input.apiId !== undefined) {
536
- const labelValue = input.apiId;
537
- if (labelValue.length <= 0) {
538
- throw new Error("Empty value provided for input HTTP label: apiId.");
539
- }
540
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
541
- }
542
- else {
543
- throw new Error("No value provided for input HTTP label: apiId.");
544
- }
545
- if (input.typeName !== undefined) {
546
- const labelValue = input.typeName;
547
- if (labelValue.length <= 0) {
548
- throw new Error("Empty value provided for input HTTP label: typeName.");
549
- }
550
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
551
- }
552
- else {
553
- throw new Error("No value provided for input HTTP label: typeName.");
554
- }
555
- if (input.fieldName !== undefined) {
556
- const labelValue = input.fieldName;
557
- if (labelValue.length <= 0) {
558
- throw new Error("Empty value provided for input HTTP label: fieldName.");
559
- }
560
- resolvedPath = resolvedPath.replace("{fieldName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
561
- }
562
- else {
563
- throw new Error("No value provided for input HTTP label: fieldName.");
564
- }
382
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
383
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
384
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "fieldName", () => input.fieldName, "{fieldName}", false);
565
385
  let body;
566
386
  return new protocol_http_1.HttpRequest({
567
387
  protocol,
@@ -578,26 +398,8 @@ const serializeAws_restJson1DeleteTypeCommand = async (input, context) => {
578
398
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
579
399
  const headers = {};
580
400
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}";
581
- if (input.apiId !== undefined) {
582
- const labelValue = input.apiId;
583
- if (labelValue.length <= 0) {
584
- throw new Error("Empty value provided for input HTTP label: apiId.");
585
- }
586
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
587
- }
588
- else {
589
- throw new Error("No value provided for input HTTP label: apiId.");
590
- }
591
- if (input.typeName !== undefined) {
592
- const labelValue = input.typeName;
593
- if (labelValue.length <= 0) {
594
- throw new Error("Empty value provided for input HTTP label: typeName.");
595
- }
596
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
597
- }
598
- else {
599
- throw new Error("No value provided for input HTTP label: typeName.");
600
- }
401
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
402
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
601
403
  let body;
602
404
  return new protocol_http_1.HttpRequest({
603
405
  protocol,
@@ -615,16 +417,7 @@ const serializeAws_restJson1DisassociateApiCommand = async (input, context) => {
615
417
  const headers = {};
616
418
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
617
419
  "/v1/domainnames/{domainName}/apiassociation";
618
- if (input.domainName !== undefined) {
619
- const labelValue = input.domainName;
620
- if (labelValue.length <= 0) {
621
- throw new Error("Empty value provided for input HTTP label: domainName.");
622
- }
623
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
624
- }
625
- else {
626
- throw new Error("No value provided for input HTTP label: domainName.");
627
- }
420
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
628
421
  let body;
629
422
  return new protocol_http_1.HttpRequest({
630
423
  protocol,
@@ -663,16 +456,7 @@ const serializeAws_restJson1FlushApiCacheCommand = async (input, context) => {
663
456
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
664
457
  const headers = {};
665
458
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/FlushCache";
666
- if (input.apiId !== undefined) {
667
- const labelValue = input.apiId;
668
- if (labelValue.length <= 0) {
669
- throw new Error("Empty value provided for input HTTP label: apiId.");
670
- }
671
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
672
- }
673
- else {
674
- throw new Error("No value provided for input HTTP label: apiId.");
675
- }
459
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
676
460
  let body;
677
461
  return new protocol_http_1.HttpRequest({
678
462
  protocol,
@@ -690,16 +474,7 @@ const serializeAws_restJson1GetApiAssociationCommand = async (input, context) =>
690
474
  const headers = {};
691
475
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
692
476
  "/v1/domainnames/{domainName}/apiassociation";
693
- if (input.domainName !== undefined) {
694
- const labelValue = input.domainName;
695
- if (labelValue.length <= 0) {
696
- throw new Error("Empty value provided for input HTTP label: domainName.");
697
- }
698
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
699
- }
700
- else {
701
- throw new Error("No value provided for input HTTP label: domainName.");
702
- }
477
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
703
478
  let body;
704
479
  return new protocol_http_1.HttpRequest({
705
480
  protocol,
@@ -716,16 +491,7 @@ const serializeAws_restJson1GetApiCacheCommand = async (input, context) => {
716
491
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
717
492
  const headers = {};
718
493
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches";
719
- if (input.apiId !== undefined) {
720
- const labelValue = input.apiId;
721
- if (labelValue.length <= 0) {
722
- throw new Error("Empty value provided for input HTTP label: apiId.");
723
- }
724
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
725
- }
726
- else {
727
- throw new Error("No value provided for input HTTP label: apiId.");
728
- }
494
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
729
495
  let body;
730
496
  return new protocol_http_1.HttpRequest({
731
497
  protocol,
@@ -742,26 +508,8 @@ const serializeAws_restJson1GetDataSourceCommand = async (input, context) => {
742
508
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
743
509
  const headers = {};
744
510
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}";
745
- if (input.apiId !== undefined) {
746
- const labelValue = input.apiId;
747
- if (labelValue.length <= 0) {
748
- throw new Error("Empty value provided for input HTTP label: apiId.");
749
- }
750
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
751
- }
752
- else {
753
- throw new Error("No value provided for input HTTP label: apiId.");
754
- }
755
- if (input.name !== undefined) {
756
- const labelValue = input.name;
757
- if (labelValue.length <= 0) {
758
- throw new Error("Empty value provided for input HTTP label: name.");
759
- }
760
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
761
- }
762
- else {
763
- throw new Error("No value provided for input HTTP label: name.");
764
- }
511
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
512
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
765
513
  let body;
766
514
  return new protocol_http_1.HttpRequest({
767
515
  protocol,
@@ -778,16 +526,7 @@ const serializeAws_restJson1GetDomainNameCommand = async (input, context) => {
778
526
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
779
527
  const headers = {};
780
528
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames/{domainName}";
781
- if (input.domainName !== undefined) {
782
- const labelValue = input.domainName;
783
- if (labelValue.length <= 0) {
784
- throw new Error("Empty value provided for input HTTP label: domainName.");
785
- }
786
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
787
- }
788
- else {
789
- throw new Error("No value provided for input HTTP label: domainName.");
790
- }
529
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
791
530
  let body;
792
531
  return new protocol_http_1.HttpRequest({
793
532
  protocol,
@@ -804,26 +543,8 @@ const serializeAws_restJson1GetFunctionCommand = async (input, context) => {
804
543
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
805
544
  const headers = {};
806
545
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}";
807
- if (input.apiId !== undefined) {
808
- const labelValue = input.apiId;
809
- if (labelValue.length <= 0) {
810
- throw new Error("Empty value provided for input HTTP label: apiId.");
811
- }
812
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
813
- }
814
- else {
815
- throw new Error("No value provided for input HTTP label: apiId.");
816
- }
817
- if (input.functionId !== undefined) {
818
- const labelValue = input.functionId;
819
- if (labelValue.length <= 0) {
820
- throw new Error("Empty value provided for input HTTP label: functionId.");
821
- }
822
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
823
- }
824
- else {
825
- throw new Error("No value provided for input HTTP label: functionId.");
826
- }
546
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
547
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
827
548
  let body;
828
549
  return new protocol_http_1.HttpRequest({
829
550
  protocol,
@@ -840,16 +561,7 @@ const serializeAws_restJson1GetGraphqlApiCommand = async (input, context) => {
840
561
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
841
562
  const headers = {};
842
563
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}";
843
- if (input.apiId !== undefined) {
844
- const labelValue = input.apiId;
845
- if (labelValue.length <= 0) {
846
- throw new Error("Empty value provided for input HTTP label: apiId.");
847
- }
848
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
849
- }
850
- else {
851
- throw new Error("No value provided for input HTTP label: apiId.");
852
- }
564
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
853
565
  let body;
854
566
  return new protocol_http_1.HttpRequest({
855
567
  protocol,
@@ -866,20 +578,11 @@ const serializeAws_restJson1GetIntrospectionSchemaCommand = async (input, contex
866
578
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
867
579
  const headers = {};
868
580
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schema";
869
- if (input.apiId !== undefined) {
870
- const labelValue = input.apiId;
871
- if (labelValue.length <= 0) {
872
- throw new Error("Empty value provided for input HTTP label: apiId.");
873
- }
874
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
875
- }
876
- else {
877
- throw new Error("No value provided for input HTTP label: apiId.");
878
- }
879
- const query = {
880
- ...(input.format !== undefined && { format: input.format }),
881
- ...(input.includeDirectives !== undefined && { includeDirectives: input.includeDirectives.toString() }),
882
- };
581
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
582
+ const query = map({
583
+ format: [, input.format],
584
+ includeDirectives: [() => input.includeDirectives !== void 0, () => input.includeDirectives.toString()],
585
+ });
883
586
  let body;
884
587
  return new protocol_http_1.HttpRequest({
885
588
  protocol,
@@ -898,36 +601,9 @@ const serializeAws_restJson1GetResolverCommand = async (input, context) => {
898
601
  const headers = {};
899
602
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
900
603
  "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}";
901
- if (input.apiId !== undefined) {
902
- const labelValue = input.apiId;
903
- if (labelValue.length <= 0) {
904
- throw new Error("Empty value provided for input HTTP label: apiId.");
905
- }
906
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
907
- }
908
- else {
909
- throw new Error("No value provided for input HTTP label: apiId.");
910
- }
911
- if (input.typeName !== undefined) {
912
- const labelValue = input.typeName;
913
- if (labelValue.length <= 0) {
914
- throw new Error("Empty value provided for input HTTP label: typeName.");
915
- }
916
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
917
- }
918
- else {
919
- throw new Error("No value provided for input HTTP label: typeName.");
920
- }
921
- if (input.fieldName !== undefined) {
922
- const labelValue = input.fieldName;
923
- if (labelValue.length <= 0) {
924
- throw new Error("Empty value provided for input HTTP label: fieldName.");
925
- }
926
- resolvedPath = resolvedPath.replace("{fieldName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
927
- }
928
- else {
929
- throw new Error("No value provided for input HTTP label: fieldName.");
930
- }
604
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
605
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
606
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "fieldName", () => input.fieldName, "{fieldName}", false);
931
607
  let body;
932
608
  return new protocol_http_1.HttpRequest({
933
609
  protocol,
@@ -944,16 +620,7 @@ const serializeAws_restJson1GetSchemaCreationStatusCommand = async (input, conte
944
620
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
945
621
  const headers = {};
946
622
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schemacreation";
947
- if (input.apiId !== undefined) {
948
- const labelValue = input.apiId;
949
- if (labelValue.length <= 0) {
950
- throw new Error("Empty value provided for input HTTP label: apiId.");
951
- }
952
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
953
- }
954
- else {
955
- throw new Error("No value provided for input HTTP label: apiId.");
956
- }
623
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
957
624
  let body;
958
625
  return new protocol_http_1.HttpRequest({
959
626
  protocol,
@@ -970,29 +637,11 @@ const serializeAws_restJson1GetTypeCommand = async (input, context) => {
970
637
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
971
638
  const headers = {};
972
639
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}";
973
- if (input.apiId !== undefined) {
974
- const labelValue = input.apiId;
975
- if (labelValue.length <= 0) {
976
- throw new Error("Empty value provided for input HTTP label: apiId.");
977
- }
978
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
979
- }
980
- else {
981
- throw new Error("No value provided for input HTTP label: apiId.");
982
- }
983
- if (input.typeName !== undefined) {
984
- const labelValue = input.typeName;
985
- if (labelValue.length <= 0) {
986
- throw new Error("Empty value provided for input HTTP label: typeName.");
987
- }
988
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
989
- }
990
- else {
991
- throw new Error("No value provided for input HTTP label: typeName.");
992
- }
993
- const query = {
994
- ...(input.format !== undefined && { format: input.format }),
995
- };
640
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
641
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
642
+ const query = map({
643
+ format: [, input.format],
644
+ });
996
645
  let body;
997
646
  return new protocol_http_1.HttpRequest({
998
647
  protocol,
@@ -1010,20 +659,11 @@ const serializeAws_restJson1ListApiKeysCommand = async (input, context) => {
1010
659
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1011
660
  const headers = {};
1012
661
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys";
1013
- if (input.apiId !== undefined) {
1014
- const labelValue = input.apiId;
1015
- if (labelValue.length <= 0) {
1016
- throw new Error("Empty value provided for input HTTP label: apiId.");
1017
- }
1018
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1019
- }
1020
- else {
1021
- throw new Error("No value provided for input HTTP label: apiId.");
1022
- }
1023
- const query = {
1024
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1025
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1026
- };
662
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
663
+ const query = map({
664
+ nextToken: [, input.nextToken],
665
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
666
+ });
1027
667
  let body;
1028
668
  return new protocol_http_1.HttpRequest({
1029
669
  protocol,
@@ -1041,20 +681,11 @@ const serializeAws_restJson1ListDataSourcesCommand = async (input, context) => {
1041
681
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1042
682
  const headers = {};
1043
683
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources";
1044
- if (input.apiId !== undefined) {
1045
- const labelValue = input.apiId;
1046
- if (labelValue.length <= 0) {
1047
- throw new Error("Empty value provided for input HTTP label: apiId.");
1048
- }
1049
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1050
- }
1051
- else {
1052
- throw new Error("No value provided for input HTTP label: apiId.");
1053
- }
1054
- const query = {
1055
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1056
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1057
- };
684
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
685
+ const query = map({
686
+ nextToken: [, input.nextToken],
687
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
688
+ });
1058
689
  let body;
1059
690
  return new protocol_http_1.HttpRequest({
1060
691
  protocol,
@@ -1072,10 +703,10 @@ const serializeAws_restJson1ListDomainNamesCommand = async (input, context) => {
1072
703
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1073
704
  const headers = {};
1074
705
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames";
1075
- const query = {
1076
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1077
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1078
- };
706
+ const query = map({
707
+ nextToken: [, input.nextToken],
708
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
709
+ });
1079
710
  let body;
1080
711
  return new protocol_http_1.HttpRequest({
1081
712
  protocol,
@@ -1093,20 +724,11 @@ const serializeAws_restJson1ListFunctionsCommand = async (input, context) => {
1093
724
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1094
725
  const headers = {};
1095
726
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions";
1096
- if (input.apiId !== undefined) {
1097
- const labelValue = input.apiId;
1098
- if (labelValue.length <= 0) {
1099
- throw new Error("Empty value provided for input HTTP label: apiId.");
1100
- }
1101
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1102
- }
1103
- else {
1104
- throw new Error("No value provided for input HTTP label: apiId.");
1105
- }
1106
- const query = {
1107
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1108
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1109
- };
727
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
728
+ const query = map({
729
+ nextToken: [, input.nextToken],
730
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
731
+ });
1110
732
  let body;
1111
733
  return new protocol_http_1.HttpRequest({
1112
734
  protocol,
@@ -1124,10 +746,10 @@ const serializeAws_restJson1ListGraphqlApisCommand = async (input, context) => {
1124
746
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1125
747
  const headers = {};
1126
748
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis";
1127
- const query = {
1128
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1129
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1130
- };
749
+ const query = map({
750
+ nextToken: [, input.nextToken],
751
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
752
+ });
1131
753
  let body;
1132
754
  return new protocol_http_1.HttpRequest({
1133
755
  protocol,
@@ -1146,30 +768,12 @@ const serializeAws_restJson1ListResolversCommand = async (input, context) => {
1146
768
  const headers = {};
1147
769
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1148
770
  "/v1/apis/{apiId}/types/{typeName}/resolvers";
1149
- if (input.apiId !== undefined) {
1150
- const labelValue = input.apiId;
1151
- if (labelValue.length <= 0) {
1152
- throw new Error("Empty value provided for input HTTP label: apiId.");
1153
- }
1154
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1155
- }
1156
- else {
1157
- throw new Error("No value provided for input HTTP label: apiId.");
1158
- }
1159
- if (input.typeName !== undefined) {
1160
- const labelValue = input.typeName;
1161
- if (labelValue.length <= 0) {
1162
- throw new Error("Empty value provided for input HTTP label: typeName.");
1163
- }
1164
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1165
- }
1166
- else {
1167
- throw new Error("No value provided for input HTTP label: typeName.");
1168
- }
1169
- const query = {
1170
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1171
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1172
- };
771
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
772
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
773
+ const query = map({
774
+ nextToken: [, input.nextToken],
775
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
776
+ });
1173
777
  let body;
1174
778
  return new protocol_http_1.HttpRequest({
1175
779
  protocol,
@@ -1188,30 +792,12 @@ const serializeAws_restJson1ListResolversByFunctionCommand = async (input, conte
1188
792
  const headers = {};
1189
793
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1190
794
  "/v1/apis/{apiId}/functions/{functionId}/resolvers";
1191
- if (input.apiId !== undefined) {
1192
- const labelValue = input.apiId;
1193
- if (labelValue.length <= 0) {
1194
- throw new Error("Empty value provided for input HTTP label: apiId.");
1195
- }
1196
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1197
- }
1198
- else {
1199
- throw new Error("No value provided for input HTTP label: apiId.");
1200
- }
1201
- if (input.functionId !== undefined) {
1202
- const labelValue = input.functionId;
1203
- if (labelValue.length <= 0) {
1204
- throw new Error("Empty value provided for input HTTP label: functionId.");
1205
- }
1206
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1207
- }
1208
- else {
1209
- throw new Error("No value provided for input HTTP label: functionId.");
1210
- }
1211
- const query = {
1212
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1213
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1214
- };
795
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
796
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
797
+ const query = map({
798
+ nextToken: [, input.nextToken],
799
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
800
+ });
1215
801
  let body;
1216
802
  return new protocol_http_1.HttpRequest({
1217
803
  protocol,
@@ -1229,16 +815,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
1229
815
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1230
816
  const headers = {};
1231
817
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}";
1232
- if (input.resourceArn !== undefined) {
1233
- const labelValue = input.resourceArn;
1234
- if (labelValue.length <= 0) {
1235
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1236
- }
1237
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1238
- }
1239
- else {
1240
- throw new Error("No value provided for input HTTP label: resourceArn.");
1241
- }
818
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1242
819
  let body;
1243
820
  return new protocol_http_1.HttpRequest({
1244
821
  protocol,
@@ -1255,21 +832,12 @@ const serializeAws_restJson1ListTypesCommand = async (input, context) => {
1255
832
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1256
833
  const headers = {};
1257
834
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types";
1258
- if (input.apiId !== undefined) {
1259
- const labelValue = input.apiId;
1260
- if (labelValue.length <= 0) {
1261
- throw new Error("Empty value provided for input HTTP label: apiId.");
1262
- }
1263
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1264
- }
1265
- else {
1266
- throw new Error("No value provided for input HTTP label: apiId.");
1267
- }
1268
- const query = {
1269
- ...(input.format !== undefined && { format: input.format }),
1270
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1271
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1272
- };
835
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
836
+ const query = map({
837
+ format: [, input.format],
838
+ nextToken: [, input.nextToken],
839
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
840
+ });
1273
841
  let body;
1274
842
  return new protocol_http_1.HttpRequest({
1275
843
  protocol,
@@ -1289,16 +857,7 @@ const serializeAws_restJson1StartSchemaCreationCommand = async (input, context)
1289
857
  "content-type": "application/json",
1290
858
  };
1291
859
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schemacreation";
1292
- if (input.apiId !== undefined) {
1293
- const labelValue = input.apiId;
1294
- if (labelValue.length <= 0) {
1295
- throw new Error("Empty value provided for input HTTP label: apiId.");
1296
- }
1297
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1298
- }
1299
- else {
1300
- throw new Error("No value provided for input HTTP label: apiId.");
1301
- }
860
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1302
861
  let body;
1303
862
  body = JSON.stringify({
1304
863
  ...(input.definition != null && { definition: context.base64Encoder(input.definition) }),
@@ -1320,16 +879,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
1320
879
  "content-type": "application/json",
1321
880
  };
1322
881
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}";
1323
- if (input.resourceArn !== undefined) {
1324
- const labelValue = input.resourceArn;
1325
- if (labelValue.length <= 0) {
1326
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1327
- }
1328
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1329
- }
1330
- else {
1331
- throw new Error("No value provided for input HTTP label: resourceArn.");
1332
- }
882
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1333
883
  let body;
1334
884
  body = JSON.stringify({
1335
885
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -1349,19 +899,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1349
899
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1350
900
  const headers = {};
1351
901
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}";
1352
- if (input.resourceArn !== undefined) {
1353
- const labelValue = input.resourceArn;
1354
- if (labelValue.length <= 0) {
1355
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1356
- }
1357
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1358
- }
1359
- else {
1360
- throw new Error("No value provided for input HTTP label: resourceArn.");
1361
- }
1362
- const query = {
1363
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
1364
- };
902
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
903
+ const query = map({
904
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
905
+ });
1365
906
  let body;
1366
907
  return new protocol_http_1.HttpRequest({
1367
908
  protocol,
@@ -1381,16 +922,7 @@ const serializeAws_restJson1UpdateApiCacheCommand = async (input, context) => {
1381
922
  "content-type": "application/json",
1382
923
  };
1383
924
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches/update";
1384
- if (input.apiId !== undefined) {
1385
- const labelValue = input.apiId;
1386
- if (labelValue.length <= 0) {
1387
- throw new Error("Empty value provided for input HTTP label: apiId.");
1388
- }
1389
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1390
- }
1391
- else {
1392
- throw new Error("No value provided for input HTTP label: apiId.");
1393
- }
925
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1394
926
  let body;
1395
927
  body = JSON.stringify({
1396
928
  ...(input.apiCachingBehavior != null && { apiCachingBehavior: input.apiCachingBehavior }),
@@ -1414,26 +946,8 @@ const serializeAws_restJson1UpdateApiKeyCommand = async (input, context) => {
1414
946
  "content-type": "application/json",
1415
947
  };
1416
948
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys/{id}";
1417
- if (input.apiId !== undefined) {
1418
- const labelValue = input.apiId;
1419
- if (labelValue.length <= 0) {
1420
- throw new Error("Empty value provided for input HTTP label: apiId.");
1421
- }
1422
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1423
- }
1424
- else {
1425
- throw new Error("No value provided for input HTTP label: apiId.");
1426
- }
1427
- if (input.id !== undefined) {
1428
- const labelValue = input.id;
1429
- if (labelValue.length <= 0) {
1430
- throw new Error("Empty value provided for input HTTP label: id.");
1431
- }
1432
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1433
- }
1434
- else {
1435
- throw new Error("No value provided for input HTTP label: id.");
1436
- }
949
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
950
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
1437
951
  let body;
1438
952
  body = JSON.stringify({
1439
953
  ...(input.description != null && { description: input.description }),
@@ -1456,26 +970,8 @@ const serializeAws_restJson1UpdateDataSourceCommand = async (input, context) =>
1456
970
  "content-type": "application/json",
1457
971
  };
1458
972
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}";
1459
- if (input.apiId !== undefined) {
1460
- const labelValue = input.apiId;
1461
- if (labelValue.length <= 0) {
1462
- throw new Error("Empty value provided for input HTTP label: apiId.");
1463
- }
1464
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1465
- }
1466
- else {
1467
- throw new Error("No value provided for input HTTP label: apiId.");
1468
- }
1469
- if (input.name !== undefined) {
1470
- const labelValue = input.name;
1471
- if (labelValue.length <= 0) {
1472
- throw new Error("Empty value provided for input HTTP label: name.");
1473
- }
1474
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1475
- }
1476
- else {
1477
- throw new Error("No value provided for input HTTP label: name.");
1478
- }
973
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
974
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
1479
975
  let body;
1480
976
  body = JSON.stringify({
1481
977
  ...(input.description != null && { description: input.description }),
@@ -1517,16 +1013,7 @@ const serializeAws_restJson1UpdateDomainNameCommand = async (input, context) =>
1517
1013
  "content-type": "application/json",
1518
1014
  };
1519
1015
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames/{domainName}";
1520
- if (input.domainName !== undefined) {
1521
- const labelValue = input.domainName;
1522
- if (labelValue.length <= 0) {
1523
- throw new Error("Empty value provided for input HTTP label: domainName.");
1524
- }
1525
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1526
- }
1527
- else {
1528
- throw new Error("No value provided for input HTTP label: domainName.");
1529
- }
1016
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
1530
1017
  let body;
1531
1018
  body = JSON.stringify({
1532
1019
  ...(input.description != null && { description: input.description }),
@@ -1548,26 +1035,8 @@ const serializeAws_restJson1UpdateFunctionCommand = async (input, context) => {
1548
1035
  "content-type": "application/json",
1549
1036
  };
1550
1037
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}";
1551
- if (input.apiId !== undefined) {
1552
- const labelValue = input.apiId;
1553
- if (labelValue.length <= 0) {
1554
- throw new Error("Empty value provided for input HTTP label: apiId.");
1555
- }
1556
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1557
- }
1558
- else {
1559
- throw new Error("No value provided for input HTTP label: apiId.");
1560
- }
1561
- if (input.functionId !== undefined) {
1562
- const labelValue = input.functionId;
1563
- if (labelValue.length <= 0) {
1564
- throw new Error("Empty value provided for input HTTP label: functionId.");
1565
- }
1566
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1567
- }
1568
- else {
1569
- throw new Error("No value provided for input HTTP label: functionId.");
1570
- }
1038
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1039
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
1571
1040
  let body;
1572
1041
  body = JSON.stringify({
1573
1042
  ...(input.dataSourceName != null && { dataSourceName: input.dataSourceName }),
@@ -1596,16 +1065,7 @@ const serializeAws_restJson1UpdateGraphqlApiCommand = async (input, context) =>
1596
1065
  "content-type": "application/json",
1597
1066
  };
1598
1067
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}";
1599
- if (input.apiId !== undefined) {
1600
- const labelValue = input.apiId;
1601
- if (labelValue.length <= 0) {
1602
- throw new Error("Empty value provided for input HTTP label: apiId.");
1603
- }
1604
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1605
- }
1606
- else {
1607
- throw new Error("No value provided for input HTTP label: apiId.");
1608
- }
1068
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1609
1069
  let body;
1610
1070
  body = JSON.stringify({
1611
1071
  ...(input.additionalAuthenticationProviders != null && {
@@ -1643,36 +1103,9 @@ const serializeAws_restJson1UpdateResolverCommand = async (input, context) => {
1643
1103
  };
1644
1104
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1645
1105
  "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}";
1646
- if (input.apiId !== undefined) {
1647
- const labelValue = input.apiId;
1648
- if (labelValue.length <= 0) {
1649
- throw new Error("Empty value provided for input HTTP label: apiId.");
1650
- }
1651
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1652
- }
1653
- else {
1654
- throw new Error("No value provided for input HTTP label: apiId.");
1655
- }
1656
- if (input.typeName !== undefined) {
1657
- const labelValue = input.typeName;
1658
- if (labelValue.length <= 0) {
1659
- throw new Error("Empty value provided for input HTTP label: typeName.");
1660
- }
1661
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1662
- }
1663
- else {
1664
- throw new Error("No value provided for input HTTP label: typeName.");
1665
- }
1666
- if (input.fieldName !== undefined) {
1667
- const labelValue = input.fieldName;
1668
- if (labelValue.length <= 0) {
1669
- throw new Error("Empty value provided for input HTTP label: fieldName.");
1670
- }
1671
- resolvedPath = resolvedPath.replace("{fieldName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1672
- }
1673
- else {
1674
- throw new Error("No value provided for input HTTP label: fieldName.");
1675
- }
1106
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1107
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
1108
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "fieldName", () => input.fieldName, "{fieldName}", false);
1676
1109
  let body;
1677
1110
  body = JSON.stringify({
1678
1111
  ...(input.cachingConfig != null && {
@@ -1705,26 +1138,8 @@ const serializeAws_restJson1UpdateTypeCommand = async (input, context) => {
1705
1138
  "content-type": "application/json",
1706
1139
  };
1707
1140
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}";
1708
- if (input.apiId !== undefined) {
1709
- const labelValue = input.apiId;
1710
- if (labelValue.length <= 0) {
1711
- throw new Error("Empty value provided for input HTTP label: apiId.");
1712
- }
1713
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1714
- }
1715
- else {
1716
- throw new Error("No value provided for input HTTP label: apiId.");
1717
- }
1718
- if (input.typeName !== undefined) {
1719
- const labelValue = input.typeName;
1720
- if (labelValue.length <= 0) {
1721
- throw new Error("Empty value provided for input HTTP label: typeName.");
1722
- }
1723
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1724
- }
1725
- else {
1726
- throw new Error("No value provided for input HTTP label: typeName.");
1727
- }
1141
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1142
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
1728
1143
  let body;
1729
1144
  body = JSON.stringify({
1730
1145
  ...(input.definition != null && { definition: input.definition }),
@@ -1745,15 +1160,14 @@ const deserializeAws_restJson1AssociateApiCommand = async (output, context) => {
1745
1160
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1746
1161
  return deserializeAws_restJson1AssociateApiCommandError(output, context);
1747
1162
  }
1748
- const contents = {
1163
+ const contents = map({
1749
1164
  $metadata: deserializeMetadata(output),
1750
- apiAssociation: undefined,
1751
- };
1165
+ });
1752
1166
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1753
- if (data.apiAssociation !== undefined && data.apiAssociation !== null) {
1167
+ if (data.apiAssociation != null) {
1754
1168
  contents.apiAssociation = deserializeAws_restJson1ApiAssociation(data.apiAssociation, context);
1755
1169
  }
1756
- return Promise.resolve(contents);
1170
+ return contents;
1757
1171
  };
1758
1172
  exports.deserializeAws_restJson1AssociateApiCommand = deserializeAws_restJson1AssociateApiCommand;
1759
1173
  const deserializeAws_restJson1AssociateApiCommandError = async (output, context) => {
@@ -1761,7 +1175,6 @@ const deserializeAws_restJson1AssociateApiCommandError = async (output, context)
1761
1175
  ...output,
1762
1176
  body: await parseBody(output.body, context),
1763
1177
  };
1764
- let response;
1765
1178
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1766
1179
  switch (errorCode) {
1767
1180
  case "AccessDeniedException":
@@ -1778,29 +1191,26 @@ const deserializeAws_restJson1AssociateApiCommandError = async (output, context)
1778
1191
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1779
1192
  default:
1780
1193
  const parsedBody = parsedOutput.body;
1781
- const $metadata = deserializeMetadata(output);
1782
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1783
- response = new AppSyncServiceException_1.AppSyncServiceException({
1784
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1785
- $fault: "client",
1786
- $metadata,
1194
+ (0, smithy_client_1.throwDefaultError)({
1195
+ output,
1196
+ parsedBody,
1197
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1198
+ errorCode,
1787
1199
  });
1788
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1789
1200
  }
1790
1201
  };
1791
1202
  const deserializeAws_restJson1CreateApiCacheCommand = async (output, context) => {
1792
1203
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1793
1204
  return deserializeAws_restJson1CreateApiCacheCommandError(output, context);
1794
1205
  }
1795
- const contents = {
1206
+ const contents = map({
1796
1207
  $metadata: deserializeMetadata(output),
1797
- apiCache: undefined,
1798
- };
1208
+ });
1799
1209
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1800
- if (data.apiCache !== undefined && data.apiCache !== null) {
1210
+ if (data.apiCache != null) {
1801
1211
  contents.apiCache = deserializeAws_restJson1ApiCache(data.apiCache, context);
1802
1212
  }
1803
- return Promise.resolve(contents);
1213
+ return contents;
1804
1214
  };
1805
1215
  exports.deserializeAws_restJson1CreateApiCacheCommand = deserializeAws_restJson1CreateApiCacheCommand;
1806
1216
  const deserializeAws_restJson1CreateApiCacheCommandError = async (output, context) => {
@@ -1808,7 +1218,6 @@ const deserializeAws_restJson1CreateApiCacheCommandError = async (output, contex
1808
1218
  ...output,
1809
1219
  body: await parseBody(output.body, context),
1810
1220
  };
1811
- let response;
1812
1221
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1813
1222
  switch (errorCode) {
1814
1223
  case "BadRequestException":
@@ -1828,29 +1237,26 @@ const deserializeAws_restJson1CreateApiCacheCommandError = async (output, contex
1828
1237
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1829
1238
  default:
1830
1239
  const parsedBody = parsedOutput.body;
1831
- const $metadata = deserializeMetadata(output);
1832
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1833
- response = new AppSyncServiceException_1.AppSyncServiceException({
1834
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1835
- $fault: "client",
1836
- $metadata,
1240
+ (0, smithy_client_1.throwDefaultError)({
1241
+ output,
1242
+ parsedBody,
1243
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1244
+ errorCode,
1837
1245
  });
1838
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1839
1246
  }
1840
1247
  };
1841
1248
  const deserializeAws_restJson1CreateApiKeyCommand = async (output, context) => {
1842
1249
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1843
1250
  return deserializeAws_restJson1CreateApiKeyCommandError(output, context);
1844
1251
  }
1845
- const contents = {
1252
+ const contents = map({
1846
1253
  $metadata: deserializeMetadata(output),
1847
- apiKey: undefined,
1848
- };
1254
+ });
1849
1255
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1850
- if (data.apiKey !== undefined && data.apiKey !== null) {
1256
+ if (data.apiKey != null) {
1851
1257
  contents.apiKey = deserializeAws_restJson1ApiKey(data.apiKey, context);
1852
1258
  }
1853
- return Promise.resolve(contents);
1259
+ return contents;
1854
1260
  };
1855
1261
  exports.deserializeAws_restJson1CreateApiKeyCommand = deserializeAws_restJson1CreateApiKeyCommand;
1856
1262
  const deserializeAws_restJson1CreateApiKeyCommandError = async (output, context) => {
@@ -1858,7 +1264,6 @@ const deserializeAws_restJson1CreateApiKeyCommandError = async (output, context)
1858
1264
  ...output,
1859
1265
  body: await parseBody(output.body, context),
1860
1266
  };
1861
- let response;
1862
1267
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1863
1268
  switch (errorCode) {
1864
1269
  case "ApiKeyLimitExceededException":
@@ -1884,29 +1289,26 @@ const deserializeAws_restJson1CreateApiKeyCommandError = async (output, context)
1884
1289
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1885
1290
  default:
1886
1291
  const parsedBody = parsedOutput.body;
1887
- const $metadata = deserializeMetadata(output);
1888
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1889
- response = new AppSyncServiceException_1.AppSyncServiceException({
1890
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1891
- $fault: "client",
1892
- $metadata,
1292
+ (0, smithy_client_1.throwDefaultError)({
1293
+ output,
1294
+ parsedBody,
1295
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1296
+ errorCode,
1893
1297
  });
1894
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1895
1298
  }
1896
1299
  };
1897
1300
  const deserializeAws_restJson1CreateDataSourceCommand = async (output, context) => {
1898
1301
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1899
1302
  return deserializeAws_restJson1CreateDataSourceCommandError(output, context);
1900
1303
  }
1901
- const contents = {
1304
+ const contents = map({
1902
1305
  $metadata: deserializeMetadata(output),
1903
- dataSource: undefined,
1904
- };
1306
+ });
1905
1307
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1906
- if (data.dataSource !== undefined && data.dataSource !== null) {
1308
+ if (data.dataSource != null) {
1907
1309
  contents.dataSource = deserializeAws_restJson1DataSource(data.dataSource, context);
1908
1310
  }
1909
- return Promise.resolve(contents);
1311
+ return contents;
1910
1312
  };
1911
1313
  exports.deserializeAws_restJson1CreateDataSourceCommand = deserializeAws_restJson1CreateDataSourceCommand;
1912
1314
  const deserializeAws_restJson1CreateDataSourceCommandError = async (output, context) => {
@@ -1914,7 +1316,6 @@ const deserializeAws_restJson1CreateDataSourceCommandError = async (output, cont
1914
1316
  ...output,
1915
1317
  body: await parseBody(output.body, context),
1916
1318
  };
1917
- let response;
1918
1319
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1919
1320
  switch (errorCode) {
1920
1321
  case "BadRequestException":
@@ -1934,29 +1335,26 @@ const deserializeAws_restJson1CreateDataSourceCommandError = async (output, cont
1934
1335
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1935
1336
  default:
1936
1337
  const parsedBody = parsedOutput.body;
1937
- const $metadata = deserializeMetadata(output);
1938
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1939
- response = new AppSyncServiceException_1.AppSyncServiceException({
1940
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1941
- $fault: "client",
1942
- $metadata,
1338
+ (0, smithy_client_1.throwDefaultError)({
1339
+ output,
1340
+ parsedBody,
1341
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1342
+ errorCode,
1943
1343
  });
1944
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1945
1344
  }
1946
1345
  };
1947
1346
  const deserializeAws_restJson1CreateDomainNameCommand = async (output, context) => {
1948
1347
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1949
1348
  return deserializeAws_restJson1CreateDomainNameCommandError(output, context);
1950
1349
  }
1951
- const contents = {
1350
+ const contents = map({
1952
1351
  $metadata: deserializeMetadata(output),
1953
- domainNameConfig: undefined,
1954
- };
1352
+ });
1955
1353
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1956
- if (data.domainNameConfig !== undefined && data.domainNameConfig !== null) {
1354
+ if (data.domainNameConfig != null) {
1957
1355
  contents.domainNameConfig = deserializeAws_restJson1DomainNameConfig(data.domainNameConfig, context);
1958
1356
  }
1959
- return Promise.resolve(contents);
1357
+ return contents;
1960
1358
  };
1961
1359
  exports.deserializeAws_restJson1CreateDomainNameCommand = deserializeAws_restJson1CreateDomainNameCommand;
1962
1360
  const deserializeAws_restJson1CreateDomainNameCommandError = async (output, context) => {
@@ -1964,7 +1362,6 @@ const deserializeAws_restJson1CreateDomainNameCommandError = async (output, cont
1964
1362
  ...output,
1965
1363
  body: await parseBody(output.body, context),
1966
1364
  };
1967
- let response;
1968
1365
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1969
1366
  switch (errorCode) {
1970
1367
  case "AccessDeniedException":
@@ -1978,29 +1375,26 @@ const deserializeAws_restJson1CreateDomainNameCommandError = async (output, cont
1978
1375
  throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1979
1376
  default:
1980
1377
  const parsedBody = parsedOutput.body;
1981
- const $metadata = deserializeMetadata(output);
1982
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1983
- response = new AppSyncServiceException_1.AppSyncServiceException({
1984
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1985
- $fault: "client",
1986
- $metadata,
1378
+ (0, smithy_client_1.throwDefaultError)({
1379
+ output,
1380
+ parsedBody,
1381
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1382
+ errorCode,
1987
1383
  });
1988
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1989
1384
  }
1990
1385
  };
1991
1386
  const deserializeAws_restJson1CreateFunctionCommand = async (output, context) => {
1992
1387
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1993
1388
  return deserializeAws_restJson1CreateFunctionCommandError(output, context);
1994
1389
  }
1995
- const contents = {
1390
+ const contents = map({
1996
1391
  $metadata: deserializeMetadata(output),
1997
- functionConfiguration: undefined,
1998
- };
1392
+ });
1999
1393
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2000
- if (data.functionConfiguration !== undefined && data.functionConfiguration !== null) {
1394
+ if (data.functionConfiguration != null) {
2001
1395
  contents.functionConfiguration = deserializeAws_restJson1FunctionConfiguration(data.functionConfiguration, context);
2002
1396
  }
2003
- return Promise.resolve(contents);
1397
+ return contents;
2004
1398
  };
2005
1399
  exports.deserializeAws_restJson1CreateFunctionCommand = deserializeAws_restJson1CreateFunctionCommand;
2006
1400
  const deserializeAws_restJson1CreateFunctionCommandError = async (output, context) => {
@@ -2008,7 +1402,6 @@ const deserializeAws_restJson1CreateFunctionCommandError = async (output, contex
2008
1402
  ...output,
2009
1403
  body: await parseBody(output.body, context),
2010
1404
  };
2011
- let response;
2012
1405
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2013
1406
  switch (errorCode) {
2014
1407
  case "ConcurrentModificationException":
@@ -2025,29 +1418,26 @@ const deserializeAws_restJson1CreateFunctionCommandError = async (output, contex
2025
1418
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2026
1419
  default:
2027
1420
  const parsedBody = parsedOutput.body;
2028
- const $metadata = deserializeMetadata(output);
2029
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2030
- response = new AppSyncServiceException_1.AppSyncServiceException({
2031
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2032
- $fault: "client",
2033
- $metadata,
1421
+ (0, smithy_client_1.throwDefaultError)({
1422
+ output,
1423
+ parsedBody,
1424
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1425
+ errorCode,
2034
1426
  });
2035
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2036
1427
  }
2037
1428
  };
2038
1429
  const deserializeAws_restJson1CreateGraphqlApiCommand = async (output, context) => {
2039
1430
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2040
1431
  return deserializeAws_restJson1CreateGraphqlApiCommandError(output, context);
2041
1432
  }
2042
- const contents = {
1433
+ const contents = map({
2043
1434
  $metadata: deserializeMetadata(output),
2044
- graphqlApi: undefined,
2045
- };
1435
+ });
2046
1436
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2047
- if (data.graphqlApi !== undefined && data.graphqlApi !== null) {
1437
+ if (data.graphqlApi != null) {
2048
1438
  contents.graphqlApi = deserializeAws_restJson1GraphqlApi(data.graphqlApi, context);
2049
1439
  }
2050
- return Promise.resolve(contents);
1440
+ return contents;
2051
1441
  };
2052
1442
  exports.deserializeAws_restJson1CreateGraphqlApiCommand = deserializeAws_restJson1CreateGraphqlApiCommand;
2053
1443
  const deserializeAws_restJson1CreateGraphqlApiCommandError = async (output, context) => {
@@ -2055,7 +1445,6 @@ const deserializeAws_restJson1CreateGraphqlApiCommandError = async (output, cont
2055
1445
  ...output,
2056
1446
  body: await parseBody(output.body, context),
2057
1447
  };
2058
- let response;
2059
1448
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2060
1449
  switch (errorCode) {
2061
1450
  case "ApiLimitExceededException":
@@ -2078,29 +1467,26 @@ const deserializeAws_restJson1CreateGraphqlApiCommandError = async (output, cont
2078
1467
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2079
1468
  default:
2080
1469
  const parsedBody = parsedOutput.body;
2081
- const $metadata = deserializeMetadata(output);
2082
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2083
- response = new AppSyncServiceException_1.AppSyncServiceException({
2084
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2085
- $fault: "client",
2086
- $metadata,
1470
+ (0, smithy_client_1.throwDefaultError)({
1471
+ output,
1472
+ parsedBody,
1473
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1474
+ errorCode,
2087
1475
  });
2088
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2089
1476
  }
2090
1477
  };
2091
1478
  const deserializeAws_restJson1CreateResolverCommand = async (output, context) => {
2092
1479
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2093
1480
  return deserializeAws_restJson1CreateResolverCommandError(output, context);
2094
1481
  }
2095
- const contents = {
1482
+ const contents = map({
2096
1483
  $metadata: deserializeMetadata(output),
2097
- resolver: undefined,
2098
- };
1484
+ });
2099
1485
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2100
- if (data.resolver !== undefined && data.resolver !== null) {
1486
+ if (data.resolver != null) {
2101
1487
  contents.resolver = deserializeAws_restJson1Resolver(data.resolver, context);
2102
1488
  }
2103
- return Promise.resolve(contents);
1489
+ return contents;
2104
1490
  };
2105
1491
  exports.deserializeAws_restJson1CreateResolverCommand = deserializeAws_restJson1CreateResolverCommand;
2106
1492
  const deserializeAws_restJson1CreateResolverCommandError = async (output, context) => {
@@ -2108,7 +1494,6 @@ const deserializeAws_restJson1CreateResolverCommandError = async (output, contex
2108
1494
  ...output,
2109
1495
  body: await parseBody(output.body, context),
2110
1496
  };
2111
- let response;
2112
1497
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2113
1498
  switch (errorCode) {
2114
1499
  case "ConcurrentModificationException":
@@ -2125,29 +1510,26 @@ const deserializeAws_restJson1CreateResolverCommandError = async (output, contex
2125
1510
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2126
1511
  default:
2127
1512
  const parsedBody = parsedOutput.body;
2128
- const $metadata = deserializeMetadata(output);
2129
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2130
- response = new AppSyncServiceException_1.AppSyncServiceException({
2131
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2132
- $fault: "client",
2133
- $metadata,
1513
+ (0, smithy_client_1.throwDefaultError)({
1514
+ output,
1515
+ parsedBody,
1516
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1517
+ errorCode,
2134
1518
  });
2135
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2136
1519
  }
2137
1520
  };
2138
1521
  const deserializeAws_restJson1CreateTypeCommand = async (output, context) => {
2139
1522
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2140
1523
  return deserializeAws_restJson1CreateTypeCommandError(output, context);
2141
1524
  }
2142
- const contents = {
1525
+ const contents = map({
2143
1526
  $metadata: deserializeMetadata(output),
2144
- type: undefined,
2145
- };
1527
+ });
2146
1528
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2147
- if (data.type !== undefined && data.type !== null) {
1529
+ if (data.type != null) {
2148
1530
  contents.type = deserializeAws_restJson1Type(data.type, context);
2149
1531
  }
2150
- return Promise.resolve(contents);
1532
+ return contents;
2151
1533
  };
2152
1534
  exports.deserializeAws_restJson1CreateTypeCommand = deserializeAws_restJson1CreateTypeCommand;
2153
1535
  const deserializeAws_restJson1CreateTypeCommandError = async (output, context) => {
@@ -2155,7 +1537,6 @@ const deserializeAws_restJson1CreateTypeCommandError = async (output, context) =
2155
1537
  ...output,
2156
1538
  body: await parseBody(output.body, context),
2157
1539
  };
2158
- let response;
2159
1540
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2160
1541
  switch (errorCode) {
2161
1542
  case "BadRequestException":
@@ -2175,25 +1556,23 @@ const deserializeAws_restJson1CreateTypeCommandError = async (output, context) =
2175
1556
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2176
1557
  default:
2177
1558
  const parsedBody = parsedOutput.body;
2178
- const $metadata = deserializeMetadata(output);
2179
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2180
- response = new AppSyncServiceException_1.AppSyncServiceException({
2181
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2182
- $fault: "client",
2183
- $metadata,
1559
+ (0, smithy_client_1.throwDefaultError)({
1560
+ output,
1561
+ parsedBody,
1562
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1563
+ errorCode,
2184
1564
  });
2185
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2186
1565
  }
2187
1566
  };
2188
1567
  const deserializeAws_restJson1DeleteApiCacheCommand = async (output, context) => {
2189
1568
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2190
1569
  return deserializeAws_restJson1DeleteApiCacheCommandError(output, context);
2191
1570
  }
2192
- const contents = {
1571
+ const contents = map({
2193
1572
  $metadata: deserializeMetadata(output),
2194
- };
1573
+ });
2195
1574
  await collectBody(output.body, context);
2196
- return Promise.resolve(contents);
1575
+ return contents;
2197
1576
  };
2198
1577
  exports.deserializeAws_restJson1DeleteApiCacheCommand = deserializeAws_restJson1DeleteApiCacheCommand;
2199
1578
  const deserializeAws_restJson1DeleteApiCacheCommandError = async (output, context) => {
@@ -2201,7 +1580,6 @@ const deserializeAws_restJson1DeleteApiCacheCommandError = async (output, contex
2201
1580
  ...output,
2202
1581
  body: await parseBody(output.body, context),
2203
1582
  };
2204
- let response;
2205
1583
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2206
1584
  switch (errorCode) {
2207
1585
  case "BadRequestException":
@@ -2221,25 +1599,23 @@ const deserializeAws_restJson1DeleteApiCacheCommandError = async (output, contex
2221
1599
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2222
1600
  default:
2223
1601
  const parsedBody = parsedOutput.body;
2224
- const $metadata = deserializeMetadata(output);
2225
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2226
- response = new AppSyncServiceException_1.AppSyncServiceException({
2227
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2228
- $fault: "client",
2229
- $metadata,
1602
+ (0, smithy_client_1.throwDefaultError)({
1603
+ output,
1604
+ parsedBody,
1605
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1606
+ errorCode,
2230
1607
  });
2231
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2232
1608
  }
2233
1609
  };
2234
1610
  const deserializeAws_restJson1DeleteApiKeyCommand = async (output, context) => {
2235
1611
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2236
1612
  return deserializeAws_restJson1DeleteApiKeyCommandError(output, context);
2237
1613
  }
2238
- const contents = {
1614
+ const contents = map({
2239
1615
  $metadata: deserializeMetadata(output),
2240
- };
1616
+ });
2241
1617
  await collectBody(output.body, context);
2242
- return Promise.resolve(contents);
1618
+ return contents;
2243
1619
  };
2244
1620
  exports.deserializeAws_restJson1DeleteApiKeyCommand = deserializeAws_restJson1DeleteApiKeyCommand;
2245
1621
  const deserializeAws_restJson1DeleteApiKeyCommandError = async (output, context) => {
@@ -2247,7 +1623,6 @@ const deserializeAws_restJson1DeleteApiKeyCommandError = async (output, context)
2247
1623
  ...output,
2248
1624
  body: await parseBody(output.body, context),
2249
1625
  };
2250
- let response;
2251
1626
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2252
1627
  switch (errorCode) {
2253
1628
  case "BadRequestException":
@@ -2264,25 +1639,23 @@ const deserializeAws_restJson1DeleteApiKeyCommandError = async (output, context)
2264
1639
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2265
1640
  default:
2266
1641
  const parsedBody = parsedOutput.body;
2267
- const $metadata = deserializeMetadata(output);
2268
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2269
- response = new AppSyncServiceException_1.AppSyncServiceException({
2270
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2271
- $fault: "client",
2272
- $metadata,
1642
+ (0, smithy_client_1.throwDefaultError)({
1643
+ output,
1644
+ parsedBody,
1645
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1646
+ errorCode,
2273
1647
  });
2274
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2275
1648
  }
2276
1649
  };
2277
1650
  const deserializeAws_restJson1DeleteDataSourceCommand = async (output, context) => {
2278
1651
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2279
1652
  return deserializeAws_restJson1DeleteDataSourceCommandError(output, context);
2280
1653
  }
2281
- const contents = {
1654
+ const contents = map({
2282
1655
  $metadata: deserializeMetadata(output),
2283
- };
1656
+ });
2284
1657
  await collectBody(output.body, context);
2285
- return Promise.resolve(contents);
1658
+ return contents;
2286
1659
  };
2287
1660
  exports.deserializeAws_restJson1DeleteDataSourceCommand = deserializeAws_restJson1DeleteDataSourceCommand;
2288
1661
  const deserializeAws_restJson1DeleteDataSourceCommandError = async (output, context) => {
@@ -2290,7 +1663,6 @@ const deserializeAws_restJson1DeleteDataSourceCommandError = async (output, cont
2290
1663
  ...output,
2291
1664
  body: await parseBody(output.body, context),
2292
1665
  };
2293
- let response;
2294
1666
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2295
1667
  switch (errorCode) {
2296
1668
  case "BadRequestException":
@@ -2310,25 +1682,23 @@ const deserializeAws_restJson1DeleteDataSourceCommandError = async (output, cont
2310
1682
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2311
1683
  default:
2312
1684
  const parsedBody = parsedOutput.body;
2313
- const $metadata = deserializeMetadata(output);
2314
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2315
- response = new AppSyncServiceException_1.AppSyncServiceException({
2316
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2317
- $fault: "client",
2318
- $metadata,
1685
+ (0, smithy_client_1.throwDefaultError)({
1686
+ output,
1687
+ parsedBody,
1688
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1689
+ errorCode,
2319
1690
  });
2320
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2321
1691
  }
2322
1692
  };
2323
1693
  const deserializeAws_restJson1DeleteDomainNameCommand = async (output, context) => {
2324
1694
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2325
1695
  return deserializeAws_restJson1DeleteDomainNameCommandError(output, context);
2326
1696
  }
2327
- const contents = {
1697
+ const contents = map({
2328
1698
  $metadata: deserializeMetadata(output),
2329
- };
1699
+ });
2330
1700
  await collectBody(output.body, context);
2331
- return Promise.resolve(contents);
1701
+ return contents;
2332
1702
  };
2333
1703
  exports.deserializeAws_restJson1DeleteDomainNameCommand = deserializeAws_restJson1DeleteDomainNameCommand;
2334
1704
  const deserializeAws_restJson1DeleteDomainNameCommandError = async (output, context) => {
@@ -2336,7 +1706,6 @@ const deserializeAws_restJson1DeleteDomainNameCommandError = async (output, cont
2336
1706
  ...output,
2337
1707
  body: await parseBody(output.body, context),
2338
1708
  };
2339
- let response;
2340
1709
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2341
1710
  switch (errorCode) {
2342
1711
  case "AccessDeniedException":
@@ -2356,25 +1725,23 @@ const deserializeAws_restJson1DeleteDomainNameCommandError = async (output, cont
2356
1725
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2357
1726
  default:
2358
1727
  const parsedBody = parsedOutput.body;
2359
- const $metadata = deserializeMetadata(output);
2360
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2361
- response = new AppSyncServiceException_1.AppSyncServiceException({
2362
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2363
- $fault: "client",
2364
- $metadata,
1728
+ (0, smithy_client_1.throwDefaultError)({
1729
+ output,
1730
+ parsedBody,
1731
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1732
+ errorCode,
2365
1733
  });
2366
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2367
1734
  }
2368
1735
  };
2369
1736
  const deserializeAws_restJson1DeleteFunctionCommand = async (output, context) => {
2370
1737
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2371
1738
  return deserializeAws_restJson1DeleteFunctionCommandError(output, context);
2372
1739
  }
2373
- const contents = {
1740
+ const contents = map({
2374
1741
  $metadata: deserializeMetadata(output),
2375
- };
1742
+ });
2376
1743
  await collectBody(output.body, context);
2377
- return Promise.resolve(contents);
1744
+ return contents;
2378
1745
  };
2379
1746
  exports.deserializeAws_restJson1DeleteFunctionCommand = deserializeAws_restJson1DeleteFunctionCommand;
2380
1747
  const deserializeAws_restJson1DeleteFunctionCommandError = async (output, context) => {
@@ -2382,7 +1749,6 @@ const deserializeAws_restJson1DeleteFunctionCommandError = async (output, contex
2382
1749
  ...output,
2383
1750
  body: await parseBody(output.body, context),
2384
1751
  };
2385
- let response;
2386
1752
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2387
1753
  switch (errorCode) {
2388
1754
  case "ConcurrentModificationException":
@@ -2399,25 +1765,23 @@ const deserializeAws_restJson1DeleteFunctionCommandError = async (output, contex
2399
1765
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2400
1766
  default:
2401
1767
  const parsedBody = parsedOutput.body;
2402
- const $metadata = deserializeMetadata(output);
2403
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2404
- response = new AppSyncServiceException_1.AppSyncServiceException({
2405
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2406
- $fault: "client",
2407
- $metadata,
1768
+ (0, smithy_client_1.throwDefaultError)({
1769
+ output,
1770
+ parsedBody,
1771
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1772
+ errorCode,
2408
1773
  });
2409
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2410
1774
  }
2411
1775
  };
2412
1776
  const deserializeAws_restJson1DeleteGraphqlApiCommand = async (output, context) => {
2413
1777
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2414
1778
  return deserializeAws_restJson1DeleteGraphqlApiCommandError(output, context);
2415
1779
  }
2416
- const contents = {
1780
+ const contents = map({
2417
1781
  $metadata: deserializeMetadata(output),
2418
- };
1782
+ });
2419
1783
  await collectBody(output.body, context);
2420
- return Promise.resolve(contents);
1784
+ return contents;
2421
1785
  };
2422
1786
  exports.deserializeAws_restJson1DeleteGraphqlApiCommand = deserializeAws_restJson1DeleteGraphqlApiCommand;
2423
1787
  const deserializeAws_restJson1DeleteGraphqlApiCommandError = async (output, context) => {
@@ -2425,7 +1789,6 @@ const deserializeAws_restJson1DeleteGraphqlApiCommandError = async (output, cont
2425
1789
  ...output,
2426
1790
  body: await parseBody(output.body, context),
2427
1791
  };
2428
- let response;
2429
1792
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2430
1793
  switch (errorCode) {
2431
1794
  case "AccessDeniedException":
@@ -2448,25 +1811,23 @@ const deserializeAws_restJson1DeleteGraphqlApiCommandError = async (output, cont
2448
1811
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2449
1812
  default:
2450
1813
  const parsedBody = parsedOutput.body;
2451
- const $metadata = deserializeMetadata(output);
2452
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2453
- response = new AppSyncServiceException_1.AppSyncServiceException({
2454
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2455
- $fault: "client",
2456
- $metadata,
1814
+ (0, smithy_client_1.throwDefaultError)({
1815
+ output,
1816
+ parsedBody,
1817
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1818
+ errorCode,
2457
1819
  });
2458
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2459
1820
  }
2460
1821
  };
2461
1822
  const deserializeAws_restJson1DeleteResolverCommand = async (output, context) => {
2462
1823
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2463
1824
  return deserializeAws_restJson1DeleteResolverCommandError(output, context);
2464
1825
  }
2465
- const contents = {
1826
+ const contents = map({
2466
1827
  $metadata: deserializeMetadata(output),
2467
- };
1828
+ });
2468
1829
  await collectBody(output.body, context);
2469
- return Promise.resolve(contents);
1830
+ return contents;
2470
1831
  };
2471
1832
  exports.deserializeAws_restJson1DeleteResolverCommand = deserializeAws_restJson1DeleteResolverCommand;
2472
1833
  const deserializeAws_restJson1DeleteResolverCommandError = async (output, context) => {
@@ -2474,7 +1835,6 @@ const deserializeAws_restJson1DeleteResolverCommandError = async (output, contex
2474
1835
  ...output,
2475
1836
  body: await parseBody(output.body, context),
2476
1837
  };
2477
- let response;
2478
1838
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2479
1839
  switch (errorCode) {
2480
1840
  case "ConcurrentModificationException":
@@ -2491,25 +1851,23 @@ const deserializeAws_restJson1DeleteResolverCommandError = async (output, contex
2491
1851
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2492
1852
  default:
2493
1853
  const parsedBody = parsedOutput.body;
2494
- const $metadata = deserializeMetadata(output);
2495
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2496
- response = new AppSyncServiceException_1.AppSyncServiceException({
2497
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2498
- $fault: "client",
2499
- $metadata,
1854
+ (0, smithy_client_1.throwDefaultError)({
1855
+ output,
1856
+ parsedBody,
1857
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1858
+ errorCode,
2500
1859
  });
2501
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2502
1860
  }
2503
1861
  };
2504
1862
  const deserializeAws_restJson1DeleteTypeCommand = async (output, context) => {
2505
1863
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2506
1864
  return deserializeAws_restJson1DeleteTypeCommandError(output, context);
2507
1865
  }
2508
- const contents = {
1866
+ const contents = map({
2509
1867
  $metadata: deserializeMetadata(output),
2510
- };
1868
+ });
2511
1869
  await collectBody(output.body, context);
2512
- return Promise.resolve(contents);
1870
+ return contents;
2513
1871
  };
2514
1872
  exports.deserializeAws_restJson1DeleteTypeCommand = deserializeAws_restJson1DeleteTypeCommand;
2515
1873
  const deserializeAws_restJson1DeleteTypeCommandError = async (output, context) => {
@@ -2517,7 +1875,6 @@ const deserializeAws_restJson1DeleteTypeCommandError = async (output, context) =
2517
1875
  ...output,
2518
1876
  body: await parseBody(output.body, context),
2519
1877
  };
2520
- let response;
2521
1878
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2522
1879
  switch (errorCode) {
2523
1880
  case "BadRequestException":
@@ -2537,25 +1894,23 @@ const deserializeAws_restJson1DeleteTypeCommandError = async (output, context) =
2537
1894
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2538
1895
  default:
2539
1896
  const parsedBody = parsedOutput.body;
2540
- const $metadata = deserializeMetadata(output);
2541
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2542
- response = new AppSyncServiceException_1.AppSyncServiceException({
2543
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2544
- $fault: "client",
2545
- $metadata,
1897
+ (0, smithy_client_1.throwDefaultError)({
1898
+ output,
1899
+ parsedBody,
1900
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1901
+ errorCode,
2546
1902
  });
2547
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2548
1903
  }
2549
1904
  };
2550
1905
  const deserializeAws_restJson1DisassociateApiCommand = async (output, context) => {
2551
1906
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2552
1907
  return deserializeAws_restJson1DisassociateApiCommandError(output, context);
2553
1908
  }
2554
- const contents = {
1909
+ const contents = map({
2555
1910
  $metadata: deserializeMetadata(output),
2556
- };
1911
+ });
2557
1912
  await collectBody(output.body, context);
2558
- return Promise.resolve(contents);
1913
+ return contents;
2559
1914
  };
2560
1915
  exports.deserializeAws_restJson1DisassociateApiCommand = deserializeAws_restJson1DisassociateApiCommand;
2561
1916
  const deserializeAws_restJson1DisassociateApiCommandError = async (output, context) => {
@@ -2563,7 +1918,6 @@ const deserializeAws_restJson1DisassociateApiCommandError = async (output, conte
2563
1918
  ...output,
2564
1919
  body: await parseBody(output.body, context),
2565
1920
  };
2566
- let response;
2567
1921
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2568
1922
  switch (errorCode) {
2569
1923
  case "AccessDeniedException":
@@ -2583,33 +1937,29 @@ const deserializeAws_restJson1DisassociateApiCommandError = async (output, conte
2583
1937
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2584
1938
  default:
2585
1939
  const parsedBody = parsedOutput.body;
2586
- const $metadata = deserializeMetadata(output);
2587
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2588
- response = new AppSyncServiceException_1.AppSyncServiceException({
2589
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2590
- $fault: "client",
2591
- $metadata,
1940
+ (0, smithy_client_1.throwDefaultError)({
1941
+ output,
1942
+ parsedBody,
1943
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1944
+ errorCode,
2592
1945
  });
2593
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2594
1946
  }
2595
1947
  };
2596
1948
  const deserializeAws_restJson1EvaluateMappingTemplateCommand = async (output, context) => {
2597
1949
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2598
1950
  return deserializeAws_restJson1EvaluateMappingTemplateCommandError(output, context);
2599
1951
  }
2600
- const contents = {
1952
+ const contents = map({
2601
1953
  $metadata: deserializeMetadata(output),
2602
- error: undefined,
2603
- evaluationResult: undefined,
2604
- };
1954
+ });
2605
1955
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2606
- if (data.error !== undefined && data.error !== null) {
1956
+ if (data.error != null) {
2607
1957
  contents.error = deserializeAws_restJson1ErrorDetail(data.error, context);
2608
1958
  }
2609
- if (data.evaluationResult !== undefined && data.evaluationResult !== null) {
1959
+ if (data.evaluationResult != null) {
2610
1960
  contents.evaluationResult = (0, smithy_client_1.expectString)(data.evaluationResult);
2611
1961
  }
2612
- return Promise.resolve(contents);
1962
+ return contents;
2613
1963
  };
2614
1964
  exports.deserializeAws_restJson1EvaluateMappingTemplateCommand = deserializeAws_restJson1EvaluateMappingTemplateCommand;
2615
1965
  const deserializeAws_restJson1EvaluateMappingTemplateCommandError = async (output, context) => {
@@ -2617,7 +1967,6 @@ const deserializeAws_restJson1EvaluateMappingTemplateCommandError = async (outpu
2617
1967
  ...output,
2618
1968
  body: await parseBody(output.body, context),
2619
1969
  };
2620
- let response;
2621
1970
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2622
1971
  switch (errorCode) {
2623
1972
  case "AccessDeniedException":
@@ -2631,25 +1980,23 @@ const deserializeAws_restJson1EvaluateMappingTemplateCommandError = async (outpu
2631
1980
  throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2632
1981
  default:
2633
1982
  const parsedBody = parsedOutput.body;
2634
- const $metadata = deserializeMetadata(output);
2635
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2636
- response = new AppSyncServiceException_1.AppSyncServiceException({
2637
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2638
- $fault: "client",
2639
- $metadata,
1983
+ (0, smithy_client_1.throwDefaultError)({
1984
+ output,
1985
+ parsedBody,
1986
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1987
+ errorCode,
2640
1988
  });
2641
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2642
1989
  }
2643
1990
  };
2644
1991
  const deserializeAws_restJson1FlushApiCacheCommand = async (output, context) => {
2645
1992
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2646
1993
  return deserializeAws_restJson1FlushApiCacheCommandError(output, context);
2647
1994
  }
2648
- const contents = {
1995
+ const contents = map({
2649
1996
  $metadata: deserializeMetadata(output),
2650
- };
1997
+ });
2651
1998
  await collectBody(output.body, context);
2652
- return Promise.resolve(contents);
1999
+ return contents;
2653
2000
  };
2654
2001
  exports.deserializeAws_restJson1FlushApiCacheCommand = deserializeAws_restJson1FlushApiCacheCommand;
2655
2002
  const deserializeAws_restJson1FlushApiCacheCommandError = async (output, context) => {
@@ -2657,7 +2004,6 @@ const deserializeAws_restJson1FlushApiCacheCommandError = async (output, context
2657
2004
  ...output,
2658
2005
  body: await parseBody(output.body, context),
2659
2006
  };
2660
- let response;
2661
2007
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2662
2008
  switch (errorCode) {
2663
2009
  case "BadRequestException":
@@ -2677,29 +2023,26 @@ const deserializeAws_restJson1FlushApiCacheCommandError = async (output, context
2677
2023
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2678
2024
  default:
2679
2025
  const parsedBody = parsedOutput.body;
2680
- const $metadata = deserializeMetadata(output);
2681
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2682
- response = new AppSyncServiceException_1.AppSyncServiceException({
2683
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2684
- $fault: "client",
2685
- $metadata,
2026
+ (0, smithy_client_1.throwDefaultError)({
2027
+ output,
2028
+ parsedBody,
2029
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2030
+ errorCode,
2686
2031
  });
2687
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2688
2032
  }
2689
2033
  };
2690
2034
  const deserializeAws_restJson1GetApiAssociationCommand = async (output, context) => {
2691
2035
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2692
2036
  return deserializeAws_restJson1GetApiAssociationCommandError(output, context);
2693
2037
  }
2694
- const contents = {
2038
+ const contents = map({
2695
2039
  $metadata: deserializeMetadata(output),
2696
- apiAssociation: undefined,
2697
- };
2040
+ });
2698
2041
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2699
- if (data.apiAssociation !== undefined && data.apiAssociation !== null) {
2042
+ if (data.apiAssociation != null) {
2700
2043
  contents.apiAssociation = deserializeAws_restJson1ApiAssociation(data.apiAssociation, context);
2701
2044
  }
2702
- return Promise.resolve(contents);
2045
+ return contents;
2703
2046
  };
2704
2047
  exports.deserializeAws_restJson1GetApiAssociationCommand = deserializeAws_restJson1GetApiAssociationCommand;
2705
2048
  const deserializeAws_restJson1GetApiAssociationCommandError = async (output, context) => {
@@ -2707,7 +2050,6 @@ const deserializeAws_restJson1GetApiAssociationCommandError = async (output, con
2707
2050
  ...output,
2708
2051
  body: await parseBody(output.body, context),
2709
2052
  };
2710
- let response;
2711
2053
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2712
2054
  switch (errorCode) {
2713
2055
  case "AccessDeniedException":
@@ -2724,29 +2066,26 @@ const deserializeAws_restJson1GetApiAssociationCommandError = async (output, con
2724
2066
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2725
2067
  default:
2726
2068
  const parsedBody = parsedOutput.body;
2727
- const $metadata = deserializeMetadata(output);
2728
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2729
- response = new AppSyncServiceException_1.AppSyncServiceException({
2730
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2731
- $fault: "client",
2732
- $metadata,
2069
+ (0, smithy_client_1.throwDefaultError)({
2070
+ output,
2071
+ parsedBody,
2072
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2073
+ errorCode,
2733
2074
  });
2734
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2735
2075
  }
2736
2076
  };
2737
2077
  const deserializeAws_restJson1GetApiCacheCommand = async (output, context) => {
2738
2078
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2739
2079
  return deserializeAws_restJson1GetApiCacheCommandError(output, context);
2740
2080
  }
2741
- const contents = {
2081
+ const contents = map({
2742
2082
  $metadata: deserializeMetadata(output),
2743
- apiCache: undefined,
2744
- };
2083
+ });
2745
2084
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2746
- if (data.apiCache !== undefined && data.apiCache !== null) {
2085
+ if (data.apiCache != null) {
2747
2086
  contents.apiCache = deserializeAws_restJson1ApiCache(data.apiCache, context);
2748
2087
  }
2749
- return Promise.resolve(contents);
2088
+ return contents;
2750
2089
  };
2751
2090
  exports.deserializeAws_restJson1GetApiCacheCommand = deserializeAws_restJson1GetApiCacheCommand;
2752
2091
  const deserializeAws_restJson1GetApiCacheCommandError = async (output, context) => {
@@ -2754,7 +2093,6 @@ const deserializeAws_restJson1GetApiCacheCommandError = async (output, context)
2754
2093
  ...output,
2755
2094
  body: await parseBody(output.body, context),
2756
2095
  };
2757
- let response;
2758
2096
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2759
2097
  switch (errorCode) {
2760
2098
  case "BadRequestException":
@@ -2774,29 +2112,26 @@ const deserializeAws_restJson1GetApiCacheCommandError = async (output, context)
2774
2112
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2775
2113
  default:
2776
2114
  const parsedBody = parsedOutput.body;
2777
- const $metadata = deserializeMetadata(output);
2778
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2779
- response = new AppSyncServiceException_1.AppSyncServiceException({
2780
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2781
- $fault: "client",
2782
- $metadata,
2115
+ (0, smithy_client_1.throwDefaultError)({
2116
+ output,
2117
+ parsedBody,
2118
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2119
+ errorCode,
2783
2120
  });
2784
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2785
2121
  }
2786
2122
  };
2787
2123
  const deserializeAws_restJson1GetDataSourceCommand = async (output, context) => {
2788
2124
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2789
2125
  return deserializeAws_restJson1GetDataSourceCommandError(output, context);
2790
2126
  }
2791
- const contents = {
2127
+ const contents = map({
2792
2128
  $metadata: deserializeMetadata(output),
2793
- dataSource: undefined,
2794
- };
2129
+ });
2795
2130
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2796
- if (data.dataSource !== undefined && data.dataSource !== null) {
2131
+ if (data.dataSource != null) {
2797
2132
  contents.dataSource = deserializeAws_restJson1DataSource(data.dataSource, context);
2798
2133
  }
2799
- return Promise.resolve(contents);
2134
+ return contents;
2800
2135
  };
2801
2136
  exports.deserializeAws_restJson1GetDataSourceCommand = deserializeAws_restJson1GetDataSourceCommand;
2802
2137
  const deserializeAws_restJson1GetDataSourceCommandError = async (output, context) => {
@@ -2804,7 +2139,6 @@ const deserializeAws_restJson1GetDataSourceCommandError = async (output, context
2804
2139
  ...output,
2805
2140
  body: await parseBody(output.body, context),
2806
2141
  };
2807
- let response;
2808
2142
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2809
2143
  switch (errorCode) {
2810
2144
  case "BadRequestException":
@@ -2824,29 +2158,26 @@ const deserializeAws_restJson1GetDataSourceCommandError = async (output, context
2824
2158
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2825
2159
  default:
2826
2160
  const parsedBody = parsedOutput.body;
2827
- const $metadata = deserializeMetadata(output);
2828
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2829
- response = new AppSyncServiceException_1.AppSyncServiceException({
2830
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2831
- $fault: "client",
2832
- $metadata,
2161
+ (0, smithy_client_1.throwDefaultError)({
2162
+ output,
2163
+ parsedBody,
2164
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2165
+ errorCode,
2833
2166
  });
2834
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2835
2167
  }
2836
2168
  };
2837
2169
  const deserializeAws_restJson1GetDomainNameCommand = async (output, context) => {
2838
2170
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2839
2171
  return deserializeAws_restJson1GetDomainNameCommandError(output, context);
2840
2172
  }
2841
- const contents = {
2173
+ const contents = map({
2842
2174
  $metadata: deserializeMetadata(output),
2843
- domainNameConfig: undefined,
2844
- };
2175
+ });
2845
2176
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2846
- if (data.domainNameConfig !== undefined && data.domainNameConfig !== null) {
2177
+ if (data.domainNameConfig != null) {
2847
2178
  contents.domainNameConfig = deserializeAws_restJson1DomainNameConfig(data.domainNameConfig, context);
2848
2179
  }
2849
- return Promise.resolve(contents);
2180
+ return contents;
2850
2181
  };
2851
2182
  exports.deserializeAws_restJson1GetDomainNameCommand = deserializeAws_restJson1GetDomainNameCommand;
2852
2183
  const deserializeAws_restJson1GetDomainNameCommandError = async (output, context) => {
@@ -2854,7 +2185,6 @@ const deserializeAws_restJson1GetDomainNameCommandError = async (output, context
2854
2185
  ...output,
2855
2186
  body: await parseBody(output.body, context),
2856
2187
  };
2857
- let response;
2858
2188
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2859
2189
  switch (errorCode) {
2860
2190
  case "AccessDeniedException":
@@ -2871,29 +2201,26 @@ const deserializeAws_restJson1GetDomainNameCommandError = async (output, context
2871
2201
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2872
2202
  default:
2873
2203
  const parsedBody = parsedOutput.body;
2874
- const $metadata = deserializeMetadata(output);
2875
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2876
- response = new AppSyncServiceException_1.AppSyncServiceException({
2877
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2878
- $fault: "client",
2879
- $metadata,
2204
+ (0, smithy_client_1.throwDefaultError)({
2205
+ output,
2206
+ parsedBody,
2207
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2208
+ errorCode,
2880
2209
  });
2881
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2882
2210
  }
2883
2211
  };
2884
2212
  const deserializeAws_restJson1GetFunctionCommand = async (output, context) => {
2885
2213
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2886
2214
  return deserializeAws_restJson1GetFunctionCommandError(output, context);
2887
2215
  }
2888
- const contents = {
2216
+ const contents = map({
2889
2217
  $metadata: deserializeMetadata(output),
2890
- functionConfiguration: undefined,
2891
- };
2218
+ });
2892
2219
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2893
- if (data.functionConfiguration !== undefined && data.functionConfiguration !== null) {
2220
+ if (data.functionConfiguration != null) {
2894
2221
  contents.functionConfiguration = deserializeAws_restJson1FunctionConfiguration(data.functionConfiguration, context);
2895
2222
  }
2896
- return Promise.resolve(contents);
2223
+ return contents;
2897
2224
  };
2898
2225
  exports.deserializeAws_restJson1GetFunctionCommand = deserializeAws_restJson1GetFunctionCommand;
2899
2226
  const deserializeAws_restJson1GetFunctionCommandError = async (output, context) => {
@@ -2901,7 +2228,6 @@ const deserializeAws_restJson1GetFunctionCommandError = async (output, context)
2901
2228
  ...output,
2902
2229
  body: await parseBody(output.body, context),
2903
2230
  };
2904
- let response;
2905
2231
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2906
2232
  switch (errorCode) {
2907
2233
  case "ConcurrentModificationException":
@@ -2915,29 +2241,26 @@ const deserializeAws_restJson1GetFunctionCommandError = async (output, context)
2915
2241
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2916
2242
  default:
2917
2243
  const parsedBody = parsedOutput.body;
2918
- const $metadata = deserializeMetadata(output);
2919
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2920
- response = new AppSyncServiceException_1.AppSyncServiceException({
2921
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2922
- $fault: "client",
2923
- $metadata,
2244
+ (0, smithy_client_1.throwDefaultError)({
2245
+ output,
2246
+ parsedBody,
2247
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2248
+ errorCode,
2924
2249
  });
2925
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2926
2250
  }
2927
2251
  };
2928
2252
  const deserializeAws_restJson1GetGraphqlApiCommand = async (output, context) => {
2929
2253
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2930
2254
  return deserializeAws_restJson1GetGraphqlApiCommandError(output, context);
2931
2255
  }
2932
- const contents = {
2256
+ const contents = map({
2933
2257
  $metadata: deserializeMetadata(output),
2934
- graphqlApi: undefined,
2935
- };
2258
+ });
2936
2259
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2937
- if (data.graphqlApi !== undefined && data.graphqlApi !== null) {
2260
+ if (data.graphqlApi != null) {
2938
2261
  contents.graphqlApi = deserializeAws_restJson1GraphqlApi(data.graphqlApi, context);
2939
2262
  }
2940
- return Promise.resolve(contents);
2263
+ return contents;
2941
2264
  };
2942
2265
  exports.deserializeAws_restJson1GetGraphqlApiCommand = deserializeAws_restJson1GetGraphqlApiCommand;
2943
2266
  const deserializeAws_restJson1GetGraphqlApiCommandError = async (output, context) => {
@@ -2945,7 +2268,6 @@ const deserializeAws_restJson1GetGraphqlApiCommandError = async (output, context
2945
2268
  ...output,
2946
2269
  body: await parseBody(output.body, context),
2947
2270
  };
2948
- let response;
2949
2271
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2950
2272
  switch (errorCode) {
2951
2273
  case "AccessDeniedException":
@@ -2965,27 +2287,24 @@ const deserializeAws_restJson1GetGraphqlApiCommandError = async (output, context
2965
2287
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2966
2288
  default:
2967
2289
  const parsedBody = parsedOutput.body;
2968
- const $metadata = deserializeMetadata(output);
2969
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2970
- response = new AppSyncServiceException_1.AppSyncServiceException({
2971
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2972
- $fault: "client",
2973
- $metadata,
2290
+ (0, smithy_client_1.throwDefaultError)({
2291
+ output,
2292
+ parsedBody,
2293
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2294
+ errorCode,
2974
2295
  });
2975
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2976
2296
  }
2977
2297
  };
2978
2298
  const deserializeAws_restJson1GetIntrospectionSchemaCommand = async (output, context) => {
2979
2299
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2980
2300
  return deserializeAws_restJson1GetIntrospectionSchemaCommandError(output, context);
2981
2301
  }
2982
- const contents = {
2302
+ const contents = map({
2983
2303
  $metadata: deserializeMetadata(output),
2984
- schema: undefined,
2985
- };
2304
+ });
2986
2305
  const data = await collectBody(output.body, context);
2987
2306
  contents.schema = data;
2988
- return Promise.resolve(contents);
2307
+ return contents;
2989
2308
  };
2990
2309
  exports.deserializeAws_restJson1GetIntrospectionSchemaCommand = deserializeAws_restJson1GetIntrospectionSchemaCommand;
2991
2310
  const deserializeAws_restJson1GetIntrospectionSchemaCommandError = async (output, context) => {
@@ -2993,7 +2312,6 @@ const deserializeAws_restJson1GetIntrospectionSchemaCommandError = async (output
2993
2312
  ...output,
2994
2313
  body: await parseBody(output.body, context),
2995
2314
  };
2996
- let response;
2997
2315
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2998
2316
  switch (errorCode) {
2999
2317
  case "GraphQLSchemaException":
@@ -3010,29 +2328,26 @@ const deserializeAws_restJson1GetIntrospectionSchemaCommandError = async (output
3010
2328
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3011
2329
  default:
3012
2330
  const parsedBody = parsedOutput.body;
3013
- const $metadata = deserializeMetadata(output);
3014
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3015
- response = new AppSyncServiceException_1.AppSyncServiceException({
3016
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3017
- $fault: "client",
3018
- $metadata,
2331
+ (0, smithy_client_1.throwDefaultError)({
2332
+ output,
2333
+ parsedBody,
2334
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2335
+ errorCode,
3019
2336
  });
3020
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3021
2337
  }
3022
2338
  };
3023
2339
  const deserializeAws_restJson1GetResolverCommand = async (output, context) => {
3024
2340
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3025
2341
  return deserializeAws_restJson1GetResolverCommandError(output, context);
3026
2342
  }
3027
- const contents = {
2343
+ const contents = map({
3028
2344
  $metadata: deserializeMetadata(output),
3029
- resolver: undefined,
3030
- };
2345
+ });
3031
2346
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3032
- if (data.resolver !== undefined && data.resolver !== null) {
2347
+ if (data.resolver != null) {
3033
2348
  contents.resolver = deserializeAws_restJson1Resolver(data.resolver, context);
3034
2349
  }
3035
- return Promise.resolve(contents);
2350
+ return contents;
3036
2351
  };
3037
2352
  exports.deserializeAws_restJson1GetResolverCommand = deserializeAws_restJson1GetResolverCommand;
3038
2353
  const deserializeAws_restJson1GetResolverCommandError = async (output, context) => {
@@ -3040,7 +2355,6 @@ const deserializeAws_restJson1GetResolverCommandError = async (output, context)
3040
2355
  ...output,
3041
2356
  body: await parseBody(output.body, context),
3042
2357
  };
3043
- let response;
3044
2358
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3045
2359
  switch (errorCode) {
3046
2360
  case "ConcurrentModificationException":
@@ -3054,33 +2368,29 @@ const deserializeAws_restJson1GetResolverCommandError = async (output, context)
3054
2368
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3055
2369
  default:
3056
2370
  const parsedBody = parsedOutput.body;
3057
- const $metadata = deserializeMetadata(output);
3058
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3059
- response = new AppSyncServiceException_1.AppSyncServiceException({
3060
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3061
- $fault: "client",
3062
- $metadata,
2371
+ (0, smithy_client_1.throwDefaultError)({
2372
+ output,
2373
+ parsedBody,
2374
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2375
+ errorCode,
3063
2376
  });
3064
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3065
2377
  }
3066
2378
  };
3067
2379
  const deserializeAws_restJson1GetSchemaCreationStatusCommand = async (output, context) => {
3068
2380
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3069
2381
  return deserializeAws_restJson1GetSchemaCreationStatusCommandError(output, context);
3070
2382
  }
3071
- const contents = {
2383
+ const contents = map({
3072
2384
  $metadata: deserializeMetadata(output),
3073
- details: undefined,
3074
- status: undefined,
3075
- };
2385
+ });
3076
2386
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3077
- if (data.details !== undefined && data.details !== null) {
2387
+ if (data.details != null) {
3078
2388
  contents.details = (0, smithy_client_1.expectString)(data.details);
3079
2389
  }
3080
- if (data.status !== undefined && data.status !== null) {
2390
+ if (data.status != null) {
3081
2391
  contents.status = (0, smithy_client_1.expectString)(data.status);
3082
2392
  }
3083
- return Promise.resolve(contents);
2393
+ return contents;
3084
2394
  };
3085
2395
  exports.deserializeAws_restJson1GetSchemaCreationStatusCommand = deserializeAws_restJson1GetSchemaCreationStatusCommand;
3086
2396
  const deserializeAws_restJson1GetSchemaCreationStatusCommandError = async (output, context) => {
@@ -3088,7 +2398,6 @@ const deserializeAws_restJson1GetSchemaCreationStatusCommandError = async (outpu
3088
2398
  ...output,
3089
2399
  body: await parseBody(output.body, context),
3090
2400
  };
3091
- let response;
3092
2401
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3093
2402
  switch (errorCode) {
3094
2403
  case "BadRequestException":
@@ -3105,29 +2414,26 @@ const deserializeAws_restJson1GetSchemaCreationStatusCommandError = async (outpu
3105
2414
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3106
2415
  default:
3107
2416
  const parsedBody = parsedOutput.body;
3108
- const $metadata = deserializeMetadata(output);
3109
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3110
- response = new AppSyncServiceException_1.AppSyncServiceException({
3111
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3112
- $fault: "client",
3113
- $metadata,
2417
+ (0, smithy_client_1.throwDefaultError)({
2418
+ output,
2419
+ parsedBody,
2420
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2421
+ errorCode,
3114
2422
  });
3115
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3116
2423
  }
3117
2424
  };
3118
2425
  const deserializeAws_restJson1GetTypeCommand = async (output, context) => {
3119
2426
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3120
2427
  return deserializeAws_restJson1GetTypeCommandError(output, context);
3121
2428
  }
3122
- const contents = {
2429
+ const contents = map({
3123
2430
  $metadata: deserializeMetadata(output),
3124
- type: undefined,
3125
- };
2431
+ });
3126
2432
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3127
- if (data.type !== undefined && data.type !== null) {
2433
+ if (data.type != null) {
3128
2434
  contents.type = deserializeAws_restJson1Type(data.type, context);
3129
2435
  }
3130
- return Promise.resolve(contents);
2436
+ return contents;
3131
2437
  };
3132
2438
  exports.deserializeAws_restJson1GetTypeCommand = deserializeAws_restJson1GetTypeCommand;
3133
2439
  const deserializeAws_restJson1GetTypeCommandError = async (output, context) => {
@@ -3135,7 +2441,6 @@ const deserializeAws_restJson1GetTypeCommandError = async (output, context) => {
3135
2441
  ...output,
3136
2442
  body: await parseBody(output.body, context),
3137
2443
  };
3138
- let response;
3139
2444
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3140
2445
  switch (errorCode) {
3141
2446
  case "BadRequestException":
@@ -3155,33 +2460,29 @@ const deserializeAws_restJson1GetTypeCommandError = async (output, context) => {
3155
2460
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3156
2461
  default:
3157
2462
  const parsedBody = parsedOutput.body;
3158
- const $metadata = deserializeMetadata(output);
3159
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3160
- response = new AppSyncServiceException_1.AppSyncServiceException({
3161
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3162
- $fault: "client",
3163
- $metadata,
2463
+ (0, smithy_client_1.throwDefaultError)({
2464
+ output,
2465
+ parsedBody,
2466
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2467
+ errorCode,
3164
2468
  });
3165
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3166
2469
  }
3167
2470
  };
3168
2471
  const deserializeAws_restJson1ListApiKeysCommand = async (output, context) => {
3169
2472
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3170
2473
  return deserializeAws_restJson1ListApiKeysCommandError(output, context);
3171
2474
  }
3172
- const contents = {
2475
+ const contents = map({
3173
2476
  $metadata: deserializeMetadata(output),
3174
- apiKeys: undefined,
3175
- nextToken: undefined,
3176
- };
2477
+ });
3177
2478
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3178
- if (data.apiKeys !== undefined && data.apiKeys !== null) {
2479
+ if (data.apiKeys != null) {
3179
2480
  contents.apiKeys = deserializeAws_restJson1ApiKeys(data.apiKeys, context);
3180
2481
  }
3181
- if (data.nextToken !== undefined && data.nextToken !== null) {
2482
+ if (data.nextToken != null) {
3182
2483
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3183
2484
  }
3184
- return Promise.resolve(contents);
2485
+ return contents;
3185
2486
  };
3186
2487
  exports.deserializeAws_restJson1ListApiKeysCommand = deserializeAws_restJson1ListApiKeysCommand;
3187
2488
  const deserializeAws_restJson1ListApiKeysCommandError = async (output, context) => {
@@ -3189,7 +2490,6 @@ const deserializeAws_restJson1ListApiKeysCommandError = async (output, context)
3189
2490
  ...output,
3190
2491
  body: await parseBody(output.body, context),
3191
2492
  };
3192
- let response;
3193
2493
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3194
2494
  switch (errorCode) {
3195
2495
  case "BadRequestException":
@@ -3206,33 +2506,29 @@ const deserializeAws_restJson1ListApiKeysCommandError = async (output, context)
3206
2506
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3207
2507
  default:
3208
2508
  const parsedBody = parsedOutput.body;
3209
- const $metadata = deserializeMetadata(output);
3210
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3211
- response = new AppSyncServiceException_1.AppSyncServiceException({
3212
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3213
- $fault: "client",
3214
- $metadata,
2509
+ (0, smithy_client_1.throwDefaultError)({
2510
+ output,
2511
+ parsedBody,
2512
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2513
+ errorCode,
3215
2514
  });
3216
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3217
2515
  }
3218
2516
  };
3219
2517
  const deserializeAws_restJson1ListDataSourcesCommand = async (output, context) => {
3220
2518
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3221
2519
  return deserializeAws_restJson1ListDataSourcesCommandError(output, context);
3222
2520
  }
3223
- const contents = {
2521
+ const contents = map({
3224
2522
  $metadata: deserializeMetadata(output),
3225
- dataSources: undefined,
3226
- nextToken: undefined,
3227
- };
2523
+ });
3228
2524
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3229
- if (data.dataSources !== undefined && data.dataSources !== null) {
2525
+ if (data.dataSources != null) {
3230
2526
  contents.dataSources = deserializeAws_restJson1DataSources(data.dataSources, context);
3231
2527
  }
3232
- if (data.nextToken !== undefined && data.nextToken !== null) {
2528
+ if (data.nextToken != null) {
3233
2529
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3234
2530
  }
3235
- return Promise.resolve(contents);
2531
+ return contents;
3236
2532
  };
3237
2533
  exports.deserializeAws_restJson1ListDataSourcesCommand = deserializeAws_restJson1ListDataSourcesCommand;
3238
2534
  const deserializeAws_restJson1ListDataSourcesCommandError = async (output, context) => {
@@ -3240,7 +2536,6 @@ const deserializeAws_restJson1ListDataSourcesCommandError = async (output, conte
3240
2536
  ...output,
3241
2537
  body: await parseBody(output.body, context),
3242
2538
  };
3243
- let response;
3244
2539
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3245
2540
  switch (errorCode) {
3246
2541
  case "BadRequestException":
@@ -3257,33 +2552,29 @@ const deserializeAws_restJson1ListDataSourcesCommandError = async (output, conte
3257
2552
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3258
2553
  default:
3259
2554
  const parsedBody = parsedOutput.body;
3260
- const $metadata = deserializeMetadata(output);
3261
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3262
- response = new AppSyncServiceException_1.AppSyncServiceException({
3263
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3264
- $fault: "client",
3265
- $metadata,
2555
+ (0, smithy_client_1.throwDefaultError)({
2556
+ output,
2557
+ parsedBody,
2558
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2559
+ errorCode,
3266
2560
  });
3267
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3268
2561
  }
3269
2562
  };
3270
2563
  const deserializeAws_restJson1ListDomainNamesCommand = async (output, context) => {
3271
2564
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3272
2565
  return deserializeAws_restJson1ListDomainNamesCommandError(output, context);
3273
2566
  }
3274
- const contents = {
2567
+ const contents = map({
3275
2568
  $metadata: deserializeMetadata(output),
3276
- domainNameConfigs: undefined,
3277
- nextToken: undefined,
3278
- };
2569
+ });
3279
2570
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3280
- if (data.domainNameConfigs !== undefined && data.domainNameConfigs !== null) {
2571
+ if (data.domainNameConfigs != null) {
3281
2572
  contents.domainNameConfigs = deserializeAws_restJson1DomainNameConfigs(data.domainNameConfigs, context);
3282
2573
  }
3283
- if (data.nextToken !== undefined && data.nextToken !== null) {
2574
+ if (data.nextToken != null) {
3284
2575
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3285
2576
  }
3286
- return Promise.resolve(contents);
2577
+ return contents;
3287
2578
  };
3288
2579
  exports.deserializeAws_restJson1ListDomainNamesCommand = deserializeAws_restJson1ListDomainNamesCommand;
3289
2580
  const deserializeAws_restJson1ListDomainNamesCommandError = async (output, context) => {
@@ -3291,7 +2582,6 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
3291
2582
  ...output,
3292
2583
  body: await parseBody(output.body, context),
3293
2584
  };
3294
- let response;
3295
2585
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3296
2586
  switch (errorCode) {
3297
2587
  case "AccessDeniedException":
@@ -3305,33 +2595,29 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
3305
2595
  throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3306
2596
  default:
3307
2597
  const parsedBody = parsedOutput.body;
3308
- const $metadata = deserializeMetadata(output);
3309
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3310
- response = new AppSyncServiceException_1.AppSyncServiceException({
3311
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3312
- $fault: "client",
3313
- $metadata,
2598
+ (0, smithy_client_1.throwDefaultError)({
2599
+ output,
2600
+ parsedBody,
2601
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2602
+ errorCode,
3314
2603
  });
3315
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3316
2604
  }
3317
2605
  };
3318
2606
  const deserializeAws_restJson1ListFunctionsCommand = async (output, context) => {
3319
2607
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3320
2608
  return deserializeAws_restJson1ListFunctionsCommandError(output, context);
3321
2609
  }
3322
- const contents = {
2610
+ const contents = map({
3323
2611
  $metadata: deserializeMetadata(output),
3324
- functions: undefined,
3325
- nextToken: undefined,
3326
- };
2612
+ });
3327
2613
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3328
- if (data.functions !== undefined && data.functions !== null) {
2614
+ if (data.functions != null) {
3329
2615
  contents.functions = deserializeAws_restJson1Functions(data.functions, context);
3330
2616
  }
3331
- if (data.nextToken !== undefined && data.nextToken !== null) {
2617
+ if (data.nextToken != null) {
3332
2618
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3333
2619
  }
3334
- return Promise.resolve(contents);
2620
+ return contents;
3335
2621
  };
3336
2622
  exports.deserializeAws_restJson1ListFunctionsCommand = deserializeAws_restJson1ListFunctionsCommand;
3337
2623
  const deserializeAws_restJson1ListFunctionsCommandError = async (output, context) => {
@@ -3339,7 +2625,6 @@ const deserializeAws_restJson1ListFunctionsCommandError = async (output, context
3339
2625
  ...output,
3340
2626
  body: await parseBody(output.body, context),
3341
2627
  };
3342
- let response;
3343
2628
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3344
2629
  switch (errorCode) {
3345
2630
  case "BadRequestException":
@@ -3356,33 +2641,29 @@ const deserializeAws_restJson1ListFunctionsCommandError = async (output, context
3356
2641
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3357
2642
  default:
3358
2643
  const parsedBody = parsedOutput.body;
3359
- const $metadata = deserializeMetadata(output);
3360
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3361
- response = new AppSyncServiceException_1.AppSyncServiceException({
3362
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3363
- $fault: "client",
3364
- $metadata,
2644
+ (0, smithy_client_1.throwDefaultError)({
2645
+ output,
2646
+ parsedBody,
2647
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2648
+ errorCode,
3365
2649
  });
3366
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3367
2650
  }
3368
2651
  };
3369
2652
  const deserializeAws_restJson1ListGraphqlApisCommand = async (output, context) => {
3370
2653
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3371
2654
  return deserializeAws_restJson1ListGraphqlApisCommandError(output, context);
3372
2655
  }
3373
- const contents = {
2656
+ const contents = map({
3374
2657
  $metadata: deserializeMetadata(output),
3375
- graphqlApis: undefined,
3376
- nextToken: undefined,
3377
- };
2658
+ });
3378
2659
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3379
- if (data.graphqlApis !== undefined && data.graphqlApis !== null) {
2660
+ if (data.graphqlApis != null) {
3380
2661
  contents.graphqlApis = deserializeAws_restJson1GraphqlApis(data.graphqlApis, context);
3381
2662
  }
3382
- if (data.nextToken !== undefined && data.nextToken !== null) {
2663
+ if (data.nextToken != null) {
3383
2664
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3384
2665
  }
3385
- return Promise.resolve(contents);
2666
+ return contents;
3386
2667
  };
3387
2668
  exports.deserializeAws_restJson1ListGraphqlApisCommand = deserializeAws_restJson1ListGraphqlApisCommand;
3388
2669
  const deserializeAws_restJson1ListGraphqlApisCommandError = async (output, context) => {
@@ -3390,7 +2671,6 @@ const deserializeAws_restJson1ListGraphqlApisCommandError = async (output, conte
3390
2671
  ...output,
3391
2672
  body: await parseBody(output.body, context),
3392
2673
  };
3393
- let response;
3394
2674
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3395
2675
  switch (errorCode) {
3396
2676
  case "BadRequestException":
@@ -3404,33 +2684,29 @@ const deserializeAws_restJson1ListGraphqlApisCommandError = async (output, conte
3404
2684
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3405
2685
  default:
3406
2686
  const parsedBody = parsedOutput.body;
3407
- const $metadata = deserializeMetadata(output);
3408
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3409
- response = new AppSyncServiceException_1.AppSyncServiceException({
3410
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3411
- $fault: "client",
3412
- $metadata,
2687
+ (0, smithy_client_1.throwDefaultError)({
2688
+ output,
2689
+ parsedBody,
2690
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2691
+ errorCode,
3413
2692
  });
3414
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3415
2693
  }
3416
2694
  };
3417
2695
  const deserializeAws_restJson1ListResolversCommand = async (output, context) => {
3418
2696
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3419
2697
  return deserializeAws_restJson1ListResolversCommandError(output, context);
3420
2698
  }
3421
- const contents = {
2699
+ const contents = map({
3422
2700
  $metadata: deserializeMetadata(output),
3423
- nextToken: undefined,
3424
- resolvers: undefined,
3425
- };
2701
+ });
3426
2702
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3427
- if (data.nextToken !== undefined && data.nextToken !== null) {
2703
+ if (data.nextToken != null) {
3428
2704
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3429
2705
  }
3430
- if (data.resolvers !== undefined && data.resolvers !== null) {
2706
+ if (data.resolvers != null) {
3431
2707
  contents.resolvers = deserializeAws_restJson1Resolvers(data.resolvers, context);
3432
2708
  }
3433
- return Promise.resolve(contents);
2709
+ return contents;
3434
2710
  };
3435
2711
  exports.deserializeAws_restJson1ListResolversCommand = deserializeAws_restJson1ListResolversCommand;
3436
2712
  const deserializeAws_restJson1ListResolversCommandError = async (output, context) => {
@@ -3438,7 +2714,6 @@ const deserializeAws_restJson1ListResolversCommandError = async (output, context
3438
2714
  ...output,
3439
2715
  body: await parseBody(output.body, context),
3440
2716
  };
3441
- let response;
3442
2717
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3443
2718
  switch (errorCode) {
3444
2719
  case "BadRequestException":
@@ -3455,33 +2730,29 @@ const deserializeAws_restJson1ListResolversCommandError = async (output, context
3455
2730
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3456
2731
  default:
3457
2732
  const parsedBody = parsedOutput.body;
3458
- const $metadata = deserializeMetadata(output);
3459
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3460
- response = new AppSyncServiceException_1.AppSyncServiceException({
3461
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3462
- $fault: "client",
3463
- $metadata,
2733
+ (0, smithy_client_1.throwDefaultError)({
2734
+ output,
2735
+ parsedBody,
2736
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2737
+ errorCode,
3464
2738
  });
3465
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3466
2739
  }
3467
2740
  };
3468
2741
  const deserializeAws_restJson1ListResolversByFunctionCommand = async (output, context) => {
3469
2742
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3470
2743
  return deserializeAws_restJson1ListResolversByFunctionCommandError(output, context);
3471
2744
  }
3472
- const contents = {
2745
+ const contents = map({
3473
2746
  $metadata: deserializeMetadata(output),
3474
- nextToken: undefined,
3475
- resolvers: undefined,
3476
- };
2747
+ });
3477
2748
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3478
- if (data.nextToken !== undefined && data.nextToken !== null) {
2749
+ if (data.nextToken != null) {
3479
2750
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3480
2751
  }
3481
- if (data.resolvers !== undefined && data.resolvers !== null) {
2752
+ if (data.resolvers != null) {
3482
2753
  contents.resolvers = deserializeAws_restJson1Resolvers(data.resolvers, context);
3483
2754
  }
3484
- return Promise.resolve(contents);
2755
+ return contents;
3485
2756
  };
3486
2757
  exports.deserializeAws_restJson1ListResolversByFunctionCommand = deserializeAws_restJson1ListResolversByFunctionCommand;
3487
2758
  const deserializeAws_restJson1ListResolversByFunctionCommandError = async (output, context) => {
@@ -3489,7 +2760,6 @@ const deserializeAws_restJson1ListResolversByFunctionCommandError = async (outpu
3489
2760
  ...output,
3490
2761
  body: await parseBody(output.body, context),
3491
2762
  };
3492
- let response;
3493
2763
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3494
2764
  switch (errorCode) {
3495
2765
  case "BadRequestException":
@@ -3506,29 +2776,26 @@ const deserializeAws_restJson1ListResolversByFunctionCommandError = async (outpu
3506
2776
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3507
2777
  default:
3508
2778
  const parsedBody = parsedOutput.body;
3509
- const $metadata = deserializeMetadata(output);
3510
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3511
- response = new AppSyncServiceException_1.AppSyncServiceException({
3512
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3513
- $fault: "client",
3514
- $metadata,
2779
+ (0, smithy_client_1.throwDefaultError)({
2780
+ output,
2781
+ parsedBody,
2782
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2783
+ errorCode,
3515
2784
  });
3516
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3517
2785
  }
3518
2786
  };
3519
2787
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
3520
2788
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3521
2789
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
3522
2790
  }
3523
- const contents = {
2791
+ const contents = map({
3524
2792
  $metadata: deserializeMetadata(output),
3525
- tags: undefined,
3526
- };
2793
+ });
3527
2794
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3528
- if (data.tags !== undefined && data.tags !== null) {
2795
+ if (data.tags != null) {
3529
2796
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
3530
2797
  }
3531
- return Promise.resolve(contents);
2798
+ return contents;
3532
2799
  };
3533
2800
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
3534
2801
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -3536,7 +2803,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
3536
2803
  ...output,
3537
2804
  body: await parseBody(output.body, context),
3538
2805
  };
3539
- let response;
3540
2806
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3541
2807
  switch (errorCode) {
3542
2808
  case "AccessDeniedException":
@@ -3559,33 +2825,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
3559
2825
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3560
2826
  default:
3561
2827
  const parsedBody = parsedOutput.body;
3562
- const $metadata = deserializeMetadata(output);
3563
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3564
- response = new AppSyncServiceException_1.AppSyncServiceException({
3565
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3566
- $fault: "client",
3567
- $metadata,
2828
+ (0, smithy_client_1.throwDefaultError)({
2829
+ output,
2830
+ parsedBody,
2831
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2832
+ errorCode,
3568
2833
  });
3569
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3570
2834
  }
3571
2835
  };
3572
2836
  const deserializeAws_restJson1ListTypesCommand = async (output, context) => {
3573
2837
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3574
2838
  return deserializeAws_restJson1ListTypesCommandError(output, context);
3575
2839
  }
3576
- const contents = {
2840
+ const contents = map({
3577
2841
  $metadata: deserializeMetadata(output),
3578
- nextToken: undefined,
3579
- types: undefined,
3580
- };
2842
+ });
3581
2843
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3582
- if (data.nextToken !== undefined && data.nextToken !== null) {
2844
+ if (data.nextToken != null) {
3583
2845
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3584
2846
  }
3585
- if (data.types !== undefined && data.types !== null) {
2847
+ if (data.types != null) {
3586
2848
  contents.types = deserializeAws_restJson1TypeList(data.types, context);
3587
2849
  }
3588
- return Promise.resolve(contents);
2850
+ return contents;
3589
2851
  };
3590
2852
  exports.deserializeAws_restJson1ListTypesCommand = deserializeAws_restJson1ListTypesCommand;
3591
2853
  const deserializeAws_restJson1ListTypesCommandError = async (output, context) => {
@@ -3593,7 +2855,6 @@ const deserializeAws_restJson1ListTypesCommandError = async (output, context) =>
3593
2855
  ...output,
3594
2856
  body: await parseBody(output.body, context),
3595
2857
  };
3596
- let response;
3597
2858
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3598
2859
  switch (errorCode) {
3599
2860
  case "BadRequestException":
@@ -3613,29 +2874,26 @@ const deserializeAws_restJson1ListTypesCommandError = async (output, context) =>
3613
2874
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3614
2875
  default:
3615
2876
  const parsedBody = parsedOutput.body;
3616
- const $metadata = deserializeMetadata(output);
3617
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3618
- response = new AppSyncServiceException_1.AppSyncServiceException({
3619
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3620
- $fault: "client",
3621
- $metadata,
2877
+ (0, smithy_client_1.throwDefaultError)({
2878
+ output,
2879
+ parsedBody,
2880
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2881
+ errorCode,
3622
2882
  });
3623
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3624
2883
  }
3625
2884
  };
3626
2885
  const deserializeAws_restJson1StartSchemaCreationCommand = async (output, context) => {
3627
2886
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3628
2887
  return deserializeAws_restJson1StartSchemaCreationCommandError(output, context);
3629
2888
  }
3630
- const contents = {
2889
+ const contents = map({
3631
2890
  $metadata: deserializeMetadata(output),
3632
- status: undefined,
3633
- };
2891
+ });
3634
2892
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3635
- if (data.status !== undefined && data.status !== null) {
2893
+ if (data.status != null) {
3636
2894
  contents.status = (0, smithy_client_1.expectString)(data.status);
3637
2895
  }
3638
- return Promise.resolve(contents);
2896
+ return contents;
3639
2897
  };
3640
2898
  exports.deserializeAws_restJson1StartSchemaCreationCommand = deserializeAws_restJson1StartSchemaCreationCommand;
3641
2899
  const deserializeAws_restJson1StartSchemaCreationCommandError = async (output, context) => {
@@ -3643,7 +2901,6 @@ const deserializeAws_restJson1StartSchemaCreationCommandError = async (output, c
3643
2901
  ...output,
3644
2902
  body: await parseBody(output.body, context),
3645
2903
  };
3646
- let response;
3647
2904
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3648
2905
  switch (errorCode) {
3649
2906
  case "BadRequestException":
@@ -3663,25 +2920,23 @@ const deserializeAws_restJson1StartSchemaCreationCommandError = async (output, c
3663
2920
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3664
2921
  default:
3665
2922
  const parsedBody = parsedOutput.body;
3666
- const $metadata = deserializeMetadata(output);
3667
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3668
- response = new AppSyncServiceException_1.AppSyncServiceException({
3669
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3670
- $fault: "client",
3671
- $metadata,
2923
+ (0, smithy_client_1.throwDefaultError)({
2924
+ output,
2925
+ parsedBody,
2926
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2927
+ errorCode,
3672
2928
  });
3673
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3674
2929
  }
3675
2930
  };
3676
2931
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
3677
2932
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3678
2933
  return deserializeAws_restJson1TagResourceCommandError(output, context);
3679
2934
  }
3680
- const contents = {
2935
+ const contents = map({
3681
2936
  $metadata: deserializeMetadata(output),
3682
- };
2937
+ });
3683
2938
  await collectBody(output.body, context);
3684
- return Promise.resolve(contents);
2939
+ return contents;
3685
2940
  };
3686
2941
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
3687
2942
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -3689,7 +2944,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3689
2944
  ...output,
3690
2945
  body: await parseBody(output.body, context),
3691
2946
  };
3692
- let response;
3693
2947
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3694
2948
  switch (errorCode) {
3695
2949
  case "AccessDeniedException":
@@ -3712,25 +2966,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3712
2966
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3713
2967
  default:
3714
2968
  const parsedBody = parsedOutput.body;
3715
- const $metadata = deserializeMetadata(output);
3716
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3717
- response = new AppSyncServiceException_1.AppSyncServiceException({
3718
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3719
- $fault: "client",
3720
- $metadata,
2969
+ (0, smithy_client_1.throwDefaultError)({
2970
+ output,
2971
+ parsedBody,
2972
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2973
+ errorCode,
3721
2974
  });
3722
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3723
2975
  }
3724
2976
  };
3725
2977
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
3726
2978
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3727
2979
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
3728
2980
  }
3729
- const contents = {
2981
+ const contents = map({
3730
2982
  $metadata: deserializeMetadata(output),
3731
- };
2983
+ });
3732
2984
  await collectBody(output.body, context);
3733
- return Promise.resolve(contents);
2985
+ return contents;
3734
2986
  };
3735
2987
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
3736
2988
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -3738,7 +2990,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3738
2990
  ...output,
3739
2991
  body: await parseBody(output.body, context),
3740
2992
  };
3741
- let response;
3742
2993
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3743
2994
  switch (errorCode) {
3744
2995
  case "AccessDeniedException":
@@ -3761,29 +3012,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3761
3012
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3762
3013
  default:
3763
3014
  const parsedBody = parsedOutput.body;
3764
- const $metadata = deserializeMetadata(output);
3765
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3766
- response = new AppSyncServiceException_1.AppSyncServiceException({
3767
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3768
- $fault: "client",
3769
- $metadata,
3015
+ (0, smithy_client_1.throwDefaultError)({
3016
+ output,
3017
+ parsedBody,
3018
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3019
+ errorCode,
3770
3020
  });
3771
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3772
3021
  }
3773
3022
  };
3774
3023
  const deserializeAws_restJson1UpdateApiCacheCommand = async (output, context) => {
3775
3024
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3776
3025
  return deserializeAws_restJson1UpdateApiCacheCommandError(output, context);
3777
3026
  }
3778
- const contents = {
3027
+ const contents = map({
3779
3028
  $metadata: deserializeMetadata(output),
3780
- apiCache: undefined,
3781
- };
3029
+ });
3782
3030
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3783
- if (data.apiCache !== undefined && data.apiCache !== null) {
3031
+ if (data.apiCache != null) {
3784
3032
  contents.apiCache = deserializeAws_restJson1ApiCache(data.apiCache, context);
3785
3033
  }
3786
- return Promise.resolve(contents);
3034
+ return contents;
3787
3035
  };
3788
3036
  exports.deserializeAws_restJson1UpdateApiCacheCommand = deserializeAws_restJson1UpdateApiCacheCommand;
3789
3037
  const deserializeAws_restJson1UpdateApiCacheCommandError = async (output, context) => {
@@ -3791,7 +3039,6 @@ const deserializeAws_restJson1UpdateApiCacheCommandError = async (output, contex
3791
3039
  ...output,
3792
3040
  body: await parseBody(output.body, context),
3793
3041
  };
3794
- let response;
3795
3042
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3796
3043
  switch (errorCode) {
3797
3044
  case "BadRequestException":
@@ -3811,29 +3058,26 @@ const deserializeAws_restJson1UpdateApiCacheCommandError = async (output, contex
3811
3058
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3812
3059
  default:
3813
3060
  const parsedBody = parsedOutput.body;
3814
- const $metadata = deserializeMetadata(output);
3815
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3816
- response = new AppSyncServiceException_1.AppSyncServiceException({
3817
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3818
- $fault: "client",
3819
- $metadata,
3061
+ (0, smithy_client_1.throwDefaultError)({
3062
+ output,
3063
+ parsedBody,
3064
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3065
+ errorCode,
3820
3066
  });
3821
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3822
3067
  }
3823
3068
  };
3824
3069
  const deserializeAws_restJson1UpdateApiKeyCommand = async (output, context) => {
3825
3070
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3826
3071
  return deserializeAws_restJson1UpdateApiKeyCommandError(output, context);
3827
3072
  }
3828
- const contents = {
3073
+ const contents = map({
3829
3074
  $metadata: deserializeMetadata(output),
3830
- apiKey: undefined,
3831
- };
3075
+ });
3832
3076
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3833
- if (data.apiKey !== undefined && data.apiKey !== null) {
3077
+ if (data.apiKey != null) {
3834
3078
  contents.apiKey = deserializeAws_restJson1ApiKey(data.apiKey, context);
3835
3079
  }
3836
- return Promise.resolve(contents);
3080
+ return contents;
3837
3081
  };
3838
3082
  exports.deserializeAws_restJson1UpdateApiKeyCommand = deserializeAws_restJson1UpdateApiKeyCommand;
3839
3083
  const deserializeAws_restJson1UpdateApiKeyCommandError = async (output, context) => {
@@ -3841,7 +3085,6 @@ const deserializeAws_restJson1UpdateApiKeyCommandError = async (output, context)
3841
3085
  ...output,
3842
3086
  body: await parseBody(output.body, context),
3843
3087
  };
3844
- let response;
3845
3088
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3846
3089
  switch (errorCode) {
3847
3090
  case "ApiKeyValidityOutOfBoundsException":
@@ -3864,29 +3107,26 @@ const deserializeAws_restJson1UpdateApiKeyCommandError = async (output, context)
3864
3107
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3865
3108
  default:
3866
3109
  const parsedBody = parsedOutput.body;
3867
- const $metadata = deserializeMetadata(output);
3868
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3869
- response = new AppSyncServiceException_1.AppSyncServiceException({
3870
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3871
- $fault: "client",
3872
- $metadata,
3110
+ (0, smithy_client_1.throwDefaultError)({
3111
+ output,
3112
+ parsedBody,
3113
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3114
+ errorCode,
3873
3115
  });
3874
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3875
3116
  }
3876
3117
  };
3877
3118
  const deserializeAws_restJson1UpdateDataSourceCommand = async (output, context) => {
3878
3119
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3879
3120
  return deserializeAws_restJson1UpdateDataSourceCommandError(output, context);
3880
3121
  }
3881
- const contents = {
3122
+ const contents = map({
3882
3123
  $metadata: deserializeMetadata(output),
3883
- dataSource: undefined,
3884
- };
3124
+ });
3885
3125
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3886
- if (data.dataSource !== undefined && data.dataSource !== null) {
3126
+ if (data.dataSource != null) {
3887
3127
  contents.dataSource = deserializeAws_restJson1DataSource(data.dataSource, context);
3888
3128
  }
3889
- return Promise.resolve(contents);
3129
+ return contents;
3890
3130
  };
3891
3131
  exports.deserializeAws_restJson1UpdateDataSourceCommand = deserializeAws_restJson1UpdateDataSourceCommand;
3892
3132
  const deserializeAws_restJson1UpdateDataSourceCommandError = async (output, context) => {
@@ -3894,7 +3134,6 @@ const deserializeAws_restJson1UpdateDataSourceCommandError = async (output, cont
3894
3134
  ...output,
3895
3135
  body: await parseBody(output.body, context),
3896
3136
  };
3897
- let response;
3898
3137
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3899
3138
  switch (errorCode) {
3900
3139
  case "BadRequestException":
@@ -3914,29 +3153,26 @@ const deserializeAws_restJson1UpdateDataSourceCommandError = async (output, cont
3914
3153
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3915
3154
  default:
3916
3155
  const parsedBody = parsedOutput.body;
3917
- const $metadata = deserializeMetadata(output);
3918
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3919
- response = new AppSyncServiceException_1.AppSyncServiceException({
3920
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3921
- $fault: "client",
3922
- $metadata,
3156
+ (0, smithy_client_1.throwDefaultError)({
3157
+ output,
3158
+ parsedBody,
3159
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3160
+ errorCode,
3923
3161
  });
3924
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3925
3162
  }
3926
3163
  };
3927
3164
  const deserializeAws_restJson1UpdateDomainNameCommand = async (output, context) => {
3928
3165
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3929
3166
  return deserializeAws_restJson1UpdateDomainNameCommandError(output, context);
3930
3167
  }
3931
- const contents = {
3168
+ const contents = map({
3932
3169
  $metadata: deserializeMetadata(output),
3933
- domainNameConfig: undefined,
3934
- };
3170
+ });
3935
3171
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3936
- if (data.domainNameConfig !== undefined && data.domainNameConfig !== null) {
3172
+ if (data.domainNameConfig != null) {
3937
3173
  contents.domainNameConfig = deserializeAws_restJson1DomainNameConfig(data.domainNameConfig, context);
3938
3174
  }
3939
- return Promise.resolve(contents);
3175
+ return contents;
3940
3176
  };
3941
3177
  exports.deserializeAws_restJson1UpdateDomainNameCommand = deserializeAws_restJson1UpdateDomainNameCommand;
3942
3178
  const deserializeAws_restJson1UpdateDomainNameCommandError = async (output, context) => {
@@ -3944,7 +3180,6 @@ const deserializeAws_restJson1UpdateDomainNameCommandError = async (output, cont
3944
3180
  ...output,
3945
3181
  body: await parseBody(output.body, context),
3946
3182
  };
3947
- let response;
3948
3183
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3949
3184
  switch (errorCode) {
3950
3185
  case "AccessDeniedException":
@@ -3964,29 +3199,26 @@ const deserializeAws_restJson1UpdateDomainNameCommandError = async (output, cont
3964
3199
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3965
3200
  default:
3966
3201
  const parsedBody = parsedOutput.body;
3967
- const $metadata = deserializeMetadata(output);
3968
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3969
- response = new AppSyncServiceException_1.AppSyncServiceException({
3970
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3971
- $fault: "client",
3972
- $metadata,
3202
+ (0, smithy_client_1.throwDefaultError)({
3203
+ output,
3204
+ parsedBody,
3205
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3206
+ errorCode,
3973
3207
  });
3974
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3975
3208
  }
3976
3209
  };
3977
3210
  const deserializeAws_restJson1UpdateFunctionCommand = async (output, context) => {
3978
3211
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3979
3212
  return deserializeAws_restJson1UpdateFunctionCommandError(output, context);
3980
3213
  }
3981
- const contents = {
3214
+ const contents = map({
3982
3215
  $metadata: deserializeMetadata(output),
3983
- functionConfiguration: undefined,
3984
- };
3216
+ });
3985
3217
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3986
- if (data.functionConfiguration !== undefined && data.functionConfiguration !== null) {
3218
+ if (data.functionConfiguration != null) {
3987
3219
  contents.functionConfiguration = deserializeAws_restJson1FunctionConfiguration(data.functionConfiguration, context);
3988
3220
  }
3989
- return Promise.resolve(contents);
3221
+ return contents;
3990
3222
  };
3991
3223
  exports.deserializeAws_restJson1UpdateFunctionCommand = deserializeAws_restJson1UpdateFunctionCommand;
3992
3224
  const deserializeAws_restJson1UpdateFunctionCommandError = async (output, context) => {
@@ -3994,7 +3226,6 @@ const deserializeAws_restJson1UpdateFunctionCommandError = async (output, contex
3994
3226
  ...output,
3995
3227
  body: await parseBody(output.body, context),
3996
3228
  };
3997
- let response;
3998
3229
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3999
3230
  switch (errorCode) {
4000
3231
  case "ConcurrentModificationException":
@@ -4011,29 +3242,26 @@ const deserializeAws_restJson1UpdateFunctionCommandError = async (output, contex
4011
3242
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4012
3243
  default:
4013
3244
  const parsedBody = parsedOutput.body;
4014
- const $metadata = deserializeMetadata(output);
4015
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4016
- response = new AppSyncServiceException_1.AppSyncServiceException({
4017
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4018
- $fault: "client",
4019
- $metadata,
3245
+ (0, smithy_client_1.throwDefaultError)({
3246
+ output,
3247
+ parsedBody,
3248
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3249
+ errorCode,
4020
3250
  });
4021
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4022
3251
  }
4023
3252
  };
4024
3253
  const deserializeAws_restJson1UpdateGraphqlApiCommand = async (output, context) => {
4025
3254
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4026
3255
  return deserializeAws_restJson1UpdateGraphqlApiCommandError(output, context);
4027
3256
  }
4028
- const contents = {
3257
+ const contents = map({
4029
3258
  $metadata: deserializeMetadata(output),
4030
- graphqlApi: undefined,
4031
- };
3259
+ });
4032
3260
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4033
- if (data.graphqlApi !== undefined && data.graphqlApi !== null) {
3261
+ if (data.graphqlApi != null) {
4034
3262
  contents.graphqlApi = deserializeAws_restJson1GraphqlApi(data.graphqlApi, context);
4035
3263
  }
4036
- return Promise.resolve(contents);
3264
+ return contents;
4037
3265
  };
4038
3266
  exports.deserializeAws_restJson1UpdateGraphqlApiCommand = deserializeAws_restJson1UpdateGraphqlApiCommand;
4039
3267
  const deserializeAws_restJson1UpdateGraphqlApiCommandError = async (output, context) => {
@@ -4041,7 +3269,6 @@ const deserializeAws_restJson1UpdateGraphqlApiCommandError = async (output, cont
4041
3269
  ...output,
4042
3270
  body: await parseBody(output.body, context),
4043
3271
  };
4044
- let response;
4045
3272
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4046
3273
  switch (errorCode) {
4047
3274
  case "AccessDeniedException":
@@ -4064,29 +3291,26 @@ const deserializeAws_restJson1UpdateGraphqlApiCommandError = async (output, cont
4064
3291
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4065
3292
  default:
4066
3293
  const parsedBody = parsedOutput.body;
4067
- const $metadata = deserializeMetadata(output);
4068
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4069
- response = new AppSyncServiceException_1.AppSyncServiceException({
4070
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4071
- $fault: "client",
4072
- $metadata,
3294
+ (0, smithy_client_1.throwDefaultError)({
3295
+ output,
3296
+ parsedBody,
3297
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3298
+ errorCode,
4073
3299
  });
4074
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4075
3300
  }
4076
3301
  };
4077
3302
  const deserializeAws_restJson1UpdateResolverCommand = async (output, context) => {
4078
3303
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4079
3304
  return deserializeAws_restJson1UpdateResolverCommandError(output, context);
4080
3305
  }
4081
- const contents = {
3306
+ const contents = map({
4082
3307
  $metadata: deserializeMetadata(output),
4083
- resolver: undefined,
4084
- };
3308
+ });
4085
3309
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4086
- if (data.resolver !== undefined && data.resolver !== null) {
3310
+ if (data.resolver != null) {
4087
3311
  contents.resolver = deserializeAws_restJson1Resolver(data.resolver, context);
4088
3312
  }
4089
- return Promise.resolve(contents);
3313
+ return contents;
4090
3314
  };
4091
3315
  exports.deserializeAws_restJson1UpdateResolverCommand = deserializeAws_restJson1UpdateResolverCommand;
4092
3316
  const deserializeAws_restJson1UpdateResolverCommandError = async (output, context) => {
@@ -4094,7 +3318,6 @@ const deserializeAws_restJson1UpdateResolverCommandError = async (output, contex
4094
3318
  ...output,
4095
3319
  body: await parseBody(output.body, context),
4096
3320
  };
4097
- let response;
4098
3321
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4099
3322
  switch (errorCode) {
4100
3323
  case "ConcurrentModificationException":
@@ -4111,29 +3334,26 @@ const deserializeAws_restJson1UpdateResolverCommandError = async (output, contex
4111
3334
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4112
3335
  default:
4113
3336
  const parsedBody = parsedOutput.body;
4114
- const $metadata = deserializeMetadata(output);
4115
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4116
- response = new AppSyncServiceException_1.AppSyncServiceException({
4117
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4118
- $fault: "client",
4119
- $metadata,
3337
+ (0, smithy_client_1.throwDefaultError)({
3338
+ output,
3339
+ parsedBody,
3340
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3341
+ errorCode,
4120
3342
  });
4121
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4122
3343
  }
4123
3344
  };
4124
3345
  const deserializeAws_restJson1UpdateTypeCommand = async (output, context) => {
4125
3346
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4126
3347
  return deserializeAws_restJson1UpdateTypeCommandError(output, context);
4127
3348
  }
4128
- const contents = {
3349
+ const contents = map({
4129
3350
  $metadata: deserializeMetadata(output),
4130
- type: undefined,
4131
- };
3351
+ });
4132
3352
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4133
- if (data.type !== undefined && data.type !== null) {
3353
+ if (data.type != null) {
4134
3354
  contents.type = deserializeAws_restJson1Type(data.type, context);
4135
3355
  }
4136
- return Promise.resolve(contents);
3356
+ return contents;
4137
3357
  };
4138
3358
  exports.deserializeAws_restJson1UpdateTypeCommand = deserializeAws_restJson1UpdateTypeCommand;
4139
3359
  const deserializeAws_restJson1UpdateTypeCommandError = async (output, context) => {
@@ -4141,7 +3361,6 @@ const deserializeAws_restJson1UpdateTypeCommandError = async (output, context) =
4141
3361
  ...output,
4142
3362
  body: await parseBody(output.body, context),
4143
3363
  };
4144
- let response;
4145
3364
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4146
3365
  switch (errorCode) {
4147
3366
  case "BadRequestException":
@@ -4161,20 +3380,19 @@ const deserializeAws_restJson1UpdateTypeCommandError = async (output, context) =
4161
3380
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4162
3381
  default:
4163
3382
  const parsedBody = parsedOutput.body;
4164
- const $metadata = deserializeMetadata(output);
4165
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4166
- response = new AppSyncServiceException_1.AppSyncServiceException({
4167
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4168
- $fault: "client",
4169
- $metadata,
3383
+ (0, smithy_client_1.throwDefaultError)({
3384
+ output,
3385
+ parsedBody,
3386
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3387
+ errorCode,
4170
3388
  });
4171
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4172
3389
  }
4173
3390
  };
3391
+ const map = smithy_client_1.map;
4174
3392
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
4175
- const contents = {};
3393
+ const contents = map({});
4176
3394
  const data = parsedOutput.body;
4177
- if (data.message !== undefined && data.message !== null) {
3395
+ if (data.message != null) {
4178
3396
  contents.message = (0, smithy_client_1.expectString)(data.message);
4179
3397
  }
4180
3398
  const exception = new models_0_1.AccessDeniedException({
@@ -4184,9 +3402,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
4184
3402
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4185
3403
  };
4186
3404
  const deserializeAws_restJson1ApiKeyLimitExceededExceptionResponse = async (parsedOutput, context) => {
4187
- const contents = {};
3405
+ const contents = map({});
4188
3406
  const data = parsedOutput.body;
4189
- if (data.message !== undefined && data.message !== null) {
3407
+ if (data.message != null) {
4190
3408
  contents.message = (0, smithy_client_1.expectString)(data.message);
4191
3409
  }
4192
3410
  const exception = new models_0_1.ApiKeyLimitExceededException({
@@ -4196,9 +3414,9 @@ const deserializeAws_restJson1ApiKeyLimitExceededExceptionResponse = async (pars
4196
3414
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4197
3415
  };
4198
3416
  const deserializeAws_restJson1ApiKeyValidityOutOfBoundsExceptionResponse = async (parsedOutput, context) => {
4199
- const contents = {};
3417
+ const contents = map({});
4200
3418
  const data = parsedOutput.body;
4201
- if (data.message !== undefined && data.message !== null) {
3419
+ if (data.message != null) {
4202
3420
  contents.message = (0, smithy_client_1.expectString)(data.message);
4203
3421
  }
4204
3422
  const exception = new models_0_1.ApiKeyValidityOutOfBoundsException({
@@ -4208,9 +3426,9 @@ const deserializeAws_restJson1ApiKeyValidityOutOfBoundsExceptionResponse = async
4208
3426
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4209
3427
  };
4210
3428
  const deserializeAws_restJson1ApiLimitExceededExceptionResponse = async (parsedOutput, context) => {
4211
- const contents = {};
3429
+ const contents = map({});
4212
3430
  const data = parsedOutput.body;
4213
- if (data.message !== undefined && data.message !== null) {
3431
+ if (data.message != null) {
4214
3432
  contents.message = (0, smithy_client_1.expectString)(data.message);
4215
3433
  }
4216
3434
  const exception = new models_0_1.ApiLimitExceededException({
@@ -4220,9 +3438,9 @@ const deserializeAws_restJson1ApiLimitExceededExceptionResponse = async (parsedO
4220
3438
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4221
3439
  };
4222
3440
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
4223
- const contents = {};
3441
+ const contents = map({});
4224
3442
  const data = parsedOutput.body;
4225
- if (data.message !== undefined && data.message !== null) {
3443
+ if (data.message != null) {
4226
3444
  contents.message = (0, smithy_client_1.expectString)(data.message);
4227
3445
  }
4228
3446
  const exception = new models_0_1.BadRequestException({
@@ -4232,9 +3450,9 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
4232
3450
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4233
3451
  };
4234
3452
  const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
4235
- const contents = {};
3453
+ const contents = map({});
4236
3454
  const data = parsedOutput.body;
4237
- if (data.message !== undefined && data.message !== null) {
3455
+ if (data.message != null) {
4238
3456
  contents.message = (0, smithy_client_1.expectString)(data.message);
4239
3457
  }
4240
3458
  const exception = new models_0_1.ConcurrentModificationException({
@@ -4244,9 +3462,9 @@ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (p
4244
3462
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4245
3463
  };
4246
3464
  const deserializeAws_restJson1GraphQLSchemaExceptionResponse = async (parsedOutput, context) => {
4247
- const contents = {};
3465
+ const contents = map({});
4248
3466
  const data = parsedOutput.body;
4249
- if (data.message !== undefined && data.message !== null) {
3467
+ if (data.message != null) {
4250
3468
  contents.message = (0, smithy_client_1.expectString)(data.message);
4251
3469
  }
4252
3470
  const exception = new models_0_1.GraphQLSchemaException({
@@ -4256,9 +3474,9 @@ const deserializeAws_restJson1GraphQLSchemaExceptionResponse = async (parsedOutp
4256
3474
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4257
3475
  };
4258
3476
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
4259
- const contents = {};
3477
+ const contents = map({});
4260
3478
  const data = parsedOutput.body;
4261
- if (data.message !== undefined && data.message !== null) {
3479
+ if (data.message != null) {
4262
3480
  contents.message = (0, smithy_client_1.expectString)(data.message);
4263
3481
  }
4264
3482
  const exception = new models_0_1.InternalFailureException({
@@ -4268,9 +3486,9 @@ const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOu
4268
3486
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4269
3487
  };
4270
3488
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
4271
- const contents = {};
3489
+ const contents = map({});
4272
3490
  const data = parsedOutput.body;
4273
- if (data.message !== undefined && data.message !== null) {
3491
+ if (data.message != null) {
4274
3492
  contents.message = (0, smithy_client_1.expectString)(data.message);
4275
3493
  }
4276
3494
  const exception = new models_0_1.LimitExceededException({
@@ -4280,9 +3498,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
4280
3498
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4281
3499
  };
4282
3500
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
4283
- const contents = {};
3501
+ const contents = map({});
4284
3502
  const data = parsedOutput.body;
4285
- if (data.message !== undefined && data.message !== null) {
3503
+ if (data.message != null) {
4286
3504
  contents.message = (0, smithy_client_1.expectString)(data.message);
4287
3505
  }
4288
3506
  const exception = new models_0_1.NotFoundException({
@@ -4292,9 +3510,9 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
4292
3510
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4293
3511
  };
4294
3512
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
4295
- const contents = {};
3513
+ const contents = map({});
4296
3514
  const data = parsedOutput.body;
4297
- if (data.message !== undefined && data.message !== null) {
3515
+ if (data.message != null) {
4298
3516
  contents.message = (0, smithy_client_1.expectString)(data.message);
4299
3517
  }
4300
3518
  const exception = new models_0_1.UnauthorizedException({
@@ -4321,9 +3539,6 @@ const serializeAws_restJson1AdditionalAuthenticationProviders = (input, context)
4321
3539
  return input
4322
3540
  .filter((e) => e != null)
4323
3541
  .map((entry) => {
4324
- if (entry === null) {
4325
- return null;
4326
- }
4327
3542
  return serializeAws_restJson1AdditionalAuthenticationProvider(entry, context);
4328
3543
  });
4329
3544
  };
@@ -4351,9 +3566,6 @@ const serializeAws_restJson1CachingKeys = (input, context) => {
4351
3566
  return input
4352
3567
  .filter((e) => e != null)
4353
3568
  .map((entry) => {
4354
- if (entry === null) {
4355
- return null;
4356
- }
4357
3569
  return entry;
4358
3570
  });
4359
3571
  };
@@ -4392,9 +3604,6 @@ const serializeAws_restJson1FunctionsIds = (input, context) => {
4392
3604
  return input
4393
3605
  .filter((e) => e != null)
4394
3606
  .map((entry) => {
4395
- if (entry === null) {
4396
- return null;
4397
- }
4398
3607
  return entry;
4399
3608
  });
4400
3609
  };