@aws-sdk/client-elasticsearch-service 3.139.0 → 3.145.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.
@@ -11,16 +11,7 @@ const serializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommand = a
11
11
  const headers = {};
12
12
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
13
13
  "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}/accept";
14
- if (input.CrossClusterSearchConnectionId !== undefined) {
15
- const labelValue = input.CrossClusterSearchConnectionId;
16
- if (labelValue.length <= 0) {
17
- throw new Error("Empty value provided for input HTTP label: CrossClusterSearchConnectionId.");
18
- }
19
- resolvedPath = resolvedPath.replace("{CrossClusterSearchConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
20
- }
21
- else {
22
- throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId.");
23
- }
14
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CrossClusterSearchConnectionId", () => input.CrossClusterSearchConnectionId, "{CrossClusterSearchConnectionId}", false);
24
15
  let body;
25
16
  return new protocol_http_1.HttpRequest({
26
17
  protocol,
@@ -60,26 +51,8 @@ const serializeAws_restJson1AssociatePackageCommand = async (input, context) =>
60
51
  const headers = {};
61
52
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
62
53
  "/2015-01-01/packages/associate/{PackageID}/{DomainName}";
63
- if (input.PackageID !== undefined) {
64
- const labelValue = input.PackageID;
65
- if (labelValue.length <= 0) {
66
- throw new Error("Empty value provided for input HTTP label: PackageID.");
67
- }
68
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
69
- }
70
- else {
71
- throw new Error("No value provided for input HTTP label: PackageID.");
72
- }
73
- if (input.DomainName !== undefined) {
74
- const labelValue = input.DomainName;
75
- if (labelValue.length <= 0) {
76
- throw new Error("Empty value provided for input HTTP label: DomainName.");
77
- }
78
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
79
- }
80
- else {
81
- throw new Error("No value provided for input HTTP label: DomainName.");
82
- }
54
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
55
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
83
56
  let body;
84
57
  return new protocol_http_1.HttpRequest({
85
58
  protocol,
@@ -227,16 +200,7 @@ const serializeAws_restJson1DeleteElasticsearchDomainCommand = async (input, con
227
200
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
228
201
  const headers = {};
229
202
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}";
230
- if (input.DomainName !== undefined) {
231
- const labelValue = input.DomainName;
232
- if (labelValue.length <= 0) {
233
- throw new Error("Empty value provided for input HTTP label: DomainName.");
234
- }
235
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
236
- }
237
- else {
238
- throw new Error("No value provided for input HTTP label: DomainName.");
239
- }
203
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
240
204
  let body;
241
205
  return new protocol_http_1.HttpRequest({
242
206
  protocol,
@@ -273,16 +237,7 @@ const serializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommand = a
273
237
  const headers = {};
274
238
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
275
239
  "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}";
276
- if (input.CrossClusterSearchConnectionId !== undefined) {
277
- const labelValue = input.CrossClusterSearchConnectionId;
278
- if (labelValue.length <= 0) {
279
- throw new Error("Empty value provided for input HTTP label: CrossClusterSearchConnectionId.");
280
- }
281
- resolvedPath = resolvedPath.replace("{CrossClusterSearchConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
282
- }
283
- else {
284
- throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId.");
285
- }
240
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CrossClusterSearchConnectionId", () => input.CrossClusterSearchConnectionId, "{CrossClusterSearchConnectionId}", false);
286
241
  let body;
287
242
  return new protocol_http_1.HttpRequest({
288
243
  protocol,
@@ -300,16 +255,7 @@ const serializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommand =
300
255
  const headers = {};
301
256
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
302
257
  "/2015-01-01/es/ccs/outboundConnection/{CrossClusterSearchConnectionId}";
303
- if (input.CrossClusterSearchConnectionId !== undefined) {
304
- const labelValue = input.CrossClusterSearchConnectionId;
305
- if (labelValue.length <= 0) {
306
- throw new Error("Empty value provided for input HTTP label: CrossClusterSearchConnectionId.");
307
- }
308
- resolvedPath = resolvedPath.replace("{CrossClusterSearchConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
309
- }
310
- else {
311
- throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId.");
312
- }
258
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CrossClusterSearchConnectionId", () => input.CrossClusterSearchConnectionId, "{CrossClusterSearchConnectionId}", false);
313
259
  let body;
314
260
  return new protocol_http_1.HttpRequest({
315
261
  protocol,
@@ -326,16 +272,7 @@ const serializeAws_restJson1DeletePackageCommand = async (input, context) => {
326
272
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
327
273
  const headers = {};
328
274
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/{PackageID}";
329
- if (input.PackageID !== undefined) {
330
- const labelValue = input.PackageID;
331
- if (labelValue.length <= 0) {
332
- throw new Error("Empty value provided for input HTTP label: PackageID.");
333
- }
334
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
335
- }
336
- else {
337
- throw new Error("No value provided for input HTTP label: PackageID.");
338
- }
275
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
339
276
  let body;
340
277
  return new protocol_http_1.HttpRequest({
341
278
  protocol,
@@ -355,16 +292,7 @@ const serializeAws_restJson1DescribeDomainAutoTunesCommand = async (input, conte
355
292
  };
356
293
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
357
294
  "/2015-01-01/es/domain/{DomainName}/autoTunes";
358
- if (input.DomainName !== undefined) {
359
- const labelValue = input.DomainName;
360
- if (labelValue.length <= 0) {
361
- throw new Error("Empty value provided for input HTTP label: DomainName.");
362
- }
363
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
364
- }
365
- else {
366
- throw new Error("No value provided for input HTTP label: DomainName.");
367
- }
295
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
368
296
  let body;
369
297
  body = JSON.stringify({
370
298
  ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
@@ -386,19 +314,10 @@ const serializeAws_restJson1DescribeDomainChangeProgressCommand = async (input,
386
314
  const headers = {};
387
315
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
388
316
  "/2015-01-01/es/domain/{DomainName}/progress";
389
- if (input.DomainName !== undefined) {
390
- const labelValue = input.DomainName;
391
- if (labelValue.length <= 0) {
392
- throw new Error("Empty value provided for input HTTP label: DomainName.");
393
- }
394
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
395
- }
396
- else {
397
- throw new Error("No value provided for input HTTP label: DomainName.");
398
- }
399
- const query = {
400
- ...(input.ChangeId !== undefined && { changeid: input.ChangeId }),
401
- };
317
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
318
+ const query = map({
319
+ changeid: [, input.ChangeId],
320
+ });
402
321
  let body;
403
322
  return new protocol_http_1.HttpRequest({
404
323
  protocol,
@@ -416,16 +335,7 @@ const serializeAws_restJson1DescribeElasticsearchDomainCommand = async (input, c
416
335
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
417
336
  const headers = {};
418
337
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}";
419
- if (input.DomainName !== undefined) {
420
- const labelValue = input.DomainName;
421
- if (labelValue.length <= 0) {
422
- throw new Error("Empty value provided for input HTTP label: DomainName.");
423
- }
424
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
425
- }
426
- else {
427
- throw new Error("No value provided for input HTTP label: DomainName.");
428
- }
338
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
429
339
  let body;
430
340
  return new protocol_http_1.HttpRequest({
431
341
  protocol,
@@ -442,16 +352,7 @@ const serializeAws_restJson1DescribeElasticsearchDomainConfigCommand = async (in
442
352
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
443
353
  const headers = {};
444
354
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}/config";
445
- if (input.DomainName !== undefined) {
446
- const labelValue = input.DomainName;
447
- if (labelValue.length <= 0) {
448
- throw new Error("Empty value provided for input HTTP label: DomainName.");
449
- }
450
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
451
- }
452
- else {
453
- throw new Error("No value provided for input HTTP label: DomainName.");
454
- }
355
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
455
356
  let body;
456
357
  return new protocol_http_1.HttpRequest({
457
358
  protocol,
@@ -490,29 +391,11 @@ const serializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommand = asy
490
391
  const headers = {};
491
392
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
492
393
  "/2015-01-01/es/instanceTypeLimits/{ElasticsearchVersion}/{InstanceType}";
493
- if (input.InstanceType !== undefined) {
494
- const labelValue = input.InstanceType;
495
- if (labelValue.length <= 0) {
496
- throw new Error("Empty value provided for input HTTP label: InstanceType.");
497
- }
498
- resolvedPath = resolvedPath.replace("{InstanceType}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
499
- }
500
- else {
501
- throw new Error("No value provided for input HTTP label: InstanceType.");
502
- }
503
- if (input.ElasticsearchVersion !== undefined) {
504
- const labelValue = input.ElasticsearchVersion;
505
- if (labelValue.length <= 0) {
506
- throw new Error("Empty value provided for input HTTP label: ElasticsearchVersion.");
507
- }
508
- resolvedPath = resolvedPath.replace("{ElasticsearchVersion}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
509
- }
510
- else {
511
- throw new Error("No value provided for input HTTP label: ElasticsearchVersion.");
512
- }
513
- const query = {
514
- ...(input.DomainName !== undefined && { domainName: input.DomainName }),
515
- };
394
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "InstanceType", () => input.InstanceType, "{InstanceType}", false);
395
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ElasticsearchVersion", () => input.ElasticsearchVersion, "{ElasticsearchVersion}", false);
396
+ const query = map({
397
+ domainName: [, input.DomainName],
398
+ });
516
399
  let body;
517
400
  return new protocol_http_1.HttpRequest({
518
401
  protocol,
@@ -601,13 +484,11 @@ const serializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsComman
601
484
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
602
485
  const headers = {};
603
486
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/reservedInstanceOfferings";
604
- const query = {
605
- ...(input.ReservedElasticsearchInstanceOfferingId !== undefined && {
606
- offeringId: input.ReservedElasticsearchInstanceOfferingId,
607
- }),
608
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
609
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
610
- };
487
+ const query = map({
488
+ offeringId: [, input.ReservedElasticsearchInstanceOfferingId],
489
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
490
+ nextToken: [, input.NextToken],
491
+ });
611
492
  let body;
612
493
  return new protocol_http_1.HttpRequest({
613
494
  protocol,
@@ -625,13 +506,11 @@ const serializeAws_restJson1DescribeReservedElasticsearchInstancesCommand = asyn
625
506
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
626
507
  const headers = {};
627
508
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/reservedInstances";
628
- const query = {
629
- ...(input.ReservedElasticsearchInstanceId !== undefined && {
630
- reservationId: input.ReservedElasticsearchInstanceId,
631
- }),
632
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
633
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
634
- };
509
+ const query = map({
510
+ reservationId: [, input.ReservedElasticsearchInstanceId],
511
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
512
+ nextToken: [, input.NextToken],
513
+ });
635
514
  let body;
636
515
  return new protocol_http_1.HttpRequest({
637
516
  protocol,
@@ -650,26 +529,8 @@ const serializeAws_restJson1DissociatePackageCommand = async (input, context) =>
650
529
  const headers = {};
651
530
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
652
531
  "/2015-01-01/packages/dissociate/{PackageID}/{DomainName}";
653
- if (input.PackageID !== undefined) {
654
- const labelValue = input.PackageID;
655
- if (labelValue.length <= 0) {
656
- throw new Error("Empty value provided for input HTTP label: PackageID.");
657
- }
658
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
659
- }
660
- else {
661
- throw new Error("No value provided for input HTTP label: PackageID.");
662
- }
663
- if (input.DomainName !== undefined) {
664
- const labelValue = input.DomainName;
665
- if (labelValue.length <= 0) {
666
- throw new Error("Empty value provided for input HTTP label: DomainName.");
667
- }
668
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
669
- }
670
- else {
671
- throw new Error("No value provided for input HTTP label: DomainName.");
672
- }
532
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
533
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
673
534
  let body;
674
535
  return new protocol_http_1.HttpRequest({
675
536
  protocol,
@@ -686,9 +547,9 @@ const serializeAws_restJson1GetCompatibleElasticsearchVersionsCommand = async (i
686
547
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
687
548
  const headers = {};
688
549
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/compatibleVersions";
689
- const query = {
690
- ...(input.DomainName !== undefined && { domainName: input.DomainName }),
691
- };
550
+ const query = map({
551
+ domainName: [, input.DomainName],
552
+ });
692
553
  let body;
693
554
  return new protocol_http_1.HttpRequest({
694
555
  protocol,
@@ -706,20 +567,11 @@ const serializeAws_restJson1GetPackageVersionHistoryCommand = async (input, cont
706
567
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
707
568
  const headers = {};
708
569
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/{PackageID}/history";
709
- if (input.PackageID !== undefined) {
710
- const labelValue = input.PackageID;
711
- if (labelValue.length <= 0) {
712
- throw new Error("Empty value provided for input HTTP label: PackageID.");
713
- }
714
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
715
- }
716
- else {
717
- throw new Error("No value provided for input HTTP label: PackageID.");
718
- }
719
- const query = {
720
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
721
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
722
- };
570
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
571
+ const query = map({
572
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
573
+ nextToken: [, input.NextToken],
574
+ });
723
575
  let body;
724
576
  return new protocol_http_1.HttpRequest({
725
577
  protocol,
@@ -738,20 +590,11 @@ const serializeAws_restJson1GetUpgradeHistoryCommand = async (input, context) =>
738
590
  const headers = {};
739
591
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
740
592
  "/2015-01-01/es/upgradeDomain/{DomainName}/history";
741
- if (input.DomainName !== undefined) {
742
- const labelValue = input.DomainName;
743
- if (labelValue.length <= 0) {
744
- throw new Error("Empty value provided for input HTTP label: DomainName.");
745
- }
746
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
747
- }
748
- else {
749
- throw new Error("No value provided for input HTTP label: DomainName.");
750
- }
751
- const query = {
752
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
753
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
754
- };
593
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
594
+ const query = map({
595
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
596
+ nextToken: [, input.NextToken],
597
+ });
755
598
  let body;
756
599
  return new protocol_http_1.HttpRequest({
757
600
  protocol,
@@ -770,16 +613,7 @@ const serializeAws_restJson1GetUpgradeStatusCommand = async (input, context) =>
770
613
  const headers = {};
771
614
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
772
615
  "/2015-01-01/es/upgradeDomain/{DomainName}/status";
773
- if (input.DomainName !== undefined) {
774
- const labelValue = input.DomainName;
775
- if (labelValue.length <= 0) {
776
- throw new Error("Empty value provided for input HTTP label: DomainName.");
777
- }
778
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
779
- }
780
- else {
781
- throw new Error("No value provided for input HTTP label: DomainName.");
782
- }
616
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
783
617
  let body;
784
618
  return new protocol_http_1.HttpRequest({
785
619
  protocol,
@@ -796,9 +630,9 @@ const serializeAws_restJson1ListDomainNamesCommand = async (input, context) => {
796
630
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
797
631
  const headers = {};
798
632
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/domain";
799
- const query = {
800
- ...(input.EngineType !== undefined && { engineType: input.EngineType }),
801
- };
633
+ const query = map({
634
+ engineType: [, input.EngineType],
635
+ });
802
636
  let body;
803
637
  return new protocol_http_1.HttpRequest({
804
638
  protocol,
@@ -816,20 +650,11 @@ const serializeAws_restJson1ListDomainsForPackageCommand = async (input, context
816
650
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
817
651
  const headers = {};
818
652
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/{PackageID}/domains";
819
- if (input.PackageID !== undefined) {
820
- const labelValue = input.PackageID;
821
- if (labelValue.length <= 0) {
822
- throw new Error("Empty value provided for input HTTP label: PackageID.");
823
- }
824
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
825
- }
826
- else {
827
- throw new Error("No value provided for input HTTP label: PackageID.");
828
- }
829
- const query = {
830
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
831
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
832
- };
653
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
654
+ const query = map({
655
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
656
+ nextToken: [, input.NextToken],
657
+ });
833
658
  let body;
834
659
  return new protocol_http_1.HttpRequest({
835
660
  protocol,
@@ -848,21 +673,12 @@ const serializeAws_restJson1ListElasticsearchInstanceTypesCommand = async (input
848
673
  const headers = {};
849
674
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
850
675
  "/2015-01-01/es/instanceTypes/{ElasticsearchVersion}";
851
- if (input.ElasticsearchVersion !== undefined) {
852
- const labelValue = input.ElasticsearchVersion;
853
- if (labelValue.length <= 0) {
854
- throw new Error("Empty value provided for input HTTP label: ElasticsearchVersion.");
855
- }
856
- resolvedPath = resolvedPath.replace("{ElasticsearchVersion}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
857
- }
858
- else {
859
- throw new Error("No value provided for input HTTP label: ElasticsearchVersion.");
860
- }
861
- const query = {
862
- ...(input.DomainName !== undefined && { domainName: input.DomainName }),
863
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
864
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
865
- };
676
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ElasticsearchVersion", () => input.ElasticsearchVersion, "{ElasticsearchVersion}", false);
677
+ const query = map({
678
+ domainName: [, input.DomainName],
679
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
680
+ nextToken: [, input.NextToken],
681
+ });
866
682
  let body;
867
683
  return new protocol_http_1.HttpRequest({
868
684
  protocol,
@@ -880,10 +696,10 @@ const serializeAws_restJson1ListElasticsearchVersionsCommand = async (input, con
880
696
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
881
697
  const headers = {};
882
698
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/versions";
883
- const query = {
884
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
885
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
886
- };
699
+ const query = map({
700
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
701
+ nextToken: [, input.NextToken],
702
+ });
887
703
  let body;
888
704
  return new protocol_http_1.HttpRequest({
889
705
  protocol,
@@ -901,20 +717,11 @@ const serializeAws_restJson1ListPackagesForDomainCommand = async (input, context
901
717
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
902
718
  const headers = {};
903
719
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/domain/{DomainName}/packages";
904
- if (input.DomainName !== undefined) {
905
- const labelValue = input.DomainName;
906
- if (labelValue.length <= 0) {
907
- throw new Error("Empty value provided for input HTTP label: DomainName.");
908
- }
909
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
910
- }
911
- else {
912
- throw new Error("No value provided for input HTTP label: DomainName.");
913
- }
914
- const query = {
915
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
916
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
917
- };
720
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
721
+ const query = map({
722
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
723
+ nextToken: [, input.NextToken],
724
+ });
918
725
  let body;
919
726
  return new protocol_http_1.HttpRequest({
920
727
  protocol,
@@ -932,9 +739,9 @@ const serializeAws_restJson1ListTagsCommand = async (input, context) => {
932
739
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
933
740
  const headers = {};
934
741
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/tags";
935
- const query = {
936
- ...(input.ARN !== undefined && { arn: input.ARN }),
937
- };
742
+ const query = map({
743
+ arn: [, input.ARN],
744
+ });
938
745
  let body;
939
746
  return new protocol_http_1.HttpRequest({
940
747
  protocol,
@@ -979,16 +786,7 @@ const serializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommand = a
979
786
  const headers = {};
980
787
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
981
788
  "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}/reject";
982
- if (input.CrossClusterSearchConnectionId !== undefined) {
983
- const labelValue = input.CrossClusterSearchConnectionId;
984
- if (labelValue.length <= 0) {
985
- throw new Error("Empty value provided for input HTTP label: CrossClusterSearchConnectionId.");
986
- }
987
- resolvedPath = resolvedPath.replace("{CrossClusterSearchConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
988
- }
989
- else {
990
- throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId.");
991
- }
789
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CrossClusterSearchConnectionId", () => input.CrossClusterSearchConnectionId, "{CrossClusterSearchConnectionId}", false);
992
790
  let body;
993
791
  return new protocol_http_1.HttpRequest({
994
792
  protocol,
@@ -1051,16 +849,7 @@ const serializeAws_restJson1UpdateElasticsearchDomainConfigCommand = async (inpu
1051
849
  "content-type": "application/json",
1052
850
  };
1053
851
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}/config";
1054
- if (input.DomainName !== undefined) {
1055
- const labelValue = input.DomainName;
1056
- if (labelValue.length <= 0) {
1057
- throw new Error("Empty value provided for input HTTP label: DomainName.");
1058
- }
1059
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1060
- }
1061
- else {
1062
- throw new Error("No value provided for input HTTP label: DomainName.");
1063
- }
852
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
1064
853
  let body;
1065
854
  body = JSON.stringify({
1066
855
  ...(input.AccessPolicies != null && { AccessPolicies: input.AccessPolicies }),
@@ -1162,15 +951,14 @@ const deserializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommand =
1162
951
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1163
952
  return deserializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommandError(output, context);
1164
953
  }
1165
- const contents = {
954
+ const contents = map({
1166
955
  $metadata: deserializeMetadata(output),
1167
- CrossClusterSearchConnection: undefined,
1168
- };
956
+ });
1169
957
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1170
- if (data.CrossClusterSearchConnection !== undefined && data.CrossClusterSearchConnection !== null) {
958
+ if (data.CrossClusterSearchConnection != null) {
1171
959
  contents.CrossClusterSearchConnection = deserializeAws_restJson1InboundCrossClusterSearchConnection(data.CrossClusterSearchConnection, context);
1172
960
  }
1173
- return Promise.resolve(contents);
961
+ return contents;
1174
962
  };
1175
963
  exports.deserializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommand = deserializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommand;
1176
964
  const deserializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommandError = async (output, context) => {
@@ -1178,7 +966,6 @@ const deserializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommandEr
1178
966
  ...output,
1179
967
  body: await parseBody(output.body, context),
1180
968
  };
1181
- let response;
1182
969
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1183
970
  switch (errorCode) {
1184
971
  case "DisabledOperationException":
@@ -1192,25 +979,23 @@ const deserializeAws_restJson1AcceptInboundCrossClusterSearchConnectionCommandEr
1192
979
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1193
980
  default:
1194
981
  const parsedBody = parsedOutput.body;
1195
- const $metadata = deserializeMetadata(output);
1196
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1197
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1198
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1199
- $fault: "client",
1200
- $metadata,
982
+ (0, smithy_client_1.throwDefaultError)({
983
+ output,
984
+ parsedBody,
985
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
986
+ errorCode,
1201
987
  });
1202
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1203
988
  }
1204
989
  };
1205
990
  const deserializeAws_restJson1AddTagsCommand = async (output, context) => {
1206
991
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1207
992
  return deserializeAws_restJson1AddTagsCommandError(output, context);
1208
993
  }
1209
- const contents = {
994
+ const contents = map({
1210
995
  $metadata: deserializeMetadata(output),
1211
- };
996
+ });
1212
997
  await collectBody(output.body, context);
1213
- return Promise.resolve(contents);
998
+ return contents;
1214
999
  };
1215
1000
  exports.deserializeAws_restJson1AddTagsCommand = deserializeAws_restJson1AddTagsCommand;
1216
1001
  const deserializeAws_restJson1AddTagsCommandError = async (output, context) => {
@@ -1218,7 +1003,6 @@ const deserializeAws_restJson1AddTagsCommandError = async (output, context) => {
1218
1003
  ...output,
1219
1004
  body: await parseBody(output.body, context),
1220
1005
  };
1221
- let response;
1222
1006
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1223
1007
  switch (errorCode) {
1224
1008
  case "BaseException":
@@ -1235,29 +1019,26 @@ const deserializeAws_restJson1AddTagsCommandError = async (output, context) => {
1235
1019
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1236
1020
  default:
1237
1021
  const parsedBody = parsedOutput.body;
1238
- const $metadata = deserializeMetadata(output);
1239
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1240
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1241
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1242
- $fault: "client",
1243
- $metadata,
1022
+ (0, smithy_client_1.throwDefaultError)({
1023
+ output,
1024
+ parsedBody,
1025
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1026
+ errorCode,
1244
1027
  });
1245
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1246
1028
  }
1247
1029
  };
1248
1030
  const deserializeAws_restJson1AssociatePackageCommand = async (output, context) => {
1249
1031
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1250
1032
  return deserializeAws_restJson1AssociatePackageCommandError(output, context);
1251
1033
  }
1252
- const contents = {
1034
+ const contents = map({
1253
1035
  $metadata: deserializeMetadata(output),
1254
- DomainPackageDetails: undefined,
1255
- };
1036
+ });
1256
1037
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1257
- if (data.DomainPackageDetails !== undefined && data.DomainPackageDetails !== null) {
1038
+ if (data.DomainPackageDetails != null) {
1258
1039
  contents.DomainPackageDetails = deserializeAws_restJson1DomainPackageDetails(data.DomainPackageDetails, context);
1259
1040
  }
1260
- return Promise.resolve(contents);
1041
+ return contents;
1261
1042
  };
1262
1043
  exports.deserializeAws_restJson1AssociatePackageCommand = deserializeAws_restJson1AssociatePackageCommand;
1263
1044
  const deserializeAws_restJson1AssociatePackageCommandError = async (output, context) => {
@@ -1265,7 +1046,6 @@ const deserializeAws_restJson1AssociatePackageCommandError = async (output, cont
1265
1046
  ...output,
1266
1047
  body: await parseBody(output.body, context),
1267
1048
  };
1268
- let response;
1269
1049
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1270
1050
  switch (errorCode) {
1271
1051
  case "AccessDeniedException":
@@ -1288,29 +1068,26 @@ const deserializeAws_restJson1AssociatePackageCommandError = async (output, cont
1288
1068
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1289
1069
  default:
1290
1070
  const parsedBody = parsedOutput.body;
1291
- const $metadata = deserializeMetadata(output);
1292
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1293
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1294
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1295
- $fault: "client",
1296
- $metadata,
1071
+ (0, smithy_client_1.throwDefaultError)({
1072
+ output,
1073
+ parsedBody,
1074
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1075
+ errorCode,
1297
1076
  });
1298
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1299
1077
  }
1300
1078
  };
1301
1079
  const deserializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateCommand = async (output, context) => {
1302
1080
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1303
1081
  return deserializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateCommandError(output, context);
1304
1082
  }
1305
- const contents = {
1083
+ const contents = map({
1306
1084
  $metadata: deserializeMetadata(output),
1307
- ServiceSoftwareOptions: undefined,
1308
- };
1085
+ });
1309
1086
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1310
- if (data.ServiceSoftwareOptions !== undefined && data.ServiceSoftwareOptions !== null) {
1087
+ if (data.ServiceSoftwareOptions != null) {
1311
1088
  contents.ServiceSoftwareOptions = deserializeAws_restJson1ServiceSoftwareOptions(data.ServiceSoftwareOptions, context);
1312
1089
  }
1313
- return Promise.resolve(contents);
1090
+ return contents;
1314
1091
  };
1315
1092
  exports.deserializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateCommand = deserializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateCommand;
1316
1093
  const deserializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateCommandError = async (output, context) => {
@@ -1318,7 +1095,6 @@ const deserializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateCommandErr
1318
1095
  ...output,
1319
1096
  body: await parseBody(output.body, context),
1320
1097
  };
1321
- let response;
1322
1098
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1323
1099
  switch (errorCode) {
1324
1100
  case "BaseException":
@@ -1335,29 +1111,26 @@ const deserializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateCommandErr
1335
1111
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1336
1112
  default:
1337
1113
  const parsedBody = parsedOutput.body;
1338
- const $metadata = deserializeMetadata(output);
1339
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1340
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1341
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1342
- $fault: "client",
1343
- $metadata,
1114
+ (0, smithy_client_1.throwDefaultError)({
1115
+ output,
1116
+ parsedBody,
1117
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1118
+ errorCode,
1344
1119
  });
1345
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1346
1120
  }
1347
1121
  };
1348
1122
  const deserializeAws_restJson1CreateElasticsearchDomainCommand = async (output, context) => {
1349
1123
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1350
1124
  return deserializeAws_restJson1CreateElasticsearchDomainCommandError(output, context);
1351
1125
  }
1352
- const contents = {
1126
+ const contents = map({
1353
1127
  $metadata: deserializeMetadata(output),
1354
- DomainStatus: undefined,
1355
- };
1128
+ });
1356
1129
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1357
- if (data.DomainStatus !== undefined && data.DomainStatus !== null) {
1130
+ if (data.DomainStatus != null) {
1358
1131
  contents.DomainStatus = deserializeAws_restJson1ElasticsearchDomainStatus(data.DomainStatus, context);
1359
1132
  }
1360
- return Promise.resolve(contents);
1133
+ return contents;
1361
1134
  };
1362
1135
  exports.deserializeAws_restJson1CreateElasticsearchDomainCommand = deserializeAws_restJson1CreateElasticsearchDomainCommand;
1363
1136
  const deserializeAws_restJson1CreateElasticsearchDomainCommandError = async (output, context) => {
@@ -1365,7 +1138,6 @@ const deserializeAws_restJson1CreateElasticsearchDomainCommandError = async (out
1365
1138
  ...output,
1366
1139
  body: await parseBody(output.body, context),
1367
1140
  };
1368
- let response;
1369
1141
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1370
1142
  switch (errorCode) {
1371
1143
  case "BaseException":
@@ -1391,45 +1163,38 @@ const deserializeAws_restJson1CreateElasticsearchDomainCommandError = async (out
1391
1163
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1392
1164
  default:
1393
1165
  const parsedBody = parsedOutput.body;
1394
- const $metadata = deserializeMetadata(output);
1395
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1396
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1397
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1398
- $fault: "client",
1399
- $metadata,
1166
+ (0, smithy_client_1.throwDefaultError)({
1167
+ output,
1168
+ parsedBody,
1169
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1170
+ errorCode,
1400
1171
  });
1401
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1402
1172
  }
1403
1173
  };
1404
1174
  const deserializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCommand = async (output, context) => {
1405
1175
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1406
1176
  return deserializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCommandError(output, context);
1407
1177
  }
1408
- const contents = {
1178
+ const contents = map({
1409
1179
  $metadata: deserializeMetadata(output),
1410
- ConnectionAlias: undefined,
1411
- ConnectionStatus: undefined,
1412
- CrossClusterSearchConnectionId: undefined,
1413
- DestinationDomainInfo: undefined,
1414
- SourceDomainInfo: undefined,
1415
- };
1180
+ });
1416
1181
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1417
- if (data.ConnectionAlias !== undefined && data.ConnectionAlias !== null) {
1182
+ if (data.ConnectionAlias != null) {
1418
1183
  contents.ConnectionAlias = (0, smithy_client_1.expectString)(data.ConnectionAlias);
1419
1184
  }
1420
- if (data.ConnectionStatus !== undefined && data.ConnectionStatus !== null) {
1185
+ if (data.ConnectionStatus != null) {
1421
1186
  contents.ConnectionStatus = deserializeAws_restJson1OutboundCrossClusterSearchConnectionStatus(data.ConnectionStatus, context);
1422
1187
  }
1423
- if (data.CrossClusterSearchConnectionId !== undefined && data.CrossClusterSearchConnectionId !== null) {
1188
+ if (data.CrossClusterSearchConnectionId != null) {
1424
1189
  contents.CrossClusterSearchConnectionId = (0, smithy_client_1.expectString)(data.CrossClusterSearchConnectionId);
1425
1190
  }
1426
- if (data.DestinationDomainInfo !== undefined && data.DestinationDomainInfo !== null) {
1191
+ if (data.DestinationDomainInfo != null) {
1427
1192
  contents.DestinationDomainInfo = deserializeAws_restJson1DomainInformation(data.DestinationDomainInfo, context);
1428
1193
  }
1429
- if (data.SourceDomainInfo !== undefined && data.SourceDomainInfo !== null) {
1194
+ if (data.SourceDomainInfo != null) {
1430
1195
  contents.SourceDomainInfo = deserializeAws_restJson1DomainInformation(data.SourceDomainInfo, context);
1431
1196
  }
1432
- return Promise.resolve(contents);
1197
+ return contents;
1433
1198
  };
1434
1199
  exports.deserializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCommand = deserializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCommand;
1435
1200
  const deserializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCommandError = async (output, context) => {
@@ -1437,7 +1202,6 @@ const deserializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCommandE
1437
1202
  ...output,
1438
1203
  body: await parseBody(output.body, context),
1439
1204
  };
1440
- let response;
1441
1205
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1442
1206
  switch (errorCode) {
1443
1207
  case "DisabledOperationException":
@@ -1454,29 +1218,26 @@ const deserializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCommandE
1454
1218
  throw await deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
1455
1219
  default:
1456
1220
  const parsedBody = parsedOutput.body;
1457
- const $metadata = deserializeMetadata(output);
1458
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1459
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1460
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1461
- $fault: "client",
1462
- $metadata,
1221
+ (0, smithy_client_1.throwDefaultError)({
1222
+ output,
1223
+ parsedBody,
1224
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1225
+ errorCode,
1463
1226
  });
1464
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1465
1227
  }
1466
1228
  };
1467
1229
  const deserializeAws_restJson1CreatePackageCommand = async (output, context) => {
1468
1230
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1469
1231
  return deserializeAws_restJson1CreatePackageCommandError(output, context);
1470
1232
  }
1471
- const contents = {
1233
+ const contents = map({
1472
1234
  $metadata: deserializeMetadata(output),
1473
- PackageDetails: undefined,
1474
- };
1235
+ });
1475
1236
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1476
- if (data.PackageDetails !== undefined && data.PackageDetails !== null) {
1237
+ if (data.PackageDetails != null) {
1477
1238
  contents.PackageDetails = deserializeAws_restJson1PackageDetails(data.PackageDetails, context);
1478
1239
  }
1479
- return Promise.resolve(contents);
1240
+ return contents;
1480
1241
  };
1481
1242
  exports.deserializeAws_restJson1CreatePackageCommand = deserializeAws_restJson1CreatePackageCommand;
1482
1243
  const deserializeAws_restJson1CreatePackageCommandError = async (output, context) => {
@@ -1484,7 +1245,6 @@ const deserializeAws_restJson1CreatePackageCommandError = async (output, context
1484
1245
  ...output,
1485
1246
  body: await parseBody(output.body, context),
1486
1247
  };
1487
- let response;
1488
1248
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1489
1249
  switch (errorCode) {
1490
1250
  case "AccessDeniedException":
@@ -1510,29 +1270,26 @@ const deserializeAws_restJson1CreatePackageCommandError = async (output, context
1510
1270
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1511
1271
  default:
1512
1272
  const parsedBody = parsedOutput.body;
1513
- const $metadata = deserializeMetadata(output);
1514
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1515
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1516
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1517
- $fault: "client",
1518
- $metadata,
1273
+ (0, smithy_client_1.throwDefaultError)({
1274
+ output,
1275
+ parsedBody,
1276
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1277
+ errorCode,
1519
1278
  });
1520
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1521
1279
  }
1522
1280
  };
1523
1281
  const deserializeAws_restJson1DeleteElasticsearchDomainCommand = async (output, context) => {
1524
1282
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1525
1283
  return deserializeAws_restJson1DeleteElasticsearchDomainCommandError(output, context);
1526
1284
  }
1527
- const contents = {
1285
+ const contents = map({
1528
1286
  $metadata: deserializeMetadata(output),
1529
- DomainStatus: undefined,
1530
- };
1287
+ });
1531
1288
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1532
- if (data.DomainStatus !== undefined && data.DomainStatus !== null) {
1289
+ if (data.DomainStatus != null) {
1533
1290
  contents.DomainStatus = deserializeAws_restJson1ElasticsearchDomainStatus(data.DomainStatus, context);
1534
1291
  }
1535
- return Promise.resolve(contents);
1292
+ return contents;
1536
1293
  };
1537
1294
  exports.deserializeAws_restJson1DeleteElasticsearchDomainCommand = deserializeAws_restJson1DeleteElasticsearchDomainCommand;
1538
1295
  const deserializeAws_restJson1DeleteElasticsearchDomainCommandError = async (output, context) => {
@@ -1540,7 +1297,6 @@ const deserializeAws_restJson1DeleteElasticsearchDomainCommandError = async (out
1540
1297
  ...output,
1541
1298
  body: await parseBody(output.body, context),
1542
1299
  };
1543
- let response;
1544
1300
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1545
1301
  switch (errorCode) {
1546
1302
  case "BaseException":
@@ -1557,25 +1313,23 @@ const deserializeAws_restJson1DeleteElasticsearchDomainCommandError = async (out
1557
1313
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1558
1314
  default:
1559
1315
  const parsedBody = parsedOutput.body;
1560
- const $metadata = deserializeMetadata(output);
1561
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1562
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1563
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1564
- $fault: "client",
1565
- $metadata,
1316
+ (0, smithy_client_1.throwDefaultError)({
1317
+ output,
1318
+ parsedBody,
1319
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1320
+ errorCode,
1566
1321
  });
1567
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1568
1322
  }
1569
1323
  };
1570
1324
  const deserializeAws_restJson1DeleteElasticsearchServiceRoleCommand = async (output, context) => {
1571
1325
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1572
1326
  return deserializeAws_restJson1DeleteElasticsearchServiceRoleCommandError(output, context);
1573
1327
  }
1574
- const contents = {
1328
+ const contents = map({
1575
1329
  $metadata: deserializeMetadata(output),
1576
- };
1330
+ });
1577
1331
  await collectBody(output.body, context);
1578
- return Promise.resolve(contents);
1332
+ return contents;
1579
1333
  };
1580
1334
  exports.deserializeAws_restJson1DeleteElasticsearchServiceRoleCommand = deserializeAws_restJson1DeleteElasticsearchServiceRoleCommand;
1581
1335
  const deserializeAws_restJson1DeleteElasticsearchServiceRoleCommandError = async (output, context) => {
@@ -1583,7 +1337,6 @@ const deserializeAws_restJson1DeleteElasticsearchServiceRoleCommandError = async
1583
1337
  ...output,
1584
1338
  body: await parseBody(output.body, context),
1585
1339
  };
1586
- let response;
1587
1340
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1588
1341
  switch (errorCode) {
1589
1342
  case "BaseException":
@@ -1597,29 +1350,26 @@ const deserializeAws_restJson1DeleteElasticsearchServiceRoleCommandError = async
1597
1350
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1598
1351
  default:
1599
1352
  const parsedBody = parsedOutput.body;
1600
- const $metadata = deserializeMetadata(output);
1601
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1602
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1603
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1604
- $fault: "client",
1605
- $metadata,
1353
+ (0, smithy_client_1.throwDefaultError)({
1354
+ output,
1355
+ parsedBody,
1356
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1357
+ errorCode,
1606
1358
  });
1607
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1608
1359
  }
1609
1360
  };
1610
1361
  const deserializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommand = async (output, context) => {
1611
1362
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1612
1363
  return deserializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommandError(output, context);
1613
1364
  }
1614
- const contents = {
1365
+ const contents = map({
1615
1366
  $metadata: deserializeMetadata(output),
1616
- CrossClusterSearchConnection: undefined,
1617
- };
1367
+ });
1618
1368
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1619
- if (data.CrossClusterSearchConnection !== undefined && data.CrossClusterSearchConnection !== null) {
1369
+ if (data.CrossClusterSearchConnection != null) {
1620
1370
  contents.CrossClusterSearchConnection = deserializeAws_restJson1InboundCrossClusterSearchConnection(data.CrossClusterSearchConnection, context);
1621
1371
  }
1622
- return Promise.resolve(contents);
1372
+ return contents;
1623
1373
  };
1624
1374
  exports.deserializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommand = deserializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommand;
1625
1375
  const deserializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommandError = async (output, context) => {
@@ -1627,7 +1377,6 @@ const deserializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommandEr
1627
1377
  ...output,
1628
1378
  body: await parseBody(output.body, context),
1629
1379
  };
1630
- let response;
1631
1380
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1632
1381
  switch (errorCode) {
1633
1382
  case "DisabledOperationException":
@@ -1638,29 +1387,26 @@ const deserializeAws_restJson1DeleteInboundCrossClusterSearchConnectionCommandEr
1638
1387
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1639
1388
  default:
1640
1389
  const parsedBody = parsedOutput.body;
1641
- const $metadata = deserializeMetadata(output);
1642
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1643
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1644
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1645
- $fault: "client",
1646
- $metadata,
1390
+ (0, smithy_client_1.throwDefaultError)({
1391
+ output,
1392
+ parsedBody,
1393
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1394
+ errorCode,
1647
1395
  });
1648
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1649
1396
  }
1650
1397
  };
1651
1398
  const deserializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommand = async (output, context) => {
1652
1399
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1653
1400
  return deserializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommandError(output, context);
1654
1401
  }
1655
- const contents = {
1402
+ const contents = map({
1656
1403
  $metadata: deserializeMetadata(output),
1657
- CrossClusterSearchConnection: undefined,
1658
- };
1404
+ });
1659
1405
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1660
- if (data.CrossClusterSearchConnection !== undefined && data.CrossClusterSearchConnection !== null) {
1406
+ if (data.CrossClusterSearchConnection != null) {
1661
1407
  contents.CrossClusterSearchConnection = deserializeAws_restJson1OutboundCrossClusterSearchConnection(data.CrossClusterSearchConnection, context);
1662
1408
  }
1663
- return Promise.resolve(contents);
1409
+ return contents;
1664
1410
  };
1665
1411
  exports.deserializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommand = deserializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommand;
1666
1412
  const deserializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommandError = async (output, context) => {
@@ -1668,7 +1414,6 @@ const deserializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommandE
1668
1414
  ...output,
1669
1415
  body: await parseBody(output.body, context),
1670
1416
  };
1671
- let response;
1672
1417
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1673
1418
  switch (errorCode) {
1674
1419
  case "DisabledOperationException":
@@ -1679,29 +1424,26 @@ const deserializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCommandE
1679
1424
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1680
1425
  default:
1681
1426
  const parsedBody = parsedOutput.body;
1682
- const $metadata = deserializeMetadata(output);
1683
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1684
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1685
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1686
- $fault: "client",
1687
- $metadata,
1427
+ (0, smithy_client_1.throwDefaultError)({
1428
+ output,
1429
+ parsedBody,
1430
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1431
+ errorCode,
1688
1432
  });
1689
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1690
1433
  }
1691
1434
  };
1692
1435
  const deserializeAws_restJson1DeletePackageCommand = async (output, context) => {
1693
1436
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1694
1437
  return deserializeAws_restJson1DeletePackageCommandError(output, context);
1695
1438
  }
1696
- const contents = {
1439
+ const contents = map({
1697
1440
  $metadata: deserializeMetadata(output),
1698
- PackageDetails: undefined,
1699
- };
1441
+ });
1700
1442
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1701
- if (data.PackageDetails !== undefined && data.PackageDetails !== null) {
1443
+ if (data.PackageDetails != null) {
1702
1444
  contents.PackageDetails = deserializeAws_restJson1PackageDetails(data.PackageDetails, context);
1703
1445
  }
1704
- return Promise.resolve(contents);
1446
+ return contents;
1705
1447
  };
1706
1448
  exports.deserializeAws_restJson1DeletePackageCommand = deserializeAws_restJson1DeletePackageCommand;
1707
1449
  const deserializeAws_restJson1DeletePackageCommandError = async (output, context) => {
@@ -1709,7 +1451,6 @@ const deserializeAws_restJson1DeletePackageCommandError = async (output, context
1709
1451
  ...output,
1710
1452
  body: await parseBody(output.body, context),
1711
1453
  };
1712
- let response;
1713
1454
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1714
1455
  switch (errorCode) {
1715
1456
  case "AccessDeniedException":
@@ -1732,33 +1473,29 @@ const deserializeAws_restJson1DeletePackageCommandError = async (output, context
1732
1473
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1733
1474
  default:
1734
1475
  const parsedBody = parsedOutput.body;
1735
- const $metadata = deserializeMetadata(output);
1736
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1737
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1738
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1739
- $fault: "client",
1740
- $metadata,
1476
+ (0, smithy_client_1.throwDefaultError)({
1477
+ output,
1478
+ parsedBody,
1479
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1480
+ errorCode,
1741
1481
  });
1742
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1743
1482
  }
1744
1483
  };
1745
1484
  const deserializeAws_restJson1DescribeDomainAutoTunesCommand = async (output, context) => {
1746
1485
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1747
1486
  return deserializeAws_restJson1DescribeDomainAutoTunesCommandError(output, context);
1748
1487
  }
1749
- const contents = {
1488
+ const contents = map({
1750
1489
  $metadata: deserializeMetadata(output),
1751
- AutoTunes: undefined,
1752
- NextToken: undefined,
1753
- };
1490
+ });
1754
1491
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1755
- if (data.AutoTunes !== undefined && data.AutoTunes !== null) {
1492
+ if (data.AutoTunes != null) {
1756
1493
  contents.AutoTunes = deserializeAws_restJson1AutoTuneList(data.AutoTunes, context);
1757
1494
  }
1758
- if (data.NextToken !== undefined && data.NextToken !== null) {
1495
+ if (data.NextToken != null) {
1759
1496
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1760
1497
  }
1761
- return Promise.resolve(contents);
1498
+ return contents;
1762
1499
  };
1763
1500
  exports.deserializeAws_restJson1DescribeDomainAutoTunesCommand = deserializeAws_restJson1DescribeDomainAutoTunesCommand;
1764
1501
  const deserializeAws_restJson1DescribeDomainAutoTunesCommandError = async (output, context) => {
@@ -1766,7 +1503,6 @@ const deserializeAws_restJson1DescribeDomainAutoTunesCommandError = async (outpu
1766
1503
  ...output,
1767
1504
  body: await parseBody(output.body, context),
1768
1505
  };
1769
- let response;
1770
1506
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1771
1507
  switch (errorCode) {
1772
1508
  case "BaseException":
@@ -1783,29 +1519,26 @@ const deserializeAws_restJson1DescribeDomainAutoTunesCommandError = async (outpu
1783
1519
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1784
1520
  default:
1785
1521
  const parsedBody = parsedOutput.body;
1786
- const $metadata = deserializeMetadata(output);
1787
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1788
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1789
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1790
- $fault: "client",
1791
- $metadata,
1522
+ (0, smithy_client_1.throwDefaultError)({
1523
+ output,
1524
+ parsedBody,
1525
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1526
+ errorCode,
1792
1527
  });
1793
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1794
1528
  }
1795
1529
  };
1796
1530
  const deserializeAws_restJson1DescribeDomainChangeProgressCommand = async (output, context) => {
1797
1531
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1798
1532
  return deserializeAws_restJson1DescribeDomainChangeProgressCommandError(output, context);
1799
1533
  }
1800
- const contents = {
1534
+ const contents = map({
1801
1535
  $metadata: deserializeMetadata(output),
1802
- ChangeProgressStatus: undefined,
1803
- };
1536
+ });
1804
1537
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1805
- if (data.ChangeProgressStatus !== undefined && data.ChangeProgressStatus !== null) {
1538
+ if (data.ChangeProgressStatus != null) {
1806
1539
  contents.ChangeProgressStatus = deserializeAws_restJson1ChangeProgressStatusDetails(data.ChangeProgressStatus, context);
1807
1540
  }
1808
- return Promise.resolve(contents);
1541
+ return contents;
1809
1542
  };
1810
1543
  exports.deserializeAws_restJson1DescribeDomainChangeProgressCommand = deserializeAws_restJson1DescribeDomainChangeProgressCommand;
1811
1544
  const deserializeAws_restJson1DescribeDomainChangeProgressCommandError = async (output, context) => {
@@ -1813,7 +1546,6 @@ const deserializeAws_restJson1DescribeDomainChangeProgressCommandError = async (
1813
1546
  ...output,
1814
1547
  body: await parseBody(output.body, context),
1815
1548
  };
1816
- let response;
1817
1549
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1818
1550
  switch (errorCode) {
1819
1551
  case "BaseException":
@@ -1830,29 +1562,26 @@ const deserializeAws_restJson1DescribeDomainChangeProgressCommandError = async (
1830
1562
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1831
1563
  default:
1832
1564
  const parsedBody = parsedOutput.body;
1833
- const $metadata = deserializeMetadata(output);
1834
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1835
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1836
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1837
- $fault: "client",
1838
- $metadata,
1565
+ (0, smithy_client_1.throwDefaultError)({
1566
+ output,
1567
+ parsedBody,
1568
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1569
+ errorCode,
1839
1570
  });
1840
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1841
1571
  }
1842
1572
  };
1843
1573
  const deserializeAws_restJson1DescribeElasticsearchDomainCommand = async (output, context) => {
1844
1574
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1845
1575
  return deserializeAws_restJson1DescribeElasticsearchDomainCommandError(output, context);
1846
1576
  }
1847
- const contents = {
1577
+ const contents = map({
1848
1578
  $metadata: deserializeMetadata(output),
1849
- DomainStatus: undefined,
1850
- };
1579
+ });
1851
1580
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1852
- if (data.DomainStatus !== undefined && data.DomainStatus !== null) {
1581
+ if (data.DomainStatus != null) {
1853
1582
  contents.DomainStatus = deserializeAws_restJson1ElasticsearchDomainStatus(data.DomainStatus, context);
1854
1583
  }
1855
- return Promise.resolve(contents);
1584
+ return contents;
1856
1585
  };
1857
1586
  exports.deserializeAws_restJson1DescribeElasticsearchDomainCommand = deserializeAws_restJson1DescribeElasticsearchDomainCommand;
1858
1587
  const deserializeAws_restJson1DescribeElasticsearchDomainCommandError = async (output, context) => {
@@ -1860,7 +1589,6 @@ const deserializeAws_restJson1DescribeElasticsearchDomainCommandError = async (o
1860
1589
  ...output,
1861
1590
  body: await parseBody(output.body, context),
1862
1591
  };
1863
- let response;
1864
1592
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1865
1593
  switch (errorCode) {
1866
1594
  case "BaseException":
@@ -1877,29 +1605,26 @@ const deserializeAws_restJson1DescribeElasticsearchDomainCommandError = async (o
1877
1605
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1878
1606
  default:
1879
1607
  const parsedBody = parsedOutput.body;
1880
- const $metadata = deserializeMetadata(output);
1881
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1882
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1883
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1884
- $fault: "client",
1885
- $metadata,
1608
+ (0, smithy_client_1.throwDefaultError)({
1609
+ output,
1610
+ parsedBody,
1611
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1612
+ errorCode,
1886
1613
  });
1887
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1888
1614
  }
1889
1615
  };
1890
1616
  const deserializeAws_restJson1DescribeElasticsearchDomainConfigCommand = async (output, context) => {
1891
1617
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1892
1618
  return deserializeAws_restJson1DescribeElasticsearchDomainConfigCommandError(output, context);
1893
1619
  }
1894
- const contents = {
1620
+ const contents = map({
1895
1621
  $metadata: deserializeMetadata(output),
1896
- DomainConfig: undefined,
1897
- };
1622
+ });
1898
1623
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1899
- if (data.DomainConfig !== undefined && data.DomainConfig !== null) {
1624
+ if (data.DomainConfig != null) {
1900
1625
  contents.DomainConfig = deserializeAws_restJson1ElasticsearchDomainConfig(data.DomainConfig, context);
1901
1626
  }
1902
- return Promise.resolve(contents);
1627
+ return contents;
1903
1628
  };
1904
1629
  exports.deserializeAws_restJson1DescribeElasticsearchDomainConfigCommand = deserializeAws_restJson1DescribeElasticsearchDomainConfigCommand;
1905
1630
  const deserializeAws_restJson1DescribeElasticsearchDomainConfigCommandError = async (output, context) => {
@@ -1907,7 +1632,6 @@ const deserializeAws_restJson1DescribeElasticsearchDomainConfigCommandError = as
1907
1632
  ...output,
1908
1633
  body: await parseBody(output.body, context),
1909
1634
  };
1910
- let response;
1911
1635
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1912
1636
  switch (errorCode) {
1913
1637
  case "BaseException":
@@ -1924,29 +1648,26 @@ const deserializeAws_restJson1DescribeElasticsearchDomainConfigCommandError = as
1924
1648
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1925
1649
  default:
1926
1650
  const parsedBody = parsedOutput.body;
1927
- const $metadata = deserializeMetadata(output);
1928
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1929
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1930
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1931
- $fault: "client",
1932
- $metadata,
1651
+ (0, smithy_client_1.throwDefaultError)({
1652
+ output,
1653
+ parsedBody,
1654
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1655
+ errorCode,
1933
1656
  });
1934
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1935
1657
  }
1936
1658
  };
1937
1659
  const deserializeAws_restJson1DescribeElasticsearchDomainsCommand = async (output, context) => {
1938
1660
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1939
1661
  return deserializeAws_restJson1DescribeElasticsearchDomainsCommandError(output, context);
1940
1662
  }
1941
- const contents = {
1663
+ const contents = map({
1942
1664
  $metadata: deserializeMetadata(output),
1943
- DomainStatusList: undefined,
1944
- };
1665
+ });
1945
1666
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1946
- if (data.DomainStatusList !== undefined && data.DomainStatusList !== null) {
1667
+ if (data.DomainStatusList != null) {
1947
1668
  contents.DomainStatusList = deserializeAws_restJson1ElasticsearchDomainStatusList(data.DomainStatusList, context);
1948
1669
  }
1949
- return Promise.resolve(contents);
1670
+ return contents;
1950
1671
  };
1951
1672
  exports.deserializeAws_restJson1DescribeElasticsearchDomainsCommand = deserializeAws_restJson1DescribeElasticsearchDomainsCommand;
1952
1673
  const deserializeAws_restJson1DescribeElasticsearchDomainsCommandError = async (output, context) => {
@@ -1954,7 +1675,6 @@ const deserializeAws_restJson1DescribeElasticsearchDomainsCommandError = async (
1954
1675
  ...output,
1955
1676
  body: await parseBody(output.body, context),
1956
1677
  };
1957
- let response;
1958
1678
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1959
1679
  switch (errorCode) {
1960
1680
  case "BaseException":
@@ -1968,29 +1688,26 @@ const deserializeAws_restJson1DescribeElasticsearchDomainsCommandError = async (
1968
1688
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1969
1689
  default:
1970
1690
  const parsedBody = parsedOutput.body;
1971
- const $metadata = deserializeMetadata(output);
1972
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1973
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
1974
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1975
- $fault: "client",
1976
- $metadata,
1691
+ (0, smithy_client_1.throwDefaultError)({
1692
+ output,
1693
+ parsedBody,
1694
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1695
+ errorCode,
1977
1696
  });
1978
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1979
1697
  }
1980
1698
  };
1981
1699
  const deserializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommand = async (output, context) => {
1982
1700
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1983
1701
  return deserializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommandError(output, context);
1984
1702
  }
1985
- const contents = {
1703
+ const contents = map({
1986
1704
  $metadata: deserializeMetadata(output),
1987
- LimitsByRole: undefined,
1988
- };
1705
+ });
1989
1706
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1990
- if (data.LimitsByRole !== undefined && data.LimitsByRole !== null) {
1707
+ if (data.LimitsByRole != null) {
1991
1708
  contents.LimitsByRole = deserializeAws_restJson1LimitsByRole(data.LimitsByRole, context);
1992
1709
  }
1993
- return Promise.resolve(contents);
1710
+ return contents;
1994
1711
  };
1995
1712
  exports.deserializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommand = deserializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommand;
1996
1713
  const deserializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommandError = async (output, context) => {
@@ -1998,7 +1715,6 @@ const deserializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommandErro
1998
1715
  ...output,
1999
1716
  body: await parseBody(output.body, context),
2000
1717
  };
2001
- let response;
2002
1718
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2003
1719
  switch (errorCode) {
2004
1720
  case "BaseException":
@@ -2021,33 +1737,29 @@ const deserializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsCommandErro
2021
1737
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2022
1738
  default:
2023
1739
  const parsedBody = parsedOutput.body;
2024
- const $metadata = deserializeMetadata(output);
2025
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2026
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2027
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2028
- $fault: "client",
2029
- $metadata,
1740
+ (0, smithy_client_1.throwDefaultError)({
1741
+ output,
1742
+ parsedBody,
1743
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1744
+ errorCode,
2030
1745
  });
2031
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2032
1746
  }
2033
1747
  };
2034
1748
  const deserializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsCommand = async (output, context) => {
2035
1749
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2036
1750
  return deserializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsCommandError(output, context);
2037
1751
  }
2038
- const contents = {
1752
+ const contents = map({
2039
1753
  $metadata: deserializeMetadata(output),
2040
- CrossClusterSearchConnections: undefined,
2041
- NextToken: undefined,
2042
- };
1754
+ });
2043
1755
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2044
- if (data.CrossClusterSearchConnections !== undefined && data.CrossClusterSearchConnections !== null) {
1756
+ if (data.CrossClusterSearchConnections != null) {
2045
1757
  contents.CrossClusterSearchConnections = deserializeAws_restJson1InboundCrossClusterSearchConnections(data.CrossClusterSearchConnections, context);
2046
1758
  }
2047
- if (data.NextToken !== undefined && data.NextToken !== null) {
1759
+ if (data.NextToken != null) {
2048
1760
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2049
1761
  }
2050
- return Promise.resolve(contents);
1762
+ return contents;
2051
1763
  };
2052
1764
  exports.deserializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsCommand = deserializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsCommand;
2053
1765
  const deserializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsCommandError = async (output, context) => {
@@ -2055,7 +1767,6 @@ const deserializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsComman
2055
1767
  ...output,
2056
1768
  body: await parseBody(output.body, context),
2057
1769
  };
2058
- let response;
2059
1770
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2060
1771
  switch (errorCode) {
2061
1772
  case "DisabledOperationException":
@@ -2066,33 +1777,29 @@ const deserializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsComman
2066
1777
  throw await deserializeAws_restJson1InvalidPaginationTokenExceptionResponse(parsedOutput, context);
2067
1778
  default:
2068
1779
  const parsedBody = parsedOutput.body;
2069
- const $metadata = deserializeMetadata(output);
2070
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2071
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2072
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2073
- $fault: "client",
2074
- $metadata,
1780
+ (0, smithy_client_1.throwDefaultError)({
1781
+ output,
1782
+ parsedBody,
1783
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1784
+ errorCode,
2075
1785
  });
2076
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2077
1786
  }
2078
1787
  };
2079
1788
  const deserializeAws_restJson1DescribeOutboundCrossClusterSearchConnectionsCommand = async (output, context) => {
2080
1789
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2081
1790
  return deserializeAws_restJson1DescribeOutboundCrossClusterSearchConnectionsCommandError(output, context);
2082
1791
  }
2083
- const contents = {
1792
+ const contents = map({
2084
1793
  $metadata: deserializeMetadata(output),
2085
- CrossClusterSearchConnections: undefined,
2086
- NextToken: undefined,
2087
- };
1794
+ });
2088
1795
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2089
- if (data.CrossClusterSearchConnections !== undefined && data.CrossClusterSearchConnections !== null) {
1796
+ if (data.CrossClusterSearchConnections != null) {
2090
1797
  contents.CrossClusterSearchConnections = deserializeAws_restJson1OutboundCrossClusterSearchConnections(data.CrossClusterSearchConnections, context);
2091
1798
  }
2092
- if (data.NextToken !== undefined && data.NextToken !== null) {
1799
+ if (data.NextToken != null) {
2093
1800
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2094
1801
  }
2095
- return Promise.resolve(contents);
1802
+ return contents;
2096
1803
  };
2097
1804
  exports.deserializeAws_restJson1DescribeOutboundCrossClusterSearchConnectionsCommand = deserializeAws_restJson1DescribeOutboundCrossClusterSearchConnectionsCommand;
2098
1805
  const deserializeAws_restJson1DescribeOutboundCrossClusterSearchConnectionsCommandError = async (output, context) => {
@@ -2100,7 +1807,6 @@ const deserializeAws_restJson1DescribeOutboundCrossClusterSearchConnectionsComma
2100
1807
  ...output,
2101
1808
  body: await parseBody(output.body, context),
2102
1809
  };
2103
- let response;
2104
1810
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2105
1811
  switch (errorCode) {
2106
1812
  case "DisabledOperationException":
@@ -2111,33 +1817,29 @@ const deserializeAws_restJson1DescribeOutboundCrossClusterSearchConnectionsComma
2111
1817
  throw await deserializeAws_restJson1InvalidPaginationTokenExceptionResponse(parsedOutput, context);
2112
1818
  default:
2113
1819
  const parsedBody = parsedOutput.body;
2114
- const $metadata = deserializeMetadata(output);
2115
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2116
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2117
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2118
- $fault: "client",
2119
- $metadata,
1820
+ (0, smithy_client_1.throwDefaultError)({
1821
+ output,
1822
+ parsedBody,
1823
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1824
+ errorCode,
2120
1825
  });
2121
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2122
1826
  }
2123
1827
  };
2124
1828
  const deserializeAws_restJson1DescribePackagesCommand = async (output, context) => {
2125
1829
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2126
1830
  return deserializeAws_restJson1DescribePackagesCommandError(output, context);
2127
1831
  }
2128
- const contents = {
1832
+ const contents = map({
2129
1833
  $metadata: deserializeMetadata(output),
2130
- NextToken: undefined,
2131
- PackageDetailsList: undefined,
2132
- };
1834
+ });
2133
1835
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2134
- if (data.NextToken !== undefined && data.NextToken !== null) {
1836
+ if (data.NextToken != null) {
2135
1837
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2136
1838
  }
2137
- if (data.PackageDetailsList !== undefined && data.PackageDetailsList !== null) {
1839
+ if (data.PackageDetailsList != null) {
2138
1840
  contents.PackageDetailsList = deserializeAws_restJson1PackageDetailsList(data.PackageDetailsList, context);
2139
1841
  }
2140
- return Promise.resolve(contents);
1842
+ return contents;
2141
1843
  };
2142
1844
  exports.deserializeAws_restJson1DescribePackagesCommand = deserializeAws_restJson1DescribePackagesCommand;
2143
1845
  const deserializeAws_restJson1DescribePackagesCommandError = async (output, context) => {
@@ -2145,7 +1847,6 @@ const deserializeAws_restJson1DescribePackagesCommandError = async (output, cont
2145
1847
  ...output,
2146
1848
  body: await parseBody(output.body, context),
2147
1849
  };
2148
- let response;
2149
1850
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2150
1851
  switch (errorCode) {
2151
1852
  case "AccessDeniedException":
@@ -2165,34 +1866,29 @@ const deserializeAws_restJson1DescribePackagesCommandError = async (output, cont
2165
1866
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2166
1867
  default:
2167
1868
  const parsedBody = parsedOutput.body;
2168
- const $metadata = deserializeMetadata(output);
2169
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2170
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2171
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2172
- $fault: "client",
2173
- $metadata,
1869
+ (0, smithy_client_1.throwDefaultError)({
1870
+ output,
1871
+ parsedBody,
1872
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1873
+ errorCode,
2174
1874
  });
2175
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2176
1875
  }
2177
1876
  };
2178
1877
  const deserializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsCommand = async (output, context) => {
2179
1878
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2180
1879
  return deserializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsCommandError(output, context);
2181
1880
  }
2182
- const contents = {
1881
+ const contents = map({
2183
1882
  $metadata: deserializeMetadata(output),
2184
- NextToken: undefined,
2185
- ReservedElasticsearchInstanceOfferings: undefined,
2186
- };
1883
+ });
2187
1884
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2188
- if (data.NextToken !== undefined && data.NextToken !== null) {
1885
+ if (data.NextToken != null) {
2189
1886
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2190
1887
  }
2191
- if (data.ReservedElasticsearchInstanceOfferings !== undefined &&
2192
- data.ReservedElasticsearchInstanceOfferings !== null) {
1888
+ if (data.ReservedElasticsearchInstanceOfferings != null) {
2193
1889
  contents.ReservedElasticsearchInstanceOfferings = deserializeAws_restJson1ReservedElasticsearchInstanceOfferingList(data.ReservedElasticsearchInstanceOfferings, context);
2194
1890
  }
2195
- return Promise.resolve(contents);
1891
+ return contents;
2196
1892
  };
2197
1893
  exports.deserializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsCommand = deserializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsCommand;
2198
1894
  const deserializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsCommandError = async (output, context) => {
@@ -2200,7 +1896,6 @@ const deserializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsComm
2200
1896
  ...output,
2201
1897
  body: await parseBody(output.body, context),
2202
1898
  };
2203
- let response;
2204
1899
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2205
1900
  switch (errorCode) {
2206
1901
  case "DisabledOperationException":
@@ -2217,33 +1912,29 @@ const deserializeAws_restJson1DescribeReservedElasticsearchInstanceOfferingsComm
2217
1912
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2218
1913
  default:
2219
1914
  const parsedBody = parsedOutput.body;
2220
- const $metadata = deserializeMetadata(output);
2221
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2222
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2223
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2224
- $fault: "client",
2225
- $metadata,
1915
+ (0, smithy_client_1.throwDefaultError)({
1916
+ output,
1917
+ parsedBody,
1918
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1919
+ errorCode,
2226
1920
  });
2227
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2228
1921
  }
2229
1922
  };
2230
1923
  const deserializeAws_restJson1DescribeReservedElasticsearchInstancesCommand = async (output, context) => {
2231
1924
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2232
1925
  return deserializeAws_restJson1DescribeReservedElasticsearchInstancesCommandError(output, context);
2233
1926
  }
2234
- const contents = {
1927
+ const contents = map({
2235
1928
  $metadata: deserializeMetadata(output),
2236
- NextToken: undefined,
2237
- ReservedElasticsearchInstances: undefined,
2238
- };
1929
+ });
2239
1930
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2240
- if (data.NextToken !== undefined && data.NextToken !== null) {
1931
+ if (data.NextToken != null) {
2241
1932
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2242
1933
  }
2243
- if (data.ReservedElasticsearchInstances !== undefined && data.ReservedElasticsearchInstances !== null) {
1934
+ if (data.ReservedElasticsearchInstances != null) {
2244
1935
  contents.ReservedElasticsearchInstances = deserializeAws_restJson1ReservedElasticsearchInstanceList(data.ReservedElasticsearchInstances, context);
2245
1936
  }
2246
- return Promise.resolve(contents);
1937
+ return contents;
2247
1938
  };
2248
1939
  exports.deserializeAws_restJson1DescribeReservedElasticsearchInstancesCommand = deserializeAws_restJson1DescribeReservedElasticsearchInstancesCommand;
2249
1940
  const deserializeAws_restJson1DescribeReservedElasticsearchInstancesCommandError = async (output, context) => {
@@ -2251,7 +1942,6 @@ const deserializeAws_restJson1DescribeReservedElasticsearchInstancesCommandError
2251
1942
  ...output,
2252
1943
  body: await parseBody(output.body, context),
2253
1944
  };
2254
- let response;
2255
1945
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2256
1946
  switch (errorCode) {
2257
1947
  case "DisabledOperationException":
@@ -2268,29 +1958,26 @@ const deserializeAws_restJson1DescribeReservedElasticsearchInstancesCommandError
2268
1958
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2269
1959
  default:
2270
1960
  const parsedBody = parsedOutput.body;
2271
- const $metadata = deserializeMetadata(output);
2272
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2273
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2274
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2275
- $fault: "client",
2276
- $metadata,
1961
+ (0, smithy_client_1.throwDefaultError)({
1962
+ output,
1963
+ parsedBody,
1964
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
1965
+ errorCode,
2277
1966
  });
2278
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2279
1967
  }
2280
1968
  };
2281
1969
  const deserializeAws_restJson1DissociatePackageCommand = async (output, context) => {
2282
1970
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2283
1971
  return deserializeAws_restJson1DissociatePackageCommandError(output, context);
2284
1972
  }
2285
- const contents = {
1973
+ const contents = map({
2286
1974
  $metadata: deserializeMetadata(output),
2287
- DomainPackageDetails: undefined,
2288
- };
1975
+ });
2289
1976
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2290
- if (data.DomainPackageDetails !== undefined && data.DomainPackageDetails !== null) {
1977
+ if (data.DomainPackageDetails != null) {
2291
1978
  contents.DomainPackageDetails = deserializeAws_restJson1DomainPackageDetails(data.DomainPackageDetails, context);
2292
1979
  }
2293
- return Promise.resolve(contents);
1980
+ return contents;
2294
1981
  };
2295
1982
  exports.deserializeAws_restJson1DissociatePackageCommand = deserializeAws_restJson1DissociatePackageCommand;
2296
1983
  const deserializeAws_restJson1DissociatePackageCommandError = async (output, context) => {
@@ -2298,7 +1985,6 @@ const deserializeAws_restJson1DissociatePackageCommandError = async (output, con
2298
1985
  ...output,
2299
1986
  body: await parseBody(output.body, context),
2300
1987
  };
2301
- let response;
2302
1988
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2303
1989
  switch (errorCode) {
2304
1990
  case "AccessDeniedException":
@@ -2321,29 +2007,26 @@ const deserializeAws_restJson1DissociatePackageCommandError = async (output, con
2321
2007
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2322
2008
  default:
2323
2009
  const parsedBody = parsedOutput.body;
2324
- const $metadata = deserializeMetadata(output);
2325
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2326
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2327
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2328
- $fault: "client",
2329
- $metadata,
2010
+ (0, smithy_client_1.throwDefaultError)({
2011
+ output,
2012
+ parsedBody,
2013
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2014
+ errorCode,
2330
2015
  });
2331
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2332
2016
  }
2333
2017
  };
2334
2018
  const deserializeAws_restJson1GetCompatibleElasticsearchVersionsCommand = async (output, context) => {
2335
2019
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2336
2020
  return deserializeAws_restJson1GetCompatibleElasticsearchVersionsCommandError(output, context);
2337
2021
  }
2338
- const contents = {
2022
+ const contents = map({
2339
2023
  $metadata: deserializeMetadata(output),
2340
- CompatibleElasticsearchVersions: undefined,
2341
- };
2024
+ });
2342
2025
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2343
- if (data.CompatibleElasticsearchVersions !== undefined && data.CompatibleElasticsearchVersions !== null) {
2026
+ if (data.CompatibleElasticsearchVersions != null) {
2344
2027
  contents.CompatibleElasticsearchVersions = deserializeAws_restJson1CompatibleElasticsearchVersionsList(data.CompatibleElasticsearchVersions, context);
2345
2028
  }
2346
- return Promise.resolve(contents);
2029
+ return contents;
2347
2030
  };
2348
2031
  exports.deserializeAws_restJson1GetCompatibleElasticsearchVersionsCommand = deserializeAws_restJson1GetCompatibleElasticsearchVersionsCommand;
2349
2032
  const deserializeAws_restJson1GetCompatibleElasticsearchVersionsCommandError = async (output, context) => {
@@ -2351,7 +2034,6 @@ const deserializeAws_restJson1GetCompatibleElasticsearchVersionsCommandError = a
2351
2034
  ...output,
2352
2035
  body: await parseBody(output.body, context),
2353
2036
  };
2354
- let response;
2355
2037
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2356
2038
  switch (errorCode) {
2357
2039
  case "BaseException":
@@ -2371,37 +2053,32 @@ const deserializeAws_restJson1GetCompatibleElasticsearchVersionsCommandError = a
2371
2053
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2372
2054
  default:
2373
2055
  const parsedBody = parsedOutput.body;
2374
- const $metadata = deserializeMetadata(output);
2375
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2376
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2377
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2378
- $fault: "client",
2379
- $metadata,
2056
+ (0, smithy_client_1.throwDefaultError)({
2057
+ output,
2058
+ parsedBody,
2059
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2060
+ errorCode,
2380
2061
  });
2381
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2382
2062
  }
2383
2063
  };
2384
2064
  const deserializeAws_restJson1GetPackageVersionHistoryCommand = async (output, context) => {
2385
2065
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2386
2066
  return deserializeAws_restJson1GetPackageVersionHistoryCommandError(output, context);
2387
2067
  }
2388
- const contents = {
2068
+ const contents = map({
2389
2069
  $metadata: deserializeMetadata(output),
2390
- NextToken: undefined,
2391
- PackageID: undefined,
2392
- PackageVersionHistoryList: undefined,
2393
- };
2070
+ });
2394
2071
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2395
- if (data.NextToken !== undefined && data.NextToken !== null) {
2072
+ if (data.NextToken != null) {
2396
2073
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2397
2074
  }
2398
- if (data.PackageID !== undefined && data.PackageID !== null) {
2075
+ if (data.PackageID != null) {
2399
2076
  contents.PackageID = (0, smithy_client_1.expectString)(data.PackageID);
2400
2077
  }
2401
- if (data.PackageVersionHistoryList !== undefined && data.PackageVersionHistoryList !== null) {
2078
+ if (data.PackageVersionHistoryList != null) {
2402
2079
  contents.PackageVersionHistoryList = deserializeAws_restJson1PackageVersionHistoryList(data.PackageVersionHistoryList, context);
2403
2080
  }
2404
- return Promise.resolve(contents);
2081
+ return contents;
2405
2082
  };
2406
2083
  exports.deserializeAws_restJson1GetPackageVersionHistoryCommand = deserializeAws_restJson1GetPackageVersionHistoryCommand;
2407
2084
  const deserializeAws_restJson1GetPackageVersionHistoryCommandError = async (output, context) => {
@@ -2409,7 +2086,6 @@ const deserializeAws_restJson1GetPackageVersionHistoryCommandError = async (outp
2409
2086
  ...output,
2410
2087
  body: await parseBody(output.body, context),
2411
2088
  };
2412
- let response;
2413
2089
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2414
2090
  switch (errorCode) {
2415
2091
  case "AccessDeniedException":
@@ -2429,33 +2105,29 @@ const deserializeAws_restJson1GetPackageVersionHistoryCommandError = async (outp
2429
2105
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2430
2106
  default:
2431
2107
  const parsedBody = parsedOutput.body;
2432
- const $metadata = deserializeMetadata(output);
2433
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2434
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2435
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2436
- $fault: "client",
2437
- $metadata,
2108
+ (0, smithy_client_1.throwDefaultError)({
2109
+ output,
2110
+ parsedBody,
2111
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2112
+ errorCode,
2438
2113
  });
2439
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2440
2114
  }
2441
2115
  };
2442
2116
  const deserializeAws_restJson1GetUpgradeHistoryCommand = async (output, context) => {
2443
2117
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2444
2118
  return deserializeAws_restJson1GetUpgradeHistoryCommandError(output, context);
2445
2119
  }
2446
- const contents = {
2120
+ const contents = map({
2447
2121
  $metadata: deserializeMetadata(output),
2448
- NextToken: undefined,
2449
- UpgradeHistories: undefined,
2450
- };
2122
+ });
2451
2123
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2452
- if (data.NextToken !== undefined && data.NextToken !== null) {
2124
+ if (data.NextToken != null) {
2453
2125
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2454
2126
  }
2455
- if (data.UpgradeHistories !== undefined && data.UpgradeHistories !== null) {
2127
+ if (data.UpgradeHistories != null) {
2456
2128
  contents.UpgradeHistories = deserializeAws_restJson1UpgradeHistoryList(data.UpgradeHistories, context);
2457
2129
  }
2458
- return Promise.resolve(contents);
2130
+ return contents;
2459
2131
  };
2460
2132
  exports.deserializeAws_restJson1GetUpgradeHistoryCommand = deserializeAws_restJson1GetUpgradeHistoryCommand;
2461
2133
  const deserializeAws_restJson1GetUpgradeHistoryCommandError = async (output, context) => {
@@ -2463,7 +2135,6 @@ const deserializeAws_restJson1GetUpgradeHistoryCommandError = async (output, con
2463
2135
  ...output,
2464
2136
  body: await parseBody(output.body, context),
2465
2137
  };
2466
- let response;
2467
2138
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2468
2139
  switch (errorCode) {
2469
2140
  case "BaseException":
@@ -2483,37 +2154,32 @@ const deserializeAws_restJson1GetUpgradeHistoryCommandError = async (output, con
2483
2154
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2484
2155
  default:
2485
2156
  const parsedBody = parsedOutput.body;
2486
- const $metadata = deserializeMetadata(output);
2487
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2488
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2489
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2490
- $fault: "client",
2491
- $metadata,
2157
+ (0, smithy_client_1.throwDefaultError)({
2158
+ output,
2159
+ parsedBody,
2160
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2161
+ errorCode,
2492
2162
  });
2493
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2494
2163
  }
2495
2164
  };
2496
2165
  const deserializeAws_restJson1GetUpgradeStatusCommand = async (output, context) => {
2497
2166
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2498
2167
  return deserializeAws_restJson1GetUpgradeStatusCommandError(output, context);
2499
2168
  }
2500
- const contents = {
2169
+ const contents = map({
2501
2170
  $metadata: deserializeMetadata(output),
2502
- StepStatus: undefined,
2503
- UpgradeName: undefined,
2504
- UpgradeStep: undefined,
2505
- };
2171
+ });
2506
2172
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2507
- if (data.StepStatus !== undefined && data.StepStatus !== null) {
2173
+ if (data.StepStatus != null) {
2508
2174
  contents.StepStatus = (0, smithy_client_1.expectString)(data.StepStatus);
2509
2175
  }
2510
- if (data.UpgradeName !== undefined && data.UpgradeName !== null) {
2176
+ if (data.UpgradeName != null) {
2511
2177
  contents.UpgradeName = (0, smithy_client_1.expectString)(data.UpgradeName);
2512
2178
  }
2513
- if (data.UpgradeStep !== undefined && data.UpgradeStep !== null) {
2179
+ if (data.UpgradeStep != null) {
2514
2180
  contents.UpgradeStep = (0, smithy_client_1.expectString)(data.UpgradeStep);
2515
2181
  }
2516
- return Promise.resolve(contents);
2182
+ return contents;
2517
2183
  };
2518
2184
  exports.deserializeAws_restJson1GetUpgradeStatusCommand = deserializeAws_restJson1GetUpgradeStatusCommand;
2519
2185
  const deserializeAws_restJson1GetUpgradeStatusCommandError = async (output, context) => {
@@ -2521,7 +2187,6 @@ const deserializeAws_restJson1GetUpgradeStatusCommandError = async (output, cont
2521
2187
  ...output,
2522
2188
  body: await parseBody(output.body, context),
2523
2189
  };
2524
- let response;
2525
2190
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2526
2191
  switch (errorCode) {
2527
2192
  case "BaseException":
@@ -2541,29 +2206,26 @@ const deserializeAws_restJson1GetUpgradeStatusCommandError = async (output, cont
2541
2206
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2542
2207
  default:
2543
2208
  const parsedBody = parsedOutput.body;
2544
- const $metadata = deserializeMetadata(output);
2545
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2546
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2547
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2548
- $fault: "client",
2549
- $metadata,
2209
+ (0, smithy_client_1.throwDefaultError)({
2210
+ output,
2211
+ parsedBody,
2212
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2213
+ errorCode,
2550
2214
  });
2551
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2552
2215
  }
2553
2216
  };
2554
2217
  const deserializeAws_restJson1ListDomainNamesCommand = async (output, context) => {
2555
2218
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2556
2219
  return deserializeAws_restJson1ListDomainNamesCommandError(output, context);
2557
2220
  }
2558
- const contents = {
2221
+ const contents = map({
2559
2222
  $metadata: deserializeMetadata(output),
2560
- DomainNames: undefined,
2561
- };
2223
+ });
2562
2224
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2563
- if (data.DomainNames !== undefined && data.DomainNames !== null) {
2225
+ if (data.DomainNames != null) {
2564
2226
  contents.DomainNames = deserializeAws_restJson1DomainInfoList(data.DomainNames, context);
2565
2227
  }
2566
- return Promise.resolve(contents);
2228
+ return contents;
2567
2229
  };
2568
2230
  exports.deserializeAws_restJson1ListDomainNamesCommand = deserializeAws_restJson1ListDomainNamesCommand;
2569
2231
  const deserializeAws_restJson1ListDomainNamesCommandError = async (output, context) => {
@@ -2571,7 +2233,6 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
2571
2233
  ...output,
2572
2234
  body: await parseBody(output.body, context),
2573
2235
  };
2574
- let response;
2575
2236
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2576
2237
  switch (errorCode) {
2577
2238
  case "BaseException":
@@ -2582,33 +2243,29 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
2582
2243
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2583
2244
  default:
2584
2245
  const parsedBody = parsedOutput.body;
2585
- const $metadata = deserializeMetadata(output);
2586
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2587
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2588
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2589
- $fault: "client",
2590
- $metadata,
2246
+ (0, smithy_client_1.throwDefaultError)({
2247
+ output,
2248
+ parsedBody,
2249
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2250
+ errorCode,
2591
2251
  });
2592
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2593
2252
  }
2594
2253
  };
2595
2254
  const deserializeAws_restJson1ListDomainsForPackageCommand = async (output, context) => {
2596
2255
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2597
2256
  return deserializeAws_restJson1ListDomainsForPackageCommandError(output, context);
2598
2257
  }
2599
- const contents = {
2258
+ const contents = map({
2600
2259
  $metadata: deserializeMetadata(output),
2601
- DomainPackageDetailsList: undefined,
2602
- NextToken: undefined,
2603
- };
2260
+ });
2604
2261
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2605
- if (data.DomainPackageDetailsList !== undefined && data.DomainPackageDetailsList !== null) {
2262
+ if (data.DomainPackageDetailsList != null) {
2606
2263
  contents.DomainPackageDetailsList = deserializeAws_restJson1DomainPackageDetailsList(data.DomainPackageDetailsList, context);
2607
2264
  }
2608
- if (data.NextToken !== undefined && data.NextToken !== null) {
2265
+ if (data.NextToken != null) {
2609
2266
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2610
2267
  }
2611
- return Promise.resolve(contents);
2268
+ return contents;
2612
2269
  };
2613
2270
  exports.deserializeAws_restJson1ListDomainsForPackageCommand = deserializeAws_restJson1ListDomainsForPackageCommand;
2614
2271
  const deserializeAws_restJson1ListDomainsForPackageCommandError = async (output, context) => {
@@ -2616,7 +2273,6 @@ const deserializeAws_restJson1ListDomainsForPackageCommandError = async (output,
2616
2273
  ...output,
2617
2274
  body: await parseBody(output.body, context),
2618
2275
  };
2619
- let response;
2620
2276
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2621
2277
  switch (errorCode) {
2622
2278
  case "AccessDeniedException":
@@ -2636,33 +2292,29 @@ const deserializeAws_restJson1ListDomainsForPackageCommandError = async (output,
2636
2292
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2637
2293
  default:
2638
2294
  const parsedBody = parsedOutput.body;
2639
- const $metadata = deserializeMetadata(output);
2640
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2641
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2642
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2643
- $fault: "client",
2644
- $metadata,
2295
+ (0, smithy_client_1.throwDefaultError)({
2296
+ output,
2297
+ parsedBody,
2298
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2299
+ errorCode,
2645
2300
  });
2646
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2647
2301
  }
2648
2302
  };
2649
2303
  const deserializeAws_restJson1ListElasticsearchInstanceTypesCommand = async (output, context) => {
2650
2304
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2651
2305
  return deserializeAws_restJson1ListElasticsearchInstanceTypesCommandError(output, context);
2652
2306
  }
2653
- const contents = {
2307
+ const contents = map({
2654
2308
  $metadata: deserializeMetadata(output),
2655
- ElasticsearchInstanceTypes: undefined,
2656
- NextToken: undefined,
2657
- };
2309
+ });
2658
2310
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2659
- if (data.ElasticsearchInstanceTypes !== undefined && data.ElasticsearchInstanceTypes !== null) {
2311
+ if (data.ElasticsearchInstanceTypes != null) {
2660
2312
  contents.ElasticsearchInstanceTypes = deserializeAws_restJson1ElasticsearchInstanceTypeList(data.ElasticsearchInstanceTypes, context);
2661
2313
  }
2662
- if (data.NextToken !== undefined && data.NextToken !== null) {
2314
+ if (data.NextToken != null) {
2663
2315
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2664
2316
  }
2665
- return Promise.resolve(contents);
2317
+ return contents;
2666
2318
  };
2667
2319
  exports.deserializeAws_restJson1ListElasticsearchInstanceTypesCommand = deserializeAws_restJson1ListElasticsearchInstanceTypesCommand;
2668
2320
  const deserializeAws_restJson1ListElasticsearchInstanceTypesCommandError = async (output, context) => {
@@ -2670,7 +2322,6 @@ const deserializeAws_restJson1ListElasticsearchInstanceTypesCommandError = async
2670
2322
  ...output,
2671
2323
  body: await parseBody(output.body, context),
2672
2324
  };
2673
- let response;
2674
2325
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2675
2326
  switch (errorCode) {
2676
2327
  case "BaseException":
@@ -2687,33 +2338,29 @@ const deserializeAws_restJson1ListElasticsearchInstanceTypesCommandError = async
2687
2338
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2688
2339
  default:
2689
2340
  const parsedBody = parsedOutput.body;
2690
- const $metadata = deserializeMetadata(output);
2691
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2692
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2693
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2694
- $fault: "client",
2695
- $metadata,
2341
+ (0, smithy_client_1.throwDefaultError)({
2342
+ output,
2343
+ parsedBody,
2344
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2345
+ errorCode,
2696
2346
  });
2697
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2698
2347
  }
2699
2348
  };
2700
2349
  const deserializeAws_restJson1ListElasticsearchVersionsCommand = async (output, context) => {
2701
2350
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2702
2351
  return deserializeAws_restJson1ListElasticsearchVersionsCommandError(output, context);
2703
2352
  }
2704
- const contents = {
2353
+ const contents = map({
2705
2354
  $metadata: deserializeMetadata(output),
2706
- ElasticsearchVersions: undefined,
2707
- NextToken: undefined,
2708
- };
2355
+ });
2709
2356
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2710
- if (data.ElasticsearchVersions !== undefined && data.ElasticsearchVersions !== null) {
2357
+ if (data.ElasticsearchVersions != null) {
2711
2358
  contents.ElasticsearchVersions = deserializeAws_restJson1ElasticsearchVersionList(data.ElasticsearchVersions, context);
2712
2359
  }
2713
- if (data.NextToken !== undefined && data.NextToken !== null) {
2360
+ if (data.NextToken != null) {
2714
2361
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2715
2362
  }
2716
- return Promise.resolve(contents);
2363
+ return contents;
2717
2364
  };
2718
2365
  exports.deserializeAws_restJson1ListElasticsearchVersionsCommand = deserializeAws_restJson1ListElasticsearchVersionsCommand;
2719
2366
  const deserializeAws_restJson1ListElasticsearchVersionsCommandError = async (output, context) => {
@@ -2721,7 +2368,6 @@ const deserializeAws_restJson1ListElasticsearchVersionsCommandError = async (out
2721
2368
  ...output,
2722
2369
  body: await parseBody(output.body, context),
2723
2370
  };
2724
- let response;
2725
2371
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2726
2372
  switch (errorCode) {
2727
2373
  case "BaseException":
@@ -2738,33 +2384,29 @@ const deserializeAws_restJson1ListElasticsearchVersionsCommandError = async (out
2738
2384
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2739
2385
  default:
2740
2386
  const parsedBody = parsedOutput.body;
2741
- const $metadata = deserializeMetadata(output);
2742
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2743
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2744
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2745
- $fault: "client",
2746
- $metadata,
2387
+ (0, smithy_client_1.throwDefaultError)({
2388
+ output,
2389
+ parsedBody,
2390
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2391
+ errorCode,
2747
2392
  });
2748
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2749
2393
  }
2750
2394
  };
2751
2395
  const deserializeAws_restJson1ListPackagesForDomainCommand = async (output, context) => {
2752
2396
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2753
2397
  return deserializeAws_restJson1ListPackagesForDomainCommandError(output, context);
2754
2398
  }
2755
- const contents = {
2399
+ const contents = map({
2756
2400
  $metadata: deserializeMetadata(output),
2757
- DomainPackageDetailsList: undefined,
2758
- NextToken: undefined,
2759
- };
2401
+ });
2760
2402
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2761
- if (data.DomainPackageDetailsList !== undefined && data.DomainPackageDetailsList !== null) {
2403
+ if (data.DomainPackageDetailsList != null) {
2762
2404
  contents.DomainPackageDetailsList = deserializeAws_restJson1DomainPackageDetailsList(data.DomainPackageDetailsList, context);
2763
2405
  }
2764
- if (data.NextToken !== undefined && data.NextToken !== null) {
2406
+ if (data.NextToken != null) {
2765
2407
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2766
2408
  }
2767
- return Promise.resolve(contents);
2409
+ return contents;
2768
2410
  };
2769
2411
  exports.deserializeAws_restJson1ListPackagesForDomainCommand = deserializeAws_restJson1ListPackagesForDomainCommand;
2770
2412
  const deserializeAws_restJson1ListPackagesForDomainCommandError = async (output, context) => {
@@ -2772,7 +2414,6 @@ const deserializeAws_restJson1ListPackagesForDomainCommandError = async (output,
2772
2414
  ...output,
2773
2415
  body: await parseBody(output.body, context),
2774
2416
  };
2775
- let response;
2776
2417
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2777
2418
  switch (errorCode) {
2778
2419
  case "AccessDeniedException":
@@ -2792,29 +2433,26 @@ const deserializeAws_restJson1ListPackagesForDomainCommandError = async (output,
2792
2433
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2793
2434
  default:
2794
2435
  const parsedBody = parsedOutput.body;
2795
- const $metadata = deserializeMetadata(output);
2796
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2797
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2798
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2799
- $fault: "client",
2800
- $metadata,
2436
+ (0, smithy_client_1.throwDefaultError)({
2437
+ output,
2438
+ parsedBody,
2439
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2440
+ errorCode,
2801
2441
  });
2802
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2803
2442
  }
2804
2443
  };
2805
2444
  const deserializeAws_restJson1ListTagsCommand = async (output, context) => {
2806
2445
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2807
2446
  return deserializeAws_restJson1ListTagsCommandError(output, context);
2808
2447
  }
2809
- const contents = {
2448
+ const contents = map({
2810
2449
  $metadata: deserializeMetadata(output),
2811
- TagList: undefined,
2812
- };
2450
+ });
2813
2451
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2814
- if (data.TagList !== undefined && data.TagList !== null) {
2452
+ if (data.TagList != null) {
2815
2453
  contents.TagList = deserializeAws_restJson1TagList(data.TagList, context);
2816
2454
  }
2817
- return Promise.resolve(contents);
2455
+ return contents;
2818
2456
  };
2819
2457
  exports.deserializeAws_restJson1ListTagsCommand = deserializeAws_restJson1ListTagsCommand;
2820
2458
  const deserializeAws_restJson1ListTagsCommandError = async (output, context) => {
@@ -2822,7 +2460,6 @@ const deserializeAws_restJson1ListTagsCommandError = async (output, context) =>
2822
2460
  ...output,
2823
2461
  body: await parseBody(output.body, context),
2824
2462
  };
2825
- let response;
2826
2463
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2827
2464
  switch (errorCode) {
2828
2465
  case "BaseException":
@@ -2839,33 +2476,29 @@ const deserializeAws_restJson1ListTagsCommandError = async (output, context) =>
2839
2476
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2840
2477
  default:
2841
2478
  const parsedBody = parsedOutput.body;
2842
- const $metadata = deserializeMetadata(output);
2843
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2844
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2845
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2846
- $fault: "client",
2847
- $metadata,
2479
+ (0, smithy_client_1.throwDefaultError)({
2480
+ output,
2481
+ parsedBody,
2482
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2483
+ errorCode,
2848
2484
  });
2849
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2850
2485
  }
2851
2486
  };
2852
2487
  const deserializeAws_restJson1PurchaseReservedElasticsearchInstanceOfferingCommand = async (output, context) => {
2853
2488
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2854
2489
  return deserializeAws_restJson1PurchaseReservedElasticsearchInstanceOfferingCommandError(output, context);
2855
2490
  }
2856
- const contents = {
2491
+ const contents = map({
2857
2492
  $metadata: deserializeMetadata(output),
2858
- ReservationName: undefined,
2859
- ReservedElasticsearchInstanceId: undefined,
2860
- };
2493
+ });
2861
2494
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2862
- if (data.ReservationName !== undefined && data.ReservationName !== null) {
2495
+ if (data.ReservationName != null) {
2863
2496
  contents.ReservationName = (0, smithy_client_1.expectString)(data.ReservationName);
2864
2497
  }
2865
- if (data.ReservedElasticsearchInstanceId !== undefined && data.ReservedElasticsearchInstanceId !== null) {
2498
+ if (data.ReservedElasticsearchInstanceId != null) {
2866
2499
  contents.ReservedElasticsearchInstanceId = (0, smithy_client_1.expectString)(data.ReservedElasticsearchInstanceId);
2867
2500
  }
2868
- return Promise.resolve(contents);
2501
+ return contents;
2869
2502
  };
2870
2503
  exports.deserializeAws_restJson1PurchaseReservedElasticsearchInstanceOfferingCommand = deserializeAws_restJson1PurchaseReservedElasticsearchInstanceOfferingCommand;
2871
2504
  const deserializeAws_restJson1PurchaseReservedElasticsearchInstanceOfferingCommandError = async (output, context) => {
@@ -2873,7 +2506,6 @@ const deserializeAws_restJson1PurchaseReservedElasticsearchInstanceOfferingComma
2873
2506
  ...output,
2874
2507
  body: await parseBody(output.body, context),
2875
2508
  };
2876
- let response;
2877
2509
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2878
2510
  switch (errorCode) {
2879
2511
  case "DisabledOperationException":
@@ -2896,29 +2528,26 @@ const deserializeAws_restJson1PurchaseReservedElasticsearchInstanceOfferingComma
2896
2528
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2897
2529
  default:
2898
2530
  const parsedBody = parsedOutput.body;
2899
- const $metadata = deserializeMetadata(output);
2900
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2901
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2902
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2903
- $fault: "client",
2904
- $metadata,
2531
+ (0, smithy_client_1.throwDefaultError)({
2532
+ output,
2533
+ parsedBody,
2534
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2535
+ errorCode,
2905
2536
  });
2906
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2907
2537
  }
2908
2538
  };
2909
2539
  const deserializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommand = async (output, context) => {
2910
2540
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2911
2541
  return deserializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommandError(output, context);
2912
2542
  }
2913
- const contents = {
2543
+ const contents = map({
2914
2544
  $metadata: deserializeMetadata(output),
2915
- CrossClusterSearchConnection: undefined,
2916
- };
2545
+ });
2917
2546
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2918
- if (data.CrossClusterSearchConnection !== undefined && data.CrossClusterSearchConnection !== null) {
2547
+ if (data.CrossClusterSearchConnection != null) {
2919
2548
  contents.CrossClusterSearchConnection = deserializeAws_restJson1InboundCrossClusterSearchConnection(data.CrossClusterSearchConnection, context);
2920
2549
  }
2921
- return Promise.resolve(contents);
2550
+ return contents;
2922
2551
  };
2923
2552
  exports.deserializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommand = deserializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommand;
2924
2553
  const deserializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommandError = async (output, context) => {
@@ -2926,7 +2555,6 @@ const deserializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommandEr
2926
2555
  ...output,
2927
2556
  body: await parseBody(output.body, context),
2928
2557
  };
2929
- let response;
2930
2558
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2931
2559
  switch (errorCode) {
2932
2560
  case "DisabledOperationException":
@@ -2937,25 +2565,23 @@ const deserializeAws_restJson1RejectInboundCrossClusterSearchConnectionCommandEr
2937
2565
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2938
2566
  default:
2939
2567
  const parsedBody = parsedOutput.body;
2940
- const $metadata = deserializeMetadata(output);
2941
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2942
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2943
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2944
- $fault: "client",
2945
- $metadata,
2568
+ (0, smithy_client_1.throwDefaultError)({
2569
+ output,
2570
+ parsedBody,
2571
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2572
+ errorCode,
2946
2573
  });
2947
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2948
2574
  }
2949
2575
  };
2950
2576
  const deserializeAws_restJson1RemoveTagsCommand = async (output, context) => {
2951
2577
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2952
2578
  return deserializeAws_restJson1RemoveTagsCommandError(output, context);
2953
2579
  }
2954
- const contents = {
2580
+ const contents = map({
2955
2581
  $metadata: deserializeMetadata(output),
2956
- };
2582
+ });
2957
2583
  await collectBody(output.body, context);
2958
- return Promise.resolve(contents);
2584
+ return contents;
2959
2585
  };
2960
2586
  exports.deserializeAws_restJson1RemoveTagsCommand = deserializeAws_restJson1RemoveTagsCommand;
2961
2587
  const deserializeAws_restJson1RemoveTagsCommandError = async (output, context) => {
@@ -2963,7 +2589,6 @@ const deserializeAws_restJson1RemoveTagsCommandError = async (output, context) =
2963
2589
  ...output,
2964
2590
  body: await parseBody(output.body, context),
2965
2591
  };
2966
- let response;
2967
2592
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2968
2593
  switch (errorCode) {
2969
2594
  case "BaseException":
@@ -2977,29 +2602,26 @@ const deserializeAws_restJson1RemoveTagsCommandError = async (output, context) =
2977
2602
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2978
2603
  default:
2979
2604
  const parsedBody = parsedOutput.body;
2980
- const $metadata = deserializeMetadata(output);
2981
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2982
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
2983
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2984
- $fault: "client",
2985
- $metadata,
2605
+ (0, smithy_client_1.throwDefaultError)({
2606
+ output,
2607
+ parsedBody,
2608
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2609
+ errorCode,
2986
2610
  });
2987
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2988
2611
  }
2989
2612
  };
2990
2613
  const deserializeAws_restJson1StartElasticsearchServiceSoftwareUpdateCommand = async (output, context) => {
2991
2614
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2992
2615
  return deserializeAws_restJson1StartElasticsearchServiceSoftwareUpdateCommandError(output, context);
2993
2616
  }
2994
- const contents = {
2617
+ const contents = map({
2995
2618
  $metadata: deserializeMetadata(output),
2996
- ServiceSoftwareOptions: undefined,
2997
- };
2619
+ });
2998
2620
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2999
- if (data.ServiceSoftwareOptions !== undefined && data.ServiceSoftwareOptions !== null) {
2621
+ if (data.ServiceSoftwareOptions != null) {
3000
2622
  contents.ServiceSoftwareOptions = deserializeAws_restJson1ServiceSoftwareOptions(data.ServiceSoftwareOptions, context);
3001
2623
  }
3002
- return Promise.resolve(contents);
2624
+ return contents;
3003
2625
  };
3004
2626
  exports.deserializeAws_restJson1StartElasticsearchServiceSoftwareUpdateCommand = deserializeAws_restJson1StartElasticsearchServiceSoftwareUpdateCommand;
3005
2627
  const deserializeAws_restJson1StartElasticsearchServiceSoftwareUpdateCommandError = async (output, context) => {
@@ -3007,7 +2629,6 @@ const deserializeAws_restJson1StartElasticsearchServiceSoftwareUpdateCommandErro
3007
2629
  ...output,
3008
2630
  body: await parseBody(output.body, context),
3009
2631
  };
3010
- let response;
3011
2632
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3012
2633
  switch (errorCode) {
3013
2634
  case "BaseException":
@@ -3024,33 +2645,29 @@ const deserializeAws_restJson1StartElasticsearchServiceSoftwareUpdateCommandErro
3024
2645
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3025
2646
  default:
3026
2647
  const parsedBody = parsedOutput.body;
3027
- const $metadata = deserializeMetadata(output);
3028
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3029
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
3030
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3031
- $fault: "client",
3032
- $metadata,
2648
+ (0, smithy_client_1.throwDefaultError)({
2649
+ output,
2650
+ parsedBody,
2651
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2652
+ errorCode,
3033
2653
  });
3034
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3035
2654
  }
3036
2655
  };
3037
2656
  const deserializeAws_restJson1UpdateElasticsearchDomainConfigCommand = async (output, context) => {
3038
2657
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3039
2658
  return deserializeAws_restJson1UpdateElasticsearchDomainConfigCommandError(output, context);
3040
2659
  }
3041
- const contents = {
2660
+ const contents = map({
3042
2661
  $metadata: deserializeMetadata(output),
3043
- DomainConfig: undefined,
3044
- DryRunResults: undefined,
3045
- };
2662
+ });
3046
2663
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3047
- if (data.DomainConfig !== undefined && data.DomainConfig !== null) {
2664
+ if (data.DomainConfig != null) {
3048
2665
  contents.DomainConfig = deserializeAws_restJson1ElasticsearchDomainConfig(data.DomainConfig, context);
3049
2666
  }
3050
- if (data.DryRunResults !== undefined && data.DryRunResults !== null) {
2667
+ if (data.DryRunResults != null) {
3051
2668
  contents.DryRunResults = deserializeAws_restJson1DryRunResults(data.DryRunResults, context);
3052
2669
  }
3053
- return Promise.resolve(contents);
2670
+ return contents;
3054
2671
  };
3055
2672
  exports.deserializeAws_restJson1UpdateElasticsearchDomainConfigCommand = deserializeAws_restJson1UpdateElasticsearchDomainConfigCommand;
3056
2673
  const deserializeAws_restJson1UpdateElasticsearchDomainConfigCommandError = async (output, context) => {
@@ -3058,7 +2675,6 @@ const deserializeAws_restJson1UpdateElasticsearchDomainConfigCommandError = asyn
3058
2675
  ...output,
3059
2676
  body: await parseBody(output.body, context),
3060
2677
  };
3061
- let response;
3062
2678
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3063
2679
  switch (errorCode) {
3064
2680
  case "BaseException":
@@ -3081,29 +2697,26 @@ const deserializeAws_restJson1UpdateElasticsearchDomainConfigCommandError = asyn
3081
2697
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3082
2698
  default:
3083
2699
  const parsedBody = parsedOutput.body;
3084
- const $metadata = deserializeMetadata(output);
3085
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3086
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
3087
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3088
- $fault: "client",
3089
- $metadata,
2700
+ (0, smithy_client_1.throwDefaultError)({
2701
+ output,
2702
+ parsedBody,
2703
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2704
+ errorCode,
3090
2705
  });
3091
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3092
2706
  }
3093
2707
  };
3094
2708
  const deserializeAws_restJson1UpdatePackageCommand = async (output, context) => {
3095
2709
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3096
2710
  return deserializeAws_restJson1UpdatePackageCommandError(output, context);
3097
2711
  }
3098
- const contents = {
2712
+ const contents = map({
3099
2713
  $metadata: deserializeMetadata(output),
3100
- PackageDetails: undefined,
3101
- };
2714
+ });
3102
2715
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3103
- if (data.PackageDetails !== undefined && data.PackageDetails !== null) {
2716
+ if (data.PackageDetails != null) {
3104
2717
  contents.PackageDetails = deserializeAws_restJson1PackageDetails(data.PackageDetails, context);
3105
2718
  }
3106
- return Promise.resolve(contents);
2719
+ return contents;
3107
2720
  };
3108
2721
  exports.deserializeAws_restJson1UpdatePackageCommand = deserializeAws_restJson1UpdatePackageCommand;
3109
2722
  const deserializeAws_restJson1UpdatePackageCommandError = async (output, context) => {
@@ -3111,7 +2724,6 @@ const deserializeAws_restJson1UpdatePackageCommandError = async (output, context
3111
2724
  ...output,
3112
2725
  body: await parseBody(output.body, context),
3113
2726
  };
3114
- let response;
3115
2727
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3116
2728
  switch (errorCode) {
3117
2729
  case "AccessDeniedException":
@@ -3134,41 +2746,35 @@ const deserializeAws_restJson1UpdatePackageCommandError = async (output, context
3134
2746
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3135
2747
  default:
3136
2748
  const parsedBody = parsedOutput.body;
3137
- const $metadata = deserializeMetadata(output);
3138
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3139
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
3140
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3141
- $fault: "client",
3142
- $metadata,
2749
+ (0, smithy_client_1.throwDefaultError)({
2750
+ output,
2751
+ parsedBody,
2752
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2753
+ errorCode,
3143
2754
  });
3144
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3145
2755
  }
3146
2756
  };
3147
2757
  const deserializeAws_restJson1UpgradeElasticsearchDomainCommand = async (output, context) => {
3148
2758
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3149
2759
  return deserializeAws_restJson1UpgradeElasticsearchDomainCommandError(output, context);
3150
2760
  }
3151
- const contents = {
2761
+ const contents = map({
3152
2762
  $metadata: deserializeMetadata(output),
3153
- ChangeProgressDetails: undefined,
3154
- DomainName: undefined,
3155
- PerformCheckOnly: undefined,
3156
- TargetVersion: undefined,
3157
- };
2763
+ });
3158
2764
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3159
- if (data.ChangeProgressDetails !== undefined && data.ChangeProgressDetails !== null) {
2765
+ if (data.ChangeProgressDetails != null) {
3160
2766
  contents.ChangeProgressDetails = deserializeAws_restJson1ChangeProgressDetails(data.ChangeProgressDetails, context);
3161
2767
  }
3162
- if (data.DomainName !== undefined && data.DomainName !== null) {
2768
+ if (data.DomainName != null) {
3163
2769
  contents.DomainName = (0, smithy_client_1.expectString)(data.DomainName);
3164
2770
  }
3165
- if (data.PerformCheckOnly !== undefined && data.PerformCheckOnly !== null) {
2771
+ if (data.PerformCheckOnly != null) {
3166
2772
  contents.PerformCheckOnly = (0, smithy_client_1.expectBoolean)(data.PerformCheckOnly);
3167
2773
  }
3168
- if (data.TargetVersion !== undefined && data.TargetVersion !== null) {
2774
+ if (data.TargetVersion != null) {
3169
2775
  contents.TargetVersion = (0, smithy_client_1.expectString)(data.TargetVersion);
3170
2776
  }
3171
- return Promise.resolve(contents);
2777
+ return contents;
3172
2778
  };
3173
2779
  exports.deserializeAws_restJson1UpgradeElasticsearchDomainCommand = deserializeAws_restJson1UpgradeElasticsearchDomainCommand;
3174
2780
  const deserializeAws_restJson1UpgradeElasticsearchDomainCommandError = async (output, context) => {
@@ -3176,7 +2782,6 @@ const deserializeAws_restJson1UpgradeElasticsearchDomainCommandError = async (ou
3176
2782
  ...output,
3177
2783
  body: await parseBody(output.body, context),
3178
2784
  };
3179
- let response;
3180
2785
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3181
2786
  switch (errorCode) {
3182
2787
  case "BaseException":
@@ -3199,20 +2804,19 @@ const deserializeAws_restJson1UpgradeElasticsearchDomainCommandError = async (ou
3199
2804
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3200
2805
  default:
3201
2806
  const parsedBody = parsedOutput.body;
3202
- const $metadata = deserializeMetadata(output);
3203
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3204
- response = new ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException({
3205
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3206
- $fault: "client",
3207
- $metadata,
2807
+ (0, smithy_client_1.throwDefaultError)({
2808
+ output,
2809
+ parsedBody,
2810
+ exceptionCtor: ElasticsearchServiceServiceException_1.ElasticsearchServiceServiceException,
2811
+ errorCode,
3208
2812
  });
3209
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3210
2813
  }
3211
2814
  };
2815
+ const map = smithy_client_1.map;
3212
2816
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
3213
- const contents = {};
2817
+ const contents = map({});
3214
2818
  const data = parsedOutput.body;
3215
- if (data.message !== undefined && data.message !== null) {
2819
+ if (data.message != null) {
3216
2820
  contents.message = (0, smithy_client_1.expectString)(data.message);
3217
2821
  }
3218
2822
  const exception = new models_0_1.AccessDeniedException({
@@ -3222,9 +2826,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
3222
2826
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3223
2827
  };
3224
2828
  const deserializeAws_restJson1BaseExceptionResponse = async (parsedOutput, context) => {
3225
- const contents = {};
2829
+ const contents = map({});
3226
2830
  const data = parsedOutput.body;
3227
- if (data.message !== undefined && data.message !== null) {
2831
+ if (data.message != null) {
3228
2832
  contents.message = (0, smithy_client_1.expectString)(data.message);
3229
2833
  }
3230
2834
  const exception = new models_0_1.BaseException({
@@ -3234,9 +2838,9 @@ const deserializeAws_restJson1BaseExceptionResponse = async (parsedOutput, conte
3234
2838
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3235
2839
  };
3236
2840
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
3237
- const contents = {};
2841
+ const contents = map({});
3238
2842
  const data = parsedOutput.body;
3239
- if (data.message !== undefined && data.message !== null) {
2843
+ if (data.message != null) {
3240
2844
  contents.message = (0, smithy_client_1.expectString)(data.message);
3241
2845
  }
3242
2846
  const exception = new models_0_1.ConflictException({
@@ -3246,9 +2850,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
3246
2850
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3247
2851
  };
3248
2852
  const deserializeAws_restJson1DisabledOperationExceptionResponse = async (parsedOutput, context) => {
3249
- const contents = {};
2853
+ const contents = map({});
3250
2854
  const data = parsedOutput.body;
3251
- if (data.message !== undefined && data.message !== null) {
2855
+ if (data.message != null) {
3252
2856
  contents.message = (0, smithy_client_1.expectString)(data.message);
3253
2857
  }
3254
2858
  const exception = new models_0_1.DisabledOperationException({
@@ -3258,9 +2862,9 @@ const deserializeAws_restJson1DisabledOperationExceptionResponse = async (parsed
3258
2862
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3259
2863
  };
3260
2864
  const deserializeAws_restJson1InternalExceptionResponse = async (parsedOutput, context) => {
3261
- const contents = {};
2865
+ const contents = map({});
3262
2866
  const data = parsedOutput.body;
3263
- if (data.message !== undefined && data.message !== null) {
2867
+ if (data.message != null) {
3264
2868
  contents.message = (0, smithy_client_1.expectString)(data.message);
3265
2869
  }
3266
2870
  const exception = new models_0_1.InternalException({
@@ -3270,9 +2874,9 @@ const deserializeAws_restJson1InternalExceptionResponse = async (parsedOutput, c
3270
2874
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3271
2875
  };
3272
2876
  const deserializeAws_restJson1InvalidPaginationTokenExceptionResponse = async (parsedOutput, context) => {
3273
- const contents = {};
2877
+ const contents = map({});
3274
2878
  const data = parsedOutput.body;
3275
- if (data.message !== undefined && data.message !== null) {
2879
+ if (data.message != null) {
3276
2880
  contents.message = (0, smithy_client_1.expectString)(data.message);
3277
2881
  }
3278
2882
  const exception = new models_0_1.InvalidPaginationTokenException({
@@ -3282,9 +2886,9 @@ const deserializeAws_restJson1InvalidPaginationTokenExceptionResponse = async (p
3282
2886
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3283
2887
  };
3284
2888
  const deserializeAws_restJson1InvalidTypeExceptionResponse = async (parsedOutput, context) => {
3285
- const contents = {};
2889
+ const contents = map({});
3286
2890
  const data = parsedOutput.body;
3287
- if (data.message !== undefined && data.message !== null) {
2891
+ if (data.message != null) {
3288
2892
  contents.message = (0, smithy_client_1.expectString)(data.message);
3289
2893
  }
3290
2894
  const exception = new models_0_1.InvalidTypeException({
@@ -3294,9 +2898,9 @@ const deserializeAws_restJson1InvalidTypeExceptionResponse = async (parsedOutput
3294
2898
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3295
2899
  };
3296
2900
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
3297
- const contents = {};
2901
+ const contents = map({});
3298
2902
  const data = parsedOutput.body;
3299
- if (data.message !== undefined && data.message !== null) {
2903
+ if (data.message != null) {
3300
2904
  contents.message = (0, smithy_client_1.expectString)(data.message);
3301
2905
  }
3302
2906
  const exception = new models_0_1.LimitExceededException({
@@ -3306,9 +2910,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
3306
2910
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3307
2911
  };
3308
2912
  const deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
3309
- const contents = {};
2913
+ const contents = map({});
3310
2914
  const data = parsedOutput.body;
3311
- if (data.message !== undefined && data.message !== null) {
2915
+ if (data.message != null) {
3312
2916
  contents.message = (0, smithy_client_1.expectString)(data.message);
3313
2917
  }
3314
2918
  const exception = new models_0_1.ResourceAlreadyExistsException({
@@ -3318,9 +2922,9 @@ const deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = async (pa
3318
2922
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3319
2923
  };
3320
2924
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
3321
- const contents = {};
2925
+ const contents = map({});
3322
2926
  const data = parsedOutput.body;
3323
- if (data.message !== undefined && data.message !== null) {
2927
+ if (data.message != null) {
3324
2928
  contents.message = (0, smithy_client_1.expectString)(data.message);
3325
2929
  }
3326
2930
  const exception = new models_0_1.ResourceNotFoundException({
@@ -3330,9 +2934,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
3330
2934
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3331
2935
  };
3332
2936
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
3333
- const contents = {};
2937
+ const contents = map({});
3334
2938
  const data = parsedOutput.body;
3335
- if (data.message !== undefined && data.message !== null) {
2939
+ if (data.message != null) {
3336
2940
  contents.message = (0, smithy_client_1.expectString)(data.message);
3337
2941
  }
3338
2942
  const exception = new models_0_1.ValidationException({
@@ -3380,9 +2984,6 @@ const serializeAws_restJson1AutoTuneMaintenanceScheduleList = (input, context) =
3380
2984
  return input
3381
2985
  .filter((e) => e != null)
3382
2986
  .map((entry) => {
3383
- if (entry === null) {
3384
- return null;
3385
- }
3386
2987
  return serializeAws_restJson1AutoTuneMaintenanceSchedule(entry, context);
3387
2988
  });
3388
2989
  };
@@ -3426,9 +3027,6 @@ const serializeAws_restJson1DescribePackagesFilterList = (input, context) => {
3426
3027
  return input
3427
3028
  .filter((e) => e != null)
3428
3029
  .map((entry) => {
3429
- if (entry === null) {
3430
- return null;
3431
- }
3432
3030
  return serializeAws_restJson1DescribePackagesFilter(entry, context);
3433
3031
  });
3434
3032
  };
@@ -3436,9 +3034,6 @@ const serializeAws_restJson1DescribePackagesFilterValues = (input, context) => {
3436
3034
  return input
3437
3035
  .filter((e) => e != null)
3438
3036
  .map((entry) => {
3439
- if (entry === null) {
3440
- return null;
3441
- }
3442
3037
  return entry;
3443
3038
  });
3444
3039
  };
@@ -3464,9 +3059,6 @@ const serializeAws_restJson1DomainNameList = (input, context) => {
3464
3059
  return input
3465
3060
  .filter((e) => e != null)
3466
3061
  .map((entry) => {
3467
- if (entry === null) {
3468
- return null;
3469
- }
3470
3062
  return entry;
3471
3063
  });
3472
3064
  };
@@ -3520,9 +3112,6 @@ const serializeAws_restJson1FilterList = (input, context) => {
3520
3112
  return input
3521
3113
  .filter((e) => e != null)
3522
3114
  .map((entry) => {
3523
- if (entry === null) {
3524
- return null;
3525
- }
3526
3115
  return serializeAws_restJson1Filter(entry, context);
3527
3116
  });
3528
3117
  };
@@ -3587,9 +3176,6 @@ const serializeAws_restJson1StringList = (input, context) => {
3587
3176
  return input
3588
3177
  .filter((e) => e != null)
3589
3178
  .map((entry) => {
3590
- if (entry === null) {
3591
- return null;
3592
- }
3593
3179
  return entry;
3594
3180
  });
3595
3181
  };
@@ -3603,9 +3189,6 @@ const serializeAws_restJson1TagList = (input, context) => {
3603
3189
  return input
3604
3190
  .filter((e) => e != null)
3605
3191
  .map((entry) => {
3606
- if (entry === null) {
3607
- return null;
3608
- }
3609
3192
  return serializeAws_restJson1Tag(entry, context);
3610
3193
  });
3611
3194
  };
@@ -3613,9 +3196,6 @@ const serializeAws_restJson1ValueStringList = (input, context) => {
3613
3196
  return input
3614
3197
  .filter((e) => e != null)
3615
3198
  .map((entry) => {
3616
- if (entry === null) {
3617
- return null;
3618
- }
3619
3199
  return entry;
3620
3200
  });
3621
3201
  };