@aws-sdk/client-opensearch 3.141.0 → 3.142.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_restJson1AcceptInboundConnectionCommand = async (input, conte
11
11
  const headers = {};
12
12
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
13
13
  "/2021-01-01/opensearch/cc/inboundConnection/{ConnectionId}/accept";
14
- if (input.ConnectionId !== undefined) {
15
- const labelValue = input.ConnectionId;
16
- if (labelValue.length <= 0) {
17
- throw new Error("Empty value provided for input HTTP label: ConnectionId.");
18
- }
19
- resolvedPath = resolvedPath.replace("{ConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
20
- }
21
- else {
22
- throw new Error("No value provided for input HTTP label: ConnectionId.");
23
- }
14
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", 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
  "/2021-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,
@@ -229,16 +202,7 @@ const serializeAws_restJson1DeleteDomainCommand = async (input, context) => {
229
202
  const headers = {};
230
203
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
231
204
  "/2021-01-01/opensearch/domain/{DomainName}";
232
- if (input.DomainName !== undefined) {
233
- const labelValue = input.DomainName;
234
- if (labelValue.length <= 0) {
235
- throw new Error("Empty value provided for input HTTP label: DomainName.");
236
- }
237
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
238
- }
239
- else {
240
- throw new Error("No value provided for input HTTP label: DomainName.");
241
- }
205
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
242
206
  let body;
243
207
  return new protocol_http_1.HttpRequest({
244
208
  protocol,
@@ -256,16 +220,7 @@ const serializeAws_restJson1DeleteInboundConnectionCommand = async (input, conte
256
220
  const headers = {};
257
221
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
258
222
  "/2021-01-01/opensearch/cc/inboundConnection/{ConnectionId}";
259
- if (input.ConnectionId !== undefined) {
260
- const labelValue = input.ConnectionId;
261
- if (labelValue.length <= 0) {
262
- throw new Error("Empty value provided for input HTTP label: ConnectionId.");
263
- }
264
- resolvedPath = resolvedPath.replace("{ConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
265
- }
266
- else {
267
- throw new Error("No value provided for input HTTP label: ConnectionId.");
268
- }
223
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", false);
269
224
  let body;
270
225
  return new protocol_http_1.HttpRequest({
271
226
  protocol,
@@ -283,16 +238,7 @@ const serializeAws_restJson1DeleteOutboundConnectionCommand = async (input, cont
283
238
  const headers = {};
284
239
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
285
240
  "/2021-01-01/opensearch/cc/outboundConnection/{ConnectionId}";
286
- if (input.ConnectionId !== undefined) {
287
- const labelValue = input.ConnectionId;
288
- if (labelValue.length <= 0) {
289
- throw new Error("Empty value provided for input HTTP label: ConnectionId.");
290
- }
291
- resolvedPath = resolvedPath.replace("{ConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
292
- }
293
- else {
294
- throw new Error("No value provided for input HTTP label: ConnectionId.");
295
- }
241
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", false);
296
242
  let body;
297
243
  return new protocol_http_1.HttpRequest({
298
244
  protocol,
@@ -309,16 +255,7 @@ const serializeAws_restJson1DeletePackageCommand = async (input, context) => {
309
255
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
310
256
  const headers = {};
311
257
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/packages/{PackageID}";
312
- if (input.PackageID !== undefined) {
313
- const labelValue = input.PackageID;
314
- if (labelValue.length <= 0) {
315
- throw new Error("Empty value provided for input HTTP label: PackageID.");
316
- }
317
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
318
- }
319
- else {
320
- throw new Error("No value provided for input HTTP label: PackageID.");
321
- }
258
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
322
259
  let body;
323
260
  return new protocol_http_1.HttpRequest({
324
261
  protocol,
@@ -336,16 +273,7 @@ const serializeAws_restJson1DescribeDomainCommand = async (input, context) => {
336
273
  const headers = {};
337
274
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
338
275
  "/2021-01-01/opensearch/domain/{DomainName}";
339
- if (input.DomainName !== undefined) {
340
- const labelValue = input.DomainName;
341
- if (labelValue.length <= 0) {
342
- throw new Error("Empty value provided for input HTTP label: DomainName.");
343
- }
344
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
345
- }
346
- else {
347
- throw new Error("No value provided for input HTTP label: DomainName.");
348
- }
276
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
349
277
  let body;
350
278
  return new protocol_http_1.HttpRequest({
351
279
  protocol,
@@ -365,16 +293,7 @@ const serializeAws_restJson1DescribeDomainAutoTunesCommand = async (input, conte
365
293
  };
366
294
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
367
295
  "/2021-01-01/opensearch/domain/{DomainName}/autoTunes";
368
- if (input.DomainName !== undefined) {
369
- const labelValue = input.DomainName;
370
- if (labelValue.length <= 0) {
371
- throw new Error("Empty value provided for input HTTP label: DomainName.");
372
- }
373
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
374
- }
375
- else {
376
- throw new Error("No value provided for input HTTP label: DomainName.");
377
- }
296
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
378
297
  let body;
379
298
  body = JSON.stringify({
380
299
  ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
@@ -396,19 +315,10 @@ const serializeAws_restJson1DescribeDomainChangeProgressCommand = async (input,
396
315
  const headers = {};
397
316
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
398
317
  "/2021-01-01/opensearch/domain/{DomainName}/progress";
399
- if (input.DomainName !== undefined) {
400
- const labelValue = input.DomainName;
401
- if (labelValue.length <= 0) {
402
- throw new Error("Empty value provided for input HTTP label: DomainName.");
403
- }
404
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
405
- }
406
- else {
407
- throw new Error("No value provided for input HTTP label: DomainName.");
408
- }
409
- const query = {
410
- ...(input.ChangeId !== undefined && { changeid: input.ChangeId }),
411
- };
318
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
319
+ const query = map({
320
+ changeid: [, input.ChangeId],
321
+ });
412
322
  let body;
413
323
  return new protocol_http_1.HttpRequest({
414
324
  protocol,
@@ -427,16 +337,7 @@ const serializeAws_restJson1DescribeDomainConfigCommand = async (input, context)
427
337
  const headers = {};
428
338
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
429
339
  "/2021-01-01/opensearch/domain/{DomainName}/config";
430
- if (input.DomainName !== undefined) {
431
- const labelValue = input.DomainName;
432
- if (labelValue.length <= 0) {
433
- throw new Error("Empty value provided for input HTTP label: DomainName.");
434
- }
435
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
436
- }
437
- else {
438
- throw new Error("No value provided for input HTTP label: DomainName.");
439
- }
340
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
440
341
  let body;
441
342
  return new protocol_http_1.HttpRequest({
442
343
  protocol,
@@ -499,29 +400,11 @@ const serializeAws_restJson1DescribeInstanceTypeLimitsCommand = async (input, co
499
400
  const headers = {};
500
401
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
501
402
  "/2021-01-01/opensearch/instanceTypeLimits/{EngineVersion}/{InstanceType}";
502
- if (input.InstanceType !== undefined) {
503
- const labelValue = input.InstanceType;
504
- if (labelValue.length <= 0) {
505
- throw new Error("Empty value provided for input HTTP label: InstanceType.");
506
- }
507
- resolvedPath = resolvedPath.replace("{InstanceType}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
508
- }
509
- else {
510
- throw new Error("No value provided for input HTTP label: InstanceType.");
511
- }
512
- if (input.EngineVersion !== undefined) {
513
- const labelValue = input.EngineVersion;
514
- if (labelValue.length <= 0) {
515
- throw new Error("Empty value provided for input HTTP label: EngineVersion.");
516
- }
517
- resolvedPath = resolvedPath.replace("{EngineVersion}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
518
- }
519
- else {
520
- throw new Error("No value provided for input HTTP label: EngineVersion.");
521
- }
522
- const query = {
523
- ...(input.DomainName !== undefined && { domainName: input.DomainName }),
524
- };
403
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "InstanceType", () => input.InstanceType, "{InstanceType}", false);
404
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EngineVersion", () => input.EngineVersion, "{EngineVersion}", false);
405
+ const query = map({
406
+ domainName: [, input.DomainName],
407
+ });
525
408
  let body;
526
409
  return new protocol_http_1.HttpRequest({
527
410
  protocol,
@@ -587,11 +470,11 @@ const serializeAws_restJson1DescribeReservedInstanceOfferingsCommand = async (in
587
470
  const headers = {};
588
471
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
589
472
  "/2021-01-01/opensearch/reservedInstanceOfferings";
590
- const query = {
591
- ...(input.ReservedInstanceOfferingId !== undefined && { offeringId: input.ReservedInstanceOfferingId }),
592
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
593
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
594
- };
473
+ const query = map({
474
+ offeringId: [, input.ReservedInstanceOfferingId],
475
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
476
+ nextToken: [, input.NextToken],
477
+ });
595
478
  let body;
596
479
  return new protocol_http_1.HttpRequest({
597
480
  protocol,
@@ -609,11 +492,11 @@ const serializeAws_restJson1DescribeReservedInstancesCommand = async (input, con
609
492
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
610
493
  const headers = {};
611
494
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/opensearch/reservedInstances";
612
- const query = {
613
- ...(input.ReservedInstanceId !== undefined && { reservationId: input.ReservedInstanceId }),
614
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
615
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
616
- };
495
+ const query = map({
496
+ reservationId: [, input.ReservedInstanceId],
497
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
498
+ nextToken: [, input.NextToken],
499
+ });
617
500
  let body;
618
501
  return new protocol_http_1.HttpRequest({
619
502
  protocol,
@@ -632,26 +515,8 @@ const serializeAws_restJson1DissociatePackageCommand = async (input, context) =>
632
515
  const headers = {};
633
516
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
634
517
  "/2021-01-01/packages/dissociate/{PackageID}/{DomainName}";
635
- if (input.PackageID !== undefined) {
636
- const labelValue = input.PackageID;
637
- if (labelValue.length <= 0) {
638
- throw new Error("Empty value provided for input HTTP label: PackageID.");
639
- }
640
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
641
- }
642
- else {
643
- throw new Error("No value provided for input HTTP label: PackageID.");
644
- }
645
- if (input.DomainName !== undefined) {
646
- const labelValue = input.DomainName;
647
- if (labelValue.length <= 0) {
648
- throw new Error("Empty value provided for input HTTP label: DomainName.");
649
- }
650
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
651
- }
652
- else {
653
- throw new Error("No value provided for input HTTP label: DomainName.");
654
- }
518
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
519
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
655
520
  let body;
656
521
  return new protocol_http_1.HttpRequest({
657
522
  protocol,
@@ -668,9 +533,9 @@ const serializeAws_restJson1GetCompatibleVersionsCommand = async (input, context
668
533
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
669
534
  const headers = {};
670
535
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/opensearch/compatibleVersions";
671
- const query = {
672
- ...(input.DomainName !== undefined && { domainName: input.DomainName }),
673
- };
536
+ const query = map({
537
+ domainName: [, input.DomainName],
538
+ });
674
539
  let body;
675
540
  return new protocol_http_1.HttpRequest({
676
541
  protocol,
@@ -688,20 +553,11 @@ const serializeAws_restJson1GetPackageVersionHistoryCommand = async (input, cont
688
553
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
689
554
  const headers = {};
690
555
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/packages/{PackageID}/history";
691
- if (input.PackageID !== undefined) {
692
- const labelValue = input.PackageID;
693
- if (labelValue.length <= 0) {
694
- throw new Error("Empty value provided for input HTTP label: PackageID.");
695
- }
696
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
697
- }
698
- else {
699
- throw new Error("No value provided for input HTTP label: PackageID.");
700
- }
701
- const query = {
702
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
703
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
704
- };
556
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
557
+ const query = map({
558
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
559
+ nextToken: [, input.NextToken],
560
+ });
705
561
  let body;
706
562
  return new protocol_http_1.HttpRequest({
707
563
  protocol,
@@ -720,20 +576,11 @@ const serializeAws_restJson1GetUpgradeHistoryCommand = async (input, context) =>
720
576
  const headers = {};
721
577
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
722
578
  "/2021-01-01/opensearch/upgradeDomain/{DomainName}/history";
723
- if (input.DomainName !== undefined) {
724
- const labelValue = input.DomainName;
725
- if (labelValue.length <= 0) {
726
- throw new Error("Empty value provided for input HTTP label: DomainName.");
727
- }
728
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
729
- }
730
- else {
731
- throw new Error("No value provided for input HTTP label: DomainName.");
732
- }
733
- const query = {
734
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
735
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
736
- };
579
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
580
+ const query = map({
581
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
582
+ nextToken: [, input.NextToken],
583
+ });
737
584
  let body;
738
585
  return new protocol_http_1.HttpRequest({
739
586
  protocol,
@@ -752,16 +599,7 @@ const serializeAws_restJson1GetUpgradeStatusCommand = async (input, context) =>
752
599
  const headers = {};
753
600
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
754
601
  "/2021-01-01/opensearch/upgradeDomain/{DomainName}/status";
755
- if (input.DomainName !== undefined) {
756
- const labelValue = input.DomainName;
757
- if (labelValue.length <= 0) {
758
- throw new Error("Empty value provided for input HTTP label: DomainName.");
759
- }
760
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
761
- }
762
- else {
763
- throw new Error("No value provided for input HTTP label: DomainName.");
764
- }
602
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
765
603
  let body;
766
604
  return new protocol_http_1.HttpRequest({
767
605
  protocol,
@@ -778,9 +616,9 @@ const serializeAws_restJson1ListDomainNamesCommand = async (input, context) => {
778
616
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
779
617
  const headers = {};
780
618
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/domain";
781
- const query = {
782
- ...(input.EngineType !== undefined && { engineType: input.EngineType }),
783
- };
619
+ const query = map({
620
+ engineType: [, input.EngineType],
621
+ });
784
622
  let body;
785
623
  return new protocol_http_1.HttpRequest({
786
624
  protocol,
@@ -798,20 +636,11 @@ const serializeAws_restJson1ListDomainsForPackageCommand = async (input, context
798
636
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
799
637
  const headers = {};
800
638
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/packages/{PackageID}/domains";
801
- if (input.PackageID !== undefined) {
802
- const labelValue = input.PackageID;
803
- if (labelValue.length <= 0) {
804
- throw new Error("Empty value provided for input HTTP label: PackageID.");
805
- }
806
- resolvedPath = resolvedPath.replace("{PackageID}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
807
- }
808
- else {
809
- throw new Error("No value provided for input HTTP label: PackageID.");
810
- }
811
- const query = {
812
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
813
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
814
- };
639
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PackageID", () => input.PackageID, "{PackageID}", false);
640
+ const query = map({
641
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
642
+ nextToken: [, input.NextToken],
643
+ });
815
644
  let body;
816
645
  return new protocol_http_1.HttpRequest({
817
646
  protocol,
@@ -830,21 +659,12 @@ const serializeAws_restJson1ListInstanceTypeDetailsCommand = async (input, conte
830
659
  const headers = {};
831
660
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
832
661
  "/2021-01-01/opensearch/instanceTypeDetails/{EngineVersion}";
833
- if (input.EngineVersion !== undefined) {
834
- const labelValue = input.EngineVersion;
835
- if (labelValue.length <= 0) {
836
- throw new Error("Empty value provided for input HTTP label: EngineVersion.");
837
- }
838
- resolvedPath = resolvedPath.replace("{EngineVersion}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
839
- }
840
- else {
841
- throw new Error("No value provided for input HTTP label: EngineVersion.");
842
- }
843
- const query = {
844
- ...(input.DomainName !== undefined && { domainName: input.DomainName }),
845
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
846
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
847
- };
662
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EngineVersion", () => input.EngineVersion, "{EngineVersion}", false);
663
+ const query = map({
664
+ domainName: [, input.DomainName],
665
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
666
+ nextToken: [, input.NextToken],
667
+ });
848
668
  let body;
849
669
  return new protocol_http_1.HttpRequest({
850
670
  protocol,
@@ -862,20 +682,11 @@ const serializeAws_restJson1ListPackagesForDomainCommand = async (input, context
862
682
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
863
683
  const headers = {};
864
684
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/domain/{DomainName}/packages";
865
- if (input.DomainName !== undefined) {
866
- const labelValue = input.DomainName;
867
- if (labelValue.length <= 0) {
868
- throw new Error("Empty value provided for input HTTP label: DomainName.");
869
- }
870
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
871
- }
872
- else {
873
- throw new Error("No value provided for input HTTP label: DomainName.");
874
- }
875
- const query = {
876
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
877
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
878
- };
685
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
686
+ const query = map({
687
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
688
+ nextToken: [, input.NextToken],
689
+ });
879
690
  let body;
880
691
  return new protocol_http_1.HttpRequest({
881
692
  protocol,
@@ -893,9 +704,9 @@ const serializeAws_restJson1ListTagsCommand = async (input, context) => {
893
704
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
894
705
  const headers = {};
895
706
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/tags";
896
- const query = {
897
- ...(input.ARN !== undefined && { arn: input.ARN }),
898
- };
707
+ const query = map({
708
+ arn: [, input.ARN],
709
+ });
899
710
  let body;
900
711
  return new protocol_http_1.HttpRequest({
901
712
  protocol,
@@ -913,10 +724,10 @@ const serializeAws_restJson1ListVersionsCommand = async (input, context) => {
913
724
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
914
725
  const headers = {};
915
726
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/2021-01-01/opensearch/versions";
916
- const query = {
917
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
918
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
919
- };
727
+ const query = map({
728
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
729
+ nextToken: [, input.NextToken],
730
+ });
920
731
  let body;
921
732
  return new protocol_http_1.HttpRequest({
922
733
  protocol,
@@ -959,16 +770,7 @@ const serializeAws_restJson1RejectInboundConnectionCommand = async (input, conte
959
770
  const headers = {};
960
771
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
961
772
  "/2021-01-01/opensearch/cc/inboundConnection/{ConnectionId}/reject";
962
- if (input.ConnectionId !== undefined) {
963
- const labelValue = input.ConnectionId;
964
- if (labelValue.length <= 0) {
965
- throw new Error("Empty value provided for input HTTP label: ConnectionId.");
966
- }
967
- resolvedPath = resolvedPath.replace("{ConnectionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
968
- }
969
- else {
970
- throw new Error("No value provided for input HTTP label: ConnectionId.");
971
- }
773
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", false);
972
774
  let body;
973
775
  return new protocol_http_1.HttpRequest({
974
776
  protocol,
@@ -1032,16 +834,7 @@ const serializeAws_restJson1UpdateDomainConfigCommand = async (input, context) =
1032
834
  };
1033
835
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1034
836
  "/2021-01-01/opensearch/domain/{DomainName}/config";
1035
- if (input.DomainName !== undefined) {
1036
- const labelValue = input.DomainName;
1037
- if (labelValue.length <= 0) {
1038
- throw new Error("Empty value provided for input HTTP label: DomainName.");
1039
- }
1040
- resolvedPath = resolvedPath.replace("{DomainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1041
- }
1042
- else {
1043
- throw new Error("No value provided for input HTTP label: DomainName.");
1044
- }
837
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DomainName", () => input.DomainName, "{DomainName}", false);
1045
838
  let body;
1046
839
  body = JSON.stringify({
1047
840
  ...(input.AccessPolicies != null && { AccessPolicies: input.AccessPolicies }),
@@ -1146,15 +939,14 @@ const deserializeAws_restJson1AcceptInboundConnectionCommand = async (output, co
1146
939
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1147
940
  return deserializeAws_restJson1AcceptInboundConnectionCommandError(output, context);
1148
941
  }
1149
- const contents = {
942
+ const contents = map({
1150
943
  $metadata: deserializeMetadata(output),
1151
- Connection: undefined,
1152
- };
944
+ });
1153
945
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1154
- if (data.Connection !== undefined && data.Connection !== null) {
946
+ if (data.Connection != null) {
1155
947
  contents.Connection = deserializeAws_restJson1InboundConnection(data.Connection, context);
1156
948
  }
1157
- return Promise.resolve(contents);
949
+ return contents;
1158
950
  };
1159
951
  exports.deserializeAws_restJson1AcceptInboundConnectionCommand = deserializeAws_restJson1AcceptInboundConnectionCommand;
1160
952
  const deserializeAws_restJson1AcceptInboundConnectionCommandError = async (output, context) => {
@@ -1162,7 +954,6 @@ const deserializeAws_restJson1AcceptInboundConnectionCommandError = async (outpu
1162
954
  ...output,
1163
955
  body: await parseBody(output.body, context),
1164
956
  };
1165
- let response;
1166
957
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1167
958
  switch (errorCode) {
1168
959
  case "DisabledOperationException":
@@ -1176,25 +967,23 @@ const deserializeAws_restJson1AcceptInboundConnectionCommandError = async (outpu
1176
967
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1177
968
  default:
1178
969
  const parsedBody = parsedOutput.body;
1179
- const $metadata = deserializeMetadata(output);
1180
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1181
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1182
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1183
- $fault: "client",
1184
- $metadata,
970
+ (0, smithy_client_1.throwDefaultError)({
971
+ output,
972
+ parsedBody,
973
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
974
+ errorCode,
1185
975
  });
1186
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1187
976
  }
1188
977
  };
1189
978
  const deserializeAws_restJson1AddTagsCommand = async (output, context) => {
1190
979
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1191
980
  return deserializeAws_restJson1AddTagsCommandError(output, context);
1192
981
  }
1193
- const contents = {
982
+ const contents = map({
1194
983
  $metadata: deserializeMetadata(output),
1195
- };
984
+ });
1196
985
  await collectBody(output.body, context);
1197
- return Promise.resolve(contents);
986
+ return contents;
1198
987
  };
1199
988
  exports.deserializeAws_restJson1AddTagsCommand = deserializeAws_restJson1AddTagsCommand;
1200
989
  const deserializeAws_restJson1AddTagsCommandError = async (output, context) => {
@@ -1202,7 +991,6 @@ const deserializeAws_restJson1AddTagsCommandError = async (output, context) => {
1202
991
  ...output,
1203
992
  body: await parseBody(output.body, context),
1204
993
  };
1205
- let response;
1206
994
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1207
995
  switch (errorCode) {
1208
996
  case "BaseException":
@@ -1219,29 +1007,26 @@ const deserializeAws_restJson1AddTagsCommandError = async (output, context) => {
1219
1007
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1220
1008
  default:
1221
1009
  const parsedBody = parsedOutput.body;
1222
- const $metadata = deserializeMetadata(output);
1223
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1224
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1225
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1226
- $fault: "client",
1227
- $metadata,
1010
+ (0, smithy_client_1.throwDefaultError)({
1011
+ output,
1012
+ parsedBody,
1013
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1014
+ errorCode,
1228
1015
  });
1229
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1230
1016
  }
1231
1017
  };
1232
1018
  const deserializeAws_restJson1AssociatePackageCommand = async (output, context) => {
1233
1019
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1234
1020
  return deserializeAws_restJson1AssociatePackageCommandError(output, context);
1235
1021
  }
1236
- const contents = {
1022
+ const contents = map({
1237
1023
  $metadata: deserializeMetadata(output),
1238
- DomainPackageDetails: undefined,
1239
- };
1024
+ });
1240
1025
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1241
- if (data.DomainPackageDetails !== undefined && data.DomainPackageDetails !== null) {
1026
+ if (data.DomainPackageDetails != null) {
1242
1027
  contents.DomainPackageDetails = deserializeAws_restJson1DomainPackageDetails(data.DomainPackageDetails, context);
1243
1028
  }
1244
- return Promise.resolve(contents);
1029
+ return contents;
1245
1030
  };
1246
1031
  exports.deserializeAws_restJson1AssociatePackageCommand = deserializeAws_restJson1AssociatePackageCommand;
1247
1032
  const deserializeAws_restJson1AssociatePackageCommandError = async (output, context) => {
@@ -1249,7 +1034,6 @@ const deserializeAws_restJson1AssociatePackageCommandError = async (output, cont
1249
1034
  ...output,
1250
1035
  body: await parseBody(output.body, context),
1251
1036
  };
1252
- let response;
1253
1037
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1254
1038
  switch (errorCode) {
1255
1039
  case "AccessDeniedException":
@@ -1272,29 +1056,26 @@ const deserializeAws_restJson1AssociatePackageCommandError = async (output, cont
1272
1056
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1273
1057
  default:
1274
1058
  const parsedBody = parsedOutput.body;
1275
- const $metadata = deserializeMetadata(output);
1276
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1277
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1278
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1279
- $fault: "client",
1280
- $metadata,
1059
+ (0, smithy_client_1.throwDefaultError)({
1060
+ output,
1061
+ parsedBody,
1062
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1063
+ errorCode,
1281
1064
  });
1282
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1283
1065
  }
1284
1066
  };
1285
1067
  const deserializeAws_restJson1CancelServiceSoftwareUpdateCommand = async (output, context) => {
1286
1068
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1287
1069
  return deserializeAws_restJson1CancelServiceSoftwareUpdateCommandError(output, context);
1288
1070
  }
1289
- const contents = {
1071
+ const contents = map({
1290
1072
  $metadata: deserializeMetadata(output),
1291
- ServiceSoftwareOptions: undefined,
1292
- };
1073
+ });
1293
1074
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1294
- if (data.ServiceSoftwareOptions !== undefined && data.ServiceSoftwareOptions !== null) {
1075
+ if (data.ServiceSoftwareOptions != null) {
1295
1076
  contents.ServiceSoftwareOptions = deserializeAws_restJson1ServiceSoftwareOptions(data.ServiceSoftwareOptions, context);
1296
1077
  }
1297
- return Promise.resolve(contents);
1078
+ return contents;
1298
1079
  };
1299
1080
  exports.deserializeAws_restJson1CancelServiceSoftwareUpdateCommand = deserializeAws_restJson1CancelServiceSoftwareUpdateCommand;
1300
1081
  const deserializeAws_restJson1CancelServiceSoftwareUpdateCommandError = async (output, context) => {
@@ -1302,7 +1083,6 @@ const deserializeAws_restJson1CancelServiceSoftwareUpdateCommandError = async (o
1302
1083
  ...output,
1303
1084
  body: await parseBody(output.body, context),
1304
1085
  };
1305
- let response;
1306
1086
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1307
1087
  switch (errorCode) {
1308
1088
  case "BaseException":
@@ -1319,29 +1099,26 @@ const deserializeAws_restJson1CancelServiceSoftwareUpdateCommandError = async (o
1319
1099
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1320
1100
  default:
1321
1101
  const parsedBody = parsedOutput.body;
1322
- const $metadata = deserializeMetadata(output);
1323
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1324
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1325
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1326
- $fault: "client",
1327
- $metadata,
1102
+ (0, smithy_client_1.throwDefaultError)({
1103
+ output,
1104
+ parsedBody,
1105
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1106
+ errorCode,
1328
1107
  });
1329
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1330
1108
  }
1331
1109
  };
1332
1110
  const deserializeAws_restJson1CreateDomainCommand = async (output, context) => {
1333
1111
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1334
1112
  return deserializeAws_restJson1CreateDomainCommandError(output, context);
1335
1113
  }
1336
- const contents = {
1114
+ const contents = map({
1337
1115
  $metadata: deserializeMetadata(output),
1338
- DomainStatus: undefined,
1339
- };
1116
+ });
1340
1117
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1341
- if (data.DomainStatus !== undefined && data.DomainStatus !== null) {
1118
+ if (data.DomainStatus != null) {
1342
1119
  contents.DomainStatus = deserializeAws_restJson1DomainStatus(data.DomainStatus, context);
1343
1120
  }
1344
- return Promise.resolve(contents);
1121
+ return contents;
1345
1122
  };
1346
1123
  exports.deserializeAws_restJson1CreateDomainCommand = deserializeAws_restJson1CreateDomainCommand;
1347
1124
  const deserializeAws_restJson1CreateDomainCommandError = async (output, context) => {
@@ -1349,7 +1126,6 @@ const deserializeAws_restJson1CreateDomainCommandError = async (output, context)
1349
1126
  ...output,
1350
1127
  body: await parseBody(output.body, context),
1351
1128
  };
1352
- let response;
1353
1129
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1354
1130
  switch (errorCode) {
1355
1131
  case "BaseException":
@@ -1375,45 +1151,38 @@ const deserializeAws_restJson1CreateDomainCommandError = async (output, context)
1375
1151
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1376
1152
  default:
1377
1153
  const parsedBody = parsedOutput.body;
1378
- const $metadata = deserializeMetadata(output);
1379
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1380
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1381
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1382
- $fault: "client",
1383
- $metadata,
1154
+ (0, smithy_client_1.throwDefaultError)({
1155
+ output,
1156
+ parsedBody,
1157
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1158
+ errorCode,
1384
1159
  });
1385
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1386
1160
  }
1387
1161
  };
1388
1162
  const deserializeAws_restJson1CreateOutboundConnectionCommand = async (output, context) => {
1389
1163
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1390
1164
  return deserializeAws_restJson1CreateOutboundConnectionCommandError(output, context);
1391
1165
  }
1392
- const contents = {
1166
+ const contents = map({
1393
1167
  $metadata: deserializeMetadata(output),
1394
- ConnectionAlias: undefined,
1395
- ConnectionId: undefined,
1396
- ConnectionStatus: undefined,
1397
- LocalDomainInfo: undefined,
1398
- RemoteDomainInfo: undefined,
1399
- };
1168
+ });
1400
1169
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1401
- if (data.ConnectionAlias !== undefined && data.ConnectionAlias !== null) {
1170
+ if (data.ConnectionAlias != null) {
1402
1171
  contents.ConnectionAlias = (0, smithy_client_1.expectString)(data.ConnectionAlias);
1403
1172
  }
1404
- if (data.ConnectionId !== undefined && data.ConnectionId !== null) {
1173
+ if (data.ConnectionId != null) {
1405
1174
  contents.ConnectionId = (0, smithy_client_1.expectString)(data.ConnectionId);
1406
1175
  }
1407
- if (data.ConnectionStatus !== undefined && data.ConnectionStatus !== null) {
1176
+ if (data.ConnectionStatus != null) {
1408
1177
  contents.ConnectionStatus = deserializeAws_restJson1OutboundConnectionStatus(data.ConnectionStatus, context);
1409
1178
  }
1410
- if (data.LocalDomainInfo !== undefined && data.LocalDomainInfo !== null) {
1179
+ if (data.LocalDomainInfo != null) {
1411
1180
  contents.LocalDomainInfo = deserializeAws_restJson1DomainInformationContainer(data.LocalDomainInfo, context);
1412
1181
  }
1413
- if (data.RemoteDomainInfo !== undefined && data.RemoteDomainInfo !== null) {
1182
+ if (data.RemoteDomainInfo != null) {
1414
1183
  contents.RemoteDomainInfo = deserializeAws_restJson1DomainInformationContainer(data.RemoteDomainInfo, context);
1415
1184
  }
1416
- return Promise.resolve(contents);
1185
+ return contents;
1417
1186
  };
1418
1187
  exports.deserializeAws_restJson1CreateOutboundConnectionCommand = deserializeAws_restJson1CreateOutboundConnectionCommand;
1419
1188
  const deserializeAws_restJson1CreateOutboundConnectionCommandError = async (output, context) => {
@@ -1421,7 +1190,6 @@ const deserializeAws_restJson1CreateOutboundConnectionCommandError = async (outp
1421
1190
  ...output,
1422
1191
  body: await parseBody(output.body, context),
1423
1192
  };
1424
- let response;
1425
1193
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1426
1194
  switch (errorCode) {
1427
1195
  case "DisabledOperationException":
@@ -1438,29 +1206,26 @@ const deserializeAws_restJson1CreateOutboundConnectionCommandError = async (outp
1438
1206
  throw await deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
1439
1207
  default:
1440
1208
  const parsedBody = parsedOutput.body;
1441
- const $metadata = deserializeMetadata(output);
1442
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1443
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1444
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1445
- $fault: "client",
1446
- $metadata,
1209
+ (0, smithy_client_1.throwDefaultError)({
1210
+ output,
1211
+ parsedBody,
1212
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1213
+ errorCode,
1447
1214
  });
1448
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1449
1215
  }
1450
1216
  };
1451
1217
  const deserializeAws_restJson1CreatePackageCommand = async (output, context) => {
1452
1218
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1453
1219
  return deserializeAws_restJson1CreatePackageCommandError(output, context);
1454
1220
  }
1455
- const contents = {
1221
+ const contents = map({
1456
1222
  $metadata: deserializeMetadata(output),
1457
- PackageDetails: undefined,
1458
- };
1223
+ });
1459
1224
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1460
- if (data.PackageDetails !== undefined && data.PackageDetails !== null) {
1225
+ if (data.PackageDetails != null) {
1461
1226
  contents.PackageDetails = deserializeAws_restJson1PackageDetails(data.PackageDetails, context);
1462
1227
  }
1463
- return Promise.resolve(contents);
1228
+ return contents;
1464
1229
  };
1465
1230
  exports.deserializeAws_restJson1CreatePackageCommand = deserializeAws_restJson1CreatePackageCommand;
1466
1231
  const deserializeAws_restJson1CreatePackageCommandError = async (output, context) => {
@@ -1468,7 +1233,6 @@ const deserializeAws_restJson1CreatePackageCommandError = async (output, context
1468
1233
  ...output,
1469
1234
  body: await parseBody(output.body, context),
1470
1235
  };
1471
- let response;
1472
1236
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1473
1237
  switch (errorCode) {
1474
1238
  case "AccessDeniedException":
@@ -1494,29 +1258,26 @@ const deserializeAws_restJson1CreatePackageCommandError = async (output, context
1494
1258
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1495
1259
  default:
1496
1260
  const parsedBody = parsedOutput.body;
1497
- const $metadata = deserializeMetadata(output);
1498
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1499
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1500
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1501
- $fault: "client",
1502
- $metadata,
1261
+ (0, smithy_client_1.throwDefaultError)({
1262
+ output,
1263
+ parsedBody,
1264
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1265
+ errorCode,
1503
1266
  });
1504
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1505
1267
  }
1506
1268
  };
1507
1269
  const deserializeAws_restJson1DeleteDomainCommand = async (output, context) => {
1508
1270
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1509
1271
  return deserializeAws_restJson1DeleteDomainCommandError(output, context);
1510
1272
  }
1511
- const contents = {
1273
+ const contents = map({
1512
1274
  $metadata: deserializeMetadata(output),
1513
- DomainStatus: undefined,
1514
- };
1275
+ });
1515
1276
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1516
- if (data.DomainStatus !== undefined && data.DomainStatus !== null) {
1277
+ if (data.DomainStatus != null) {
1517
1278
  contents.DomainStatus = deserializeAws_restJson1DomainStatus(data.DomainStatus, context);
1518
1279
  }
1519
- return Promise.resolve(contents);
1280
+ return contents;
1520
1281
  };
1521
1282
  exports.deserializeAws_restJson1DeleteDomainCommand = deserializeAws_restJson1DeleteDomainCommand;
1522
1283
  const deserializeAws_restJson1DeleteDomainCommandError = async (output, context) => {
@@ -1524,7 +1285,6 @@ const deserializeAws_restJson1DeleteDomainCommandError = async (output, context)
1524
1285
  ...output,
1525
1286
  body: await parseBody(output.body, context),
1526
1287
  };
1527
- let response;
1528
1288
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1529
1289
  switch (errorCode) {
1530
1290
  case "BaseException":
@@ -1541,29 +1301,26 @@ const deserializeAws_restJson1DeleteDomainCommandError = async (output, context)
1541
1301
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1542
1302
  default:
1543
1303
  const parsedBody = parsedOutput.body;
1544
- const $metadata = deserializeMetadata(output);
1545
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1546
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1547
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1548
- $fault: "client",
1549
- $metadata,
1304
+ (0, smithy_client_1.throwDefaultError)({
1305
+ output,
1306
+ parsedBody,
1307
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1308
+ errorCode,
1550
1309
  });
1551
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1552
1310
  }
1553
1311
  };
1554
1312
  const deserializeAws_restJson1DeleteInboundConnectionCommand = async (output, context) => {
1555
1313
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1556
1314
  return deserializeAws_restJson1DeleteInboundConnectionCommandError(output, context);
1557
1315
  }
1558
- const contents = {
1316
+ const contents = map({
1559
1317
  $metadata: deserializeMetadata(output),
1560
- Connection: undefined,
1561
- };
1318
+ });
1562
1319
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1563
- if (data.Connection !== undefined && data.Connection !== null) {
1320
+ if (data.Connection != null) {
1564
1321
  contents.Connection = deserializeAws_restJson1InboundConnection(data.Connection, context);
1565
1322
  }
1566
- return Promise.resolve(contents);
1323
+ return contents;
1567
1324
  };
1568
1325
  exports.deserializeAws_restJson1DeleteInboundConnectionCommand = deserializeAws_restJson1DeleteInboundConnectionCommand;
1569
1326
  const deserializeAws_restJson1DeleteInboundConnectionCommandError = async (output, context) => {
@@ -1571,7 +1328,6 @@ const deserializeAws_restJson1DeleteInboundConnectionCommandError = async (outpu
1571
1328
  ...output,
1572
1329
  body: await parseBody(output.body, context),
1573
1330
  };
1574
- let response;
1575
1331
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1576
1332
  switch (errorCode) {
1577
1333
  case "DisabledOperationException":
@@ -1582,29 +1338,26 @@ const deserializeAws_restJson1DeleteInboundConnectionCommandError = async (outpu
1582
1338
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1583
1339
  default:
1584
1340
  const parsedBody = parsedOutput.body;
1585
- const $metadata = deserializeMetadata(output);
1586
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1587
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1588
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1589
- $fault: "client",
1590
- $metadata,
1341
+ (0, smithy_client_1.throwDefaultError)({
1342
+ output,
1343
+ parsedBody,
1344
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1345
+ errorCode,
1591
1346
  });
1592
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1593
1347
  }
1594
1348
  };
1595
1349
  const deserializeAws_restJson1DeleteOutboundConnectionCommand = async (output, context) => {
1596
1350
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1597
1351
  return deserializeAws_restJson1DeleteOutboundConnectionCommandError(output, context);
1598
1352
  }
1599
- const contents = {
1353
+ const contents = map({
1600
1354
  $metadata: deserializeMetadata(output),
1601
- Connection: undefined,
1602
- };
1355
+ });
1603
1356
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1604
- if (data.Connection !== undefined && data.Connection !== null) {
1357
+ if (data.Connection != null) {
1605
1358
  contents.Connection = deserializeAws_restJson1OutboundConnection(data.Connection, context);
1606
1359
  }
1607
- return Promise.resolve(contents);
1360
+ return contents;
1608
1361
  };
1609
1362
  exports.deserializeAws_restJson1DeleteOutboundConnectionCommand = deserializeAws_restJson1DeleteOutboundConnectionCommand;
1610
1363
  const deserializeAws_restJson1DeleteOutboundConnectionCommandError = async (output, context) => {
@@ -1612,7 +1365,6 @@ const deserializeAws_restJson1DeleteOutboundConnectionCommandError = async (outp
1612
1365
  ...output,
1613
1366
  body: await parseBody(output.body, context),
1614
1367
  };
1615
- let response;
1616
1368
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1617
1369
  switch (errorCode) {
1618
1370
  case "DisabledOperationException":
@@ -1623,29 +1375,26 @@ const deserializeAws_restJson1DeleteOutboundConnectionCommandError = async (outp
1623
1375
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1624
1376
  default:
1625
1377
  const parsedBody = parsedOutput.body;
1626
- const $metadata = deserializeMetadata(output);
1627
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1628
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1629
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1630
- $fault: "client",
1631
- $metadata,
1378
+ (0, smithy_client_1.throwDefaultError)({
1379
+ output,
1380
+ parsedBody,
1381
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1382
+ errorCode,
1632
1383
  });
1633
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1634
1384
  }
1635
1385
  };
1636
1386
  const deserializeAws_restJson1DeletePackageCommand = async (output, context) => {
1637
1387
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1638
1388
  return deserializeAws_restJson1DeletePackageCommandError(output, context);
1639
1389
  }
1640
- const contents = {
1390
+ const contents = map({
1641
1391
  $metadata: deserializeMetadata(output),
1642
- PackageDetails: undefined,
1643
- };
1392
+ });
1644
1393
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1645
- if (data.PackageDetails !== undefined && data.PackageDetails !== null) {
1394
+ if (data.PackageDetails != null) {
1646
1395
  contents.PackageDetails = deserializeAws_restJson1PackageDetails(data.PackageDetails, context);
1647
1396
  }
1648
- return Promise.resolve(contents);
1397
+ return contents;
1649
1398
  };
1650
1399
  exports.deserializeAws_restJson1DeletePackageCommand = deserializeAws_restJson1DeletePackageCommand;
1651
1400
  const deserializeAws_restJson1DeletePackageCommandError = async (output, context) => {
@@ -1653,7 +1402,6 @@ const deserializeAws_restJson1DeletePackageCommandError = async (output, context
1653
1402
  ...output,
1654
1403
  body: await parseBody(output.body, context),
1655
1404
  };
1656
- let response;
1657
1405
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1658
1406
  switch (errorCode) {
1659
1407
  case "AccessDeniedException":
@@ -1676,29 +1424,26 @@ const deserializeAws_restJson1DeletePackageCommandError = async (output, context
1676
1424
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1677
1425
  default:
1678
1426
  const parsedBody = parsedOutput.body;
1679
- const $metadata = deserializeMetadata(output);
1680
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1681
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1682
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1683
- $fault: "client",
1684
- $metadata,
1427
+ (0, smithy_client_1.throwDefaultError)({
1428
+ output,
1429
+ parsedBody,
1430
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1431
+ errorCode,
1685
1432
  });
1686
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1687
1433
  }
1688
1434
  };
1689
1435
  const deserializeAws_restJson1DescribeDomainCommand = async (output, context) => {
1690
1436
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1691
1437
  return deserializeAws_restJson1DescribeDomainCommandError(output, context);
1692
1438
  }
1693
- const contents = {
1439
+ const contents = map({
1694
1440
  $metadata: deserializeMetadata(output),
1695
- DomainStatus: undefined,
1696
- };
1441
+ });
1697
1442
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1698
- if (data.DomainStatus !== undefined && data.DomainStatus !== null) {
1443
+ if (data.DomainStatus != null) {
1699
1444
  contents.DomainStatus = deserializeAws_restJson1DomainStatus(data.DomainStatus, context);
1700
1445
  }
1701
- return Promise.resolve(contents);
1446
+ return contents;
1702
1447
  };
1703
1448
  exports.deserializeAws_restJson1DescribeDomainCommand = deserializeAws_restJson1DescribeDomainCommand;
1704
1449
  const deserializeAws_restJson1DescribeDomainCommandError = async (output, context) => {
@@ -1706,7 +1451,6 @@ const deserializeAws_restJson1DescribeDomainCommandError = async (output, contex
1706
1451
  ...output,
1707
1452
  body: await parseBody(output.body, context),
1708
1453
  };
1709
- let response;
1710
1454
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1711
1455
  switch (errorCode) {
1712
1456
  case "BaseException":
@@ -1723,33 +1467,29 @@ const deserializeAws_restJson1DescribeDomainCommandError = async (output, contex
1723
1467
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1724
1468
  default:
1725
1469
  const parsedBody = parsedOutput.body;
1726
- const $metadata = deserializeMetadata(output);
1727
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1728
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1729
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1730
- $fault: "client",
1731
- $metadata,
1470
+ (0, smithy_client_1.throwDefaultError)({
1471
+ output,
1472
+ parsedBody,
1473
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1474
+ errorCode,
1732
1475
  });
1733
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1734
1476
  }
1735
1477
  };
1736
1478
  const deserializeAws_restJson1DescribeDomainAutoTunesCommand = async (output, context) => {
1737
1479
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1738
1480
  return deserializeAws_restJson1DescribeDomainAutoTunesCommandError(output, context);
1739
1481
  }
1740
- const contents = {
1482
+ const contents = map({
1741
1483
  $metadata: deserializeMetadata(output),
1742
- AutoTunes: undefined,
1743
- NextToken: undefined,
1744
- };
1484
+ });
1745
1485
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1746
- if (data.AutoTunes !== undefined && data.AutoTunes !== null) {
1486
+ if (data.AutoTunes != null) {
1747
1487
  contents.AutoTunes = deserializeAws_restJson1AutoTuneList(data.AutoTunes, context);
1748
1488
  }
1749
- if (data.NextToken !== undefined && data.NextToken !== null) {
1489
+ if (data.NextToken != null) {
1750
1490
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1751
1491
  }
1752
- return Promise.resolve(contents);
1492
+ return contents;
1753
1493
  };
1754
1494
  exports.deserializeAws_restJson1DescribeDomainAutoTunesCommand = deserializeAws_restJson1DescribeDomainAutoTunesCommand;
1755
1495
  const deserializeAws_restJson1DescribeDomainAutoTunesCommandError = async (output, context) => {
@@ -1757,7 +1497,6 @@ const deserializeAws_restJson1DescribeDomainAutoTunesCommandError = async (outpu
1757
1497
  ...output,
1758
1498
  body: await parseBody(output.body, context),
1759
1499
  };
1760
- let response;
1761
1500
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1762
1501
  switch (errorCode) {
1763
1502
  case "BaseException":
@@ -1774,29 +1513,26 @@ const deserializeAws_restJson1DescribeDomainAutoTunesCommandError = async (outpu
1774
1513
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1775
1514
  default:
1776
1515
  const parsedBody = parsedOutput.body;
1777
- const $metadata = deserializeMetadata(output);
1778
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1779
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1780
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1781
- $fault: "client",
1782
- $metadata,
1516
+ (0, smithy_client_1.throwDefaultError)({
1517
+ output,
1518
+ parsedBody,
1519
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1520
+ errorCode,
1783
1521
  });
1784
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1785
1522
  }
1786
1523
  };
1787
1524
  const deserializeAws_restJson1DescribeDomainChangeProgressCommand = async (output, context) => {
1788
1525
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1789
1526
  return deserializeAws_restJson1DescribeDomainChangeProgressCommandError(output, context);
1790
1527
  }
1791
- const contents = {
1528
+ const contents = map({
1792
1529
  $metadata: deserializeMetadata(output),
1793
- ChangeProgressStatus: undefined,
1794
- };
1530
+ });
1795
1531
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1796
- if (data.ChangeProgressStatus !== undefined && data.ChangeProgressStatus !== null) {
1532
+ if (data.ChangeProgressStatus != null) {
1797
1533
  contents.ChangeProgressStatus = deserializeAws_restJson1ChangeProgressStatusDetails(data.ChangeProgressStatus, context);
1798
1534
  }
1799
- return Promise.resolve(contents);
1535
+ return contents;
1800
1536
  };
1801
1537
  exports.deserializeAws_restJson1DescribeDomainChangeProgressCommand = deserializeAws_restJson1DescribeDomainChangeProgressCommand;
1802
1538
  const deserializeAws_restJson1DescribeDomainChangeProgressCommandError = async (output, context) => {
@@ -1804,7 +1540,6 @@ const deserializeAws_restJson1DescribeDomainChangeProgressCommandError = async (
1804
1540
  ...output,
1805
1541
  body: await parseBody(output.body, context),
1806
1542
  };
1807
- let response;
1808
1543
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1809
1544
  switch (errorCode) {
1810
1545
  case "BaseException":
@@ -1821,29 +1556,26 @@ const deserializeAws_restJson1DescribeDomainChangeProgressCommandError = async (
1821
1556
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1822
1557
  default:
1823
1558
  const parsedBody = parsedOutput.body;
1824
- const $metadata = deserializeMetadata(output);
1825
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1826
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1827
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1828
- $fault: "client",
1829
- $metadata,
1559
+ (0, smithy_client_1.throwDefaultError)({
1560
+ output,
1561
+ parsedBody,
1562
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1563
+ errorCode,
1830
1564
  });
1831
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1832
1565
  }
1833
1566
  };
1834
1567
  const deserializeAws_restJson1DescribeDomainConfigCommand = async (output, context) => {
1835
1568
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1836
1569
  return deserializeAws_restJson1DescribeDomainConfigCommandError(output, context);
1837
1570
  }
1838
- const contents = {
1571
+ const contents = map({
1839
1572
  $metadata: deserializeMetadata(output),
1840
- DomainConfig: undefined,
1841
- };
1573
+ });
1842
1574
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1843
- if (data.DomainConfig !== undefined && data.DomainConfig !== null) {
1575
+ if (data.DomainConfig != null) {
1844
1576
  contents.DomainConfig = deserializeAws_restJson1DomainConfig(data.DomainConfig, context);
1845
1577
  }
1846
- return Promise.resolve(contents);
1578
+ return contents;
1847
1579
  };
1848
1580
  exports.deserializeAws_restJson1DescribeDomainConfigCommand = deserializeAws_restJson1DescribeDomainConfigCommand;
1849
1581
  const deserializeAws_restJson1DescribeDomainConfigCommandError = async (output, context) => {
@@ -1851,7 +1583,6 @@ const deserializeAws_restJson1DescribeDomainConfigCommandError = async (output,
1851
1583
  ...output,
1852
1584
  body: await parseBody(output.body, context),
1853
1585
  };
1854
- let response;
1855
1586
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1856
1587
  switch (errorCode) {
1857
1588
  case "BaseException":
@@ -1868,29 +1599,26 @@ const deserializeAws_restJson1DescribeDomainConfigCommandError = async (output,
1868
1599
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1869
1600
  default:
1870
1601
  const parsedBody = parsedOutput.body;
1871
- const $metadata = deserializeMetadata(output);
1872
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1873
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1874
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1875
- $fault: "client",
1876
- $metadata,
1602
+ (0, smithy_client_1.throwDefaultError)({
1603
+ output,
1604
+ parsedBody,
1605
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1606
+ errorCode,
1877
1607
  });
1878
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1879
1608
  }
1880
1609
  };
1881
1610
  const deserializeAws_restJson1DescribeDomainsCommand = async (output, context) => {
1882
1611
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1883
1612
  return deserializeAws_restJson1DescribeDomainsCommandError(output, context);
1884
1613
  }
1885
- const contents = {
1614
+ const contents = map({
1886
1615
  $metadata: deserializeMetadata(output),
1887
- DomainStatusList: undefined,
1888
- };
1616
+ });
1889
1617
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1890
- if (data.DomainStatusList !== undefined && data.DomainStatusList !== null) {
1618
+ if (data.DomainStatusList != null) {
1891
1619
  contents.DomainStatusList = deserializeAws_restJson1DomainStatusList(data.DomainStatusList, context);
1892
1620
  }
1893
- return Promise.resolve(contents);
1621
+ return contents;
1894
1622
  };
1895
1623
  exports.deserializeAws_restJson1DescribeDomainsCommand = deserializeAws_restJson1DescribeDomainsCommand;
1896
1624
  const deserializeAws_restJson1DescribeDomainsCommandError = async (output, context) => {
@@ -1898,7 +1626,6 @@ const deserializeAws_restJson1DescribeDomainsCommandError = async (output, conte
1898
1626
  ...output,
1899
1627
  body: await parseBody(output.body, context),
1900
1628
  };
1901
- let response;
1902
1629
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1903
1630
  switch (errorCode) {
1904
1631
  case "BaseException":
@@ -1912,33 +1639,29 @@ const deserializeAws_restJson1DescribeDomainsCommandError = async (output, conte
1912
1639
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1913
1640
  default:
1914
1641
  const parsedBody = parsedOutput.body;
1915
- const $metadata = deserializeMetadata(output);
1916
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1917
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1918
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1919
- $fault: "client",
1920
- $metadata,
1642
+ (0, smithy_client_1.throwDefaultError)({
1643
+ output,
1644
+ parsedBody,
1645
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1646
+ errorCode,
1921
1647
  });
1922
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1923
1648
  }
1924
1649
  };
1925
1650
  const deserializeAws_restJson1DescribeInboundConnectionsCommand = async (output, context) => {
1926
1651
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1927
1652
  return deserializeAws_restJson1DescribeInboundConnectionsCommandError(output, context);
1928
1653
  }
1929
- const contents = {
1654
+ const contents = map({
1930
1655
  $metadata: deserializeMetadata(output),
1931
- Connections: undefined,
1932
- NextToken: undefined,
1933
- };
1656
+ });
1934
1657
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1935
- if (data.Connections !== undefined && data.Connections !== null) {
1658
+ if (data.Connections != null) {
1936
1659
  contents.Connections = deserializeAws_restJson1InboundConnections(data.Connections, context);
1937
1660
  }
1938
- if (data.NextToken !== undefined && data.NextToken !== null) {
1661
+ if (data.NextToken != null) {
1939
1662
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1940
1663
  }
1941
- return Promise.resolve(contents);
1664
+ return contents;
1942
1665
  };
1943
1666
  exports.deserializeAws_restJson1DescribeInboundConnectionsCommand = deserializeAws_restJson1DescribeInboundConnectionsCommand;
1944
1667
  const deserializeAws_restJson1DescribeInboundConnectionsCommandError = async (output, context) => {
@@ -1946,7 +1669,6 @@ const deserializeAws_restJson1DescribeInboundConnectionsCommandError = async (ou
1946
1669
  ...output,
1947
1670
  body: await parseBody(output.body, context),
1948
1671
  };
1949
- let response;
1950
1672
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1951
1673
  switch (errorCode) {
1952
1674
  case "DisabledOperationException":
@@ -1957,29 +1679,26 @@ const deserializeAws_restJson1DescribeInboundConnectionsCommandError = async (ou
1957
1679
  throw await deserializeAws_restJson1InvalidPaginationTokenExceptionResponse(parsedOutput, context);
1958
1680
  default:
1959
1681
  const parsedBody = parsedOutput.body;
1960
- const $metadata = deserializeMetadata(output);
1961
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1962
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
1963
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1964
- $fault: "client",
1965
- $metadata,
1682
+ (0, smithy_client_1.throwDefaultError)({
1683
+ output,
1684
+ parsedBody,
1685
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1686
+ errorCode,
1966
1687
  });
1967
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1968
1688
  }
1969
1689
  };
1970
1690
  const deserializeAws_restJson1DescribeInstanceTypeLimitsCommand = async (output, context) => {
1971
1691
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1972
1692
  return deserializeAws_restJson1DescribeInstanceTypeLimitsCommandError(output, context);
1973
1693
  }
1974
- const contents = {
1694
+ const contents = map({
1975
1695
  $metadata: deserializeMetadata(output),
1976
- LimitsByRole: undefined,
1977
- };
1696
+ });
1978
1697
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1979
- if (data.LimitsByRole !== undefined && data.LimitsByRole !== null) {
1698
+ if (data.LimitsByRole != null) {
1980
1699
  contents.LimitsByRole = deserializeAws_restJson1LimitsByRole(data.LimitsByRole, context);
1981
1700
  }
1982
- return Promise.resolve(contents);
1701
+ return contents;
1983
1702
  };
1984
1703
  exports.deserializeAws_restJson1DescribeInstanceTypeLimitsCommand = deserializeAws_restJson1DescribeInstanceTypeLimitsCommand;
1985
1704
  const deserializeAws_restJson1DescribeInstanceTypeLimitsCommandError = async (output, context) => {
@@ -1987,7 +1706,6 @@ const deserializeAws_restJson1DescribeInstanceTypeLimitsCommandError = async (ou
1987
1706
  ...output,
1988
1707
  body: await parseBody(output.body, context),
1989
1708
  };
1990
- let response;
1991
1709
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1992
1710
  switch (errorCode) {
1993
1711
  case "BaseException":
@@ -2010,33 +1728,29 @@ const deserializeAws_restJson1DescribeInstanceTypeLimitsCommandError = async (ou
2010
1728
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2011
1729
  default:
2012
1730
  const parsedBody = parsedOutput.body;
2013
- const $metadata = deserializeMetadata(output);
2014
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2015
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2016
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2017
- $fault: "client",
2018
- $metadata,
1731
+ (0, smithy_client_1.throwDefaultError)({
1732
+ output,
1733
+ parsedBody,
1734
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1735
+ errorCode,
2019
1736
  });
2020
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2021
1737
  }
2022
1738
  };
2023
1739
  const deserializeAws_restJson1DescribeOutboundConnectionsCommand = async (output, context) => {
2024
1740
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2025
1741
  return deserializeAws_restJson1DescribeOutboundConnectionsCommandError(output, context);
2026
1742
  }
2027
- const contents = {
1743
+ const contents = map({
2028
1744
  $metadata: deserializeMetadata(output),
2029
- Connections: undefined,
2030
- NextToken: undefined,
2031
- };
1745
+ });
2032
1746
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2033
- if (data.Connections !== undefined && data.Connections !== null) {
1747
+ if (data.Connections != null) {
2034
1748
  contents.Connections = deserializeAws_restJson1OutboundConnections(data.Connections, context);
2035
1749
  }
2036
- if (data.NextToken !== undefined && data.NextToken !== null) {
1750
+ if (data.NextToken != null) {
2037
1751
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2038
1752
  }
2039
- return Promise.resolve(contents);
1753
+ return contents;
2040
1754
  };
2041
1755
  exports.deserializeAws_restJson1DescribeOutboundConnectionsCommand = deserializeAws_restJson1DescribeOutboundConnectionsCommand;
2042
1756
  const deserializeAws_restJson1DescribeOutboundConnectionsCommandError = async (output, context) => {
@@ -2044,7 +1758,6 @@ const deserializeAws_restJson1DescribeOutboundConnectionsCommandError = async (o
2044
1758
  ...output,
2045
1759
  body: await parseBody(output.body, context),
2046
1760
  };
2047
- let response;
2048
1761
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2049
1762
  switch (errorCode) {
2050
1763
  case "DisabledOperationException":
@@ -2055,33 +1768,29 @@ const deserializeAws_restJson1DescribeOutboundConnectionsCommandError = async (o
2055
1768
  throw await deserializeAws_restJson1InvalidPaginationTokenExceptionResponse(parsedOutput, context);
2056
1769
  default:
2057
1770
  const parsedBody = parsedOutput.body;
2058
- const $metadata = deserializeMetadata(output);
2059
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2060
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2061
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2062
- $fault: "client",
2063
- $metadata,
1771
+ (0, smithy_client_1.throwDefaultError)({
1772
+ output,
1773
+ parsedBody,
1774
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1775
+ errorCode,
2064
1776
  });
2065
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2066
1777
  }
2067
1778
  };
2068
1779
  const deserializeAws_restJson1DescribePackagesCommand = async (output, context) => {
2069
1780
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2070
1781
  return deserializeAws_restJson1DescribePackagesCommandError(output, context);
2071
1782
  }
2072
- const contents = {
1783
+ const contents = map({
2073
1784
  $metadata: deserializeMetadata(output),
2074
- NextToken: undefined,
2075
- PackageDetailsList: undefined,
2076
- };
1785
+ });
2077
1786
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2078
- if (data.NextToken !== undefined && data.NextToken !== null) {
1787
+ if (data.NextToken != null) {
2079
1788
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2080
1789
  }
2081
- if (data.PackageDetailsList !== undefined && data.PackageDetailsList !== null) {
1790
+ if (data.PackageDetailsList != null) {
2082
1791
  contents.PackageDetailsList = deserializeAws_restJson1PackageDetailsList(data.PackageDetailsList, context);
2083
1792
  }
2084
- return Promise.resolve(contents);
1793
+ return contents;
2085
1794
  };
2086
1795
  exports.deserializeAws_restJson1DescribePackagesCommand = deserializeAws_restJson1DescribePackagesCommand;
2087
1796
  const deserializeAws_restJson1DescribePackagesCommandError = async (output, context) => {
@@ -2089,7 +1798,6 @@ const deserializeAws_restJson1DescribePackagesCommandError = async (output, cont
2089
1798
  ...output,
2090
1799
  body: await parseBody(output.body, context),
2091
1800
  };
2092
- let response;
2093
1801
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2094
1802
  switch (errorCode) {
2095
1803
  case "AccessDeniedException":
@@ -2109,33 +1817,29 @@ const deserializeAws_restJson1DescribePackagesCommandError = async (output, cont
2109
1817
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2110
1818
  default:
2111
1819
  const parsedBody = parsedOutput.body;
2112
- const $metadata = deserializeMetadata(output);
2113
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2114
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2115
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2116
- $fault: "client",
2117
- $metadata,
1820
+ (0, smithy_client_1.throwDefaultError)({
1821
+ output,
1822
+ parsedBody,
1823
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1824
+ errorCode,
2118
1825
  });
2119
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2120
1826
  }
2121
1827
  };
2122
1828
  const deserializeAws_restJson1DescribeReservedInstanceOfferingsCommand = async (output, context) => {
2123
1829
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2124
1830
  return deserializeAws_restJson1DescribeReservedInstanceOfferingsCommandError(output, context);
2125
1831
  }
2126
- const contents = {
1832
+ const contents = map({
2127
1833
  $metadata: deserializeMetadata(output),
2128
- NextToken: undefined,
2129
- ReservedInstanceOfferings: undefined,
2130
- };
1834
+ });
2131
1835
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2132
- if (data.NextToken !== undefined && data.NextToken !== null) {
1836
+ if (data.NextToken != null) {
2133
1837
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2134
1838
  }
2135
- if (data.ReservedInstanceOfferings !== undefined && data.ReservedInstanceOfferings !== null) {
1839
+ if (data.ReservedInstanceOfferings != null) {
2136
1840
  contents.ReservedInstanceOfferings = deserializeAws_restJson1ReservedInstanceOfferingList(data.ReservedInstanceOfferings, context);
2137
1841
  }
2138
- return Promise.resolve(contents);
1842
+ return contents;
2139
1843
  };
2140
1844
  exports.deserializeAws_restJson1DescribeReservedInstanceOfferingsCommand = deserializeAws_restJson1DescribeReservedInstanceOfferingsCommand;
2141
1845
  const deserializeAws_restJson1DescribeReservedInstanceOfferingsCommandError = async (output, context) => {
@@ -2143,7 +1847,6 @@ const deserializeAws_restJson1DescribeReservedInstanceOfferingsCommandError = as
2143
1847
  ...output,
2144
1848
  body: await parseBody(output.body, context),
2145
1849
  };
2146
- let response;
2147
1850
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2148
1851
  switch (errorCode) {
2149
1852
  case "DisabledOperationException":
@@ -2160,33 +1863,29 @@ const deserializeAws_restJson1DescribeReservedInstanceOfferingsCommandError = as
2160
1863
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2161
1864
  default:
2162
1865
  const parsedBody = parsedOutput.body;
2163
- const $metadata = deserializeMetadata(output);
2164
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2165
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2166
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2167
- $fault: "client",
2168
- $metadata,
1866
+ (0, smithy_client_1.throwDefaultError)({
1867
+ output,
1868
+ parsedBody,
1869
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1870
+ errorCode,
2169
1871
  });
2170
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2171
1872
  }
2172
1873
  };
2173
1874
  const deserializeAws_restJson1DescribeReservedInstancesCommand = async (output, context) => {
2174
1875
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2175
1876
  return deserializeAws_restJson1DescribeReservedInstancesCommandError(output, context);
2176
1877
  }
2177
- const contents = {
1878
+ const contents = map({
2178
1879
  $metadata: deserializeMetadata(output),
2179
- NextToken: undefined,
2180
- ReservedInstances: undefined,
2181
- };
1880
+ });
2182
1881
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2183
- if (data.NextToken !== undefined && data.NextToken !== null) {
1882
+ if (data.NextToken != null) {
2184
1883
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2185
1884
  }
2186
- if (data.ReservedInstances !== undefined && data.ReservedInstances !== null) {
1885
+ if (data.ReservedInstances != null) {
2187
1886
  contents.ReservedInstances = deserializeAws_restJson1ReservedInstanceList(data.ReservedInstances, context);
2188
1887
  }
2189
- return Promise.resolve(contents);
1888
+ return contents;
2190
1889
  };
2191
1890
  exports.deserializeAws_restJson1DescribeReservedInstancesCommand = deserializeAws_restJson1DescribeReservedInstancesCommand;
2192
1891
  const deserializeAws_restJson1DescribeReservedInstancesCommandError = async (output, context) => {
@@ -2194,7 +1893,6 @@ const deserializeAws_restJson1DescribeReservedInstancesCommandError = async (out
2194
1893
  ...output,
2195
1894
  body: await parseBody(output.body, context),
2196
1895
  };
2197
- let response;
2198
1896
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2199
1897
  switch (errorCode) {
2200
1898
  case "DisabledOperationException":
@@ -2211,29 +1909,26 @@ const deserializeAws_restJson1DescribeReservedInstancesCommandError = async (out
2211
1909
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2212
1910
  default:
2213
1911
  const parsedBody = parsedOutput.body;
2214
- const $metadata = deserializeMetadata(output);
2215
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2216
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2217
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2218
- $fault: "client",
2219
- $metadata,
1912
+ (0, smithy_client_1.throwDefaultError)({
1913
+ output,
1914
+ parsedBody,
1915
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1916
+ errorCode,
2220
1917
  });
2221
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2222
1918
  }
2223
1919
  };
2224
1920
  const deserializeAws_restJson1DissociatePackageCommand = async (output, context) => {
2225
1921
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2226
1922
  return deserializeAws_restJson1DissociatePackageCommandError(output, context);
2227
1923
  }
2228
- const contents = {
1924
+ const contents = map({
2229
1925
  $metadata: deserializeMetadata(output),
2230
- DomainPackageDetails: undefined,
2231
- };
1926
+ });
2232
1927
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2233
- if (data.DomainPackageDetails !== undefined && data.DomainPackageDetails !== null) {
1928
+ if (data.DomainPackageDetails != null) {
2234
1929
  contents.DomainPackageDetails = deserializeAws_restJson1DomainPackageDetails(data.DomainPackageDetails, context);
2235
1930
  }
2236
- return Promise.resolve(contents);
1931
+ return contents;
2237
1932
  };
2238
1933
  exports.deserializeAws_restJson1DissociatePackageCommand = deserializeAws_restJson1DissociatePackageCommand;
2239
1934
  const deserializeAws_restJson1DissociatePackageCommandError = async (output, context) => {
@@ -2241,7 +1936,6 @@ const deserializeAws_restJson1DissociatePackageCommandError = async (output, con
2241
1936
  ...output,
2242
1937
  body: await parseBody(output.body, context),
2243
1938
  };
2244
- let response;
2245
1939
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2246
1940
  switch (errorCode) {
2247
1941
  case "AccessDeniedException":
@@ -2264,29 +1958,26 @@ const deserializeAws_restJson1DissociatePackageCommandError = async (output, con
2264
1958
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2265
1959
  default:
2266
1960
  const parsedBody = parsedOutput.body;
2267
- const $metadata = deserializeMetadata(output);
2268
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2269
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2270
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2271
- $fault: "client",
2272
- $metadata,
1961
+ (0, smithy_client_1.throwDefaultError)({
1962
+ output,
1963
+ parsedBody,
1964
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
1965
+ errorCode,
2273
1966
  });
2274
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2275
1967
  }
2276
1968
  };
2277
1969
  const deserializeAws_restJson1GetCompatibleVersionsCommand = async (output, context) => {
2278
1970
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2279
1971
  return deserializeAws_restJson1GetCompatibleVersionsCommandError(output, context);
2280
1972
  }
2281
- const contents = {
1973
+ const contents = map({
2282
1974
  $metadata: deserializeMetadata(output),
2283
- CompatibleVersions: undefined,
2284
- };
1975
+ });
2285
1976
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2286
- if (data.CompatibleVersions !== undefined && data.CompatibleVersions !== null) {
1977
+ if (data.CompatibleVersions != null) {
2287
1978
  contents.CompatibleVersions = deserializeAws_restJson1CompatibleVersionsList(data.CompatibleVersions, context);
2288
1979
  }
2289
- return Promise.resolve(contents);
1980
+ return contents;
2290
1981
  };
2291
1982
  exports.deserializeAws_restJson1GetCompatibleVersionsCommand = deserializeAws_restJson1GetCompatibleVersionsCommand;
2292
1983
  const deserializeAws_restJson1GetCompatibleVersionsCommandError = async (output, context) => {
@@ -2294,7 +1985,6 @@ const deserializeAws_restJson1GetCompatibleVersionsCommandError = async (output,
2294
1985
  ...output,
2295
1986
  body: await parseBody(output.body, context),
2296
1987
  };
2297
- let response;
2298
1988
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2299
1989
  switch (errorCode) {
2300
1990
  case "BaseException":
@@ -2314,37 +2004,32 @@ const deserializeAws_restJson1GetCompatibleVersionsCommandError = async (output,
2314
2004
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2315
2005
  default:
2316
2006
  const parsedBody = parsedOutput.body;
2317
- const $metadata = deserializeMetadata(output);
2318
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2319
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2320
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2321
- $fault: "client",
2322
- $metadata,
2007
+ (0, smithy_client_1.throwDefaultError)({
2008
+ output,
2009
+ parsedBody,
2010
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2011
+ errorCode,
2323
2012
  });
2324
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2325
2013
  }
2326
2014
  };
2327
2015
  const deserializeAws_restJson1GetPackageVersionHistoryCommand = async (output, context) => {
2328
2016
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2329
2017
  return deserializeAws_restJson1GetPackageVersionHistoryCommandError(output, context);
2330
2018
  }
2331
- const contents = {
2019
+ const contents = map({
2332
2020
  $metadata: deserializeMetadata(output),
2333
- NextToken: undefined,
2334
- PackageID: undefined,
2335
- PackageVersionHistoryList: undefined,
2336
- };
2021
+ });
2337
2022
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2338
- if (data.NextToken !== undefined && data.NextToken !== null) {
2023
+ if (data.NextToken != null) {
2339
2024
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2340
2025
  }
2341
- if (data.PackageID !== undefined && data.PackageID !== null) {
2026
+ if (data.PackageID != null) {
2342
2027
  contents.PackageID = (0, smithy_client_1.expectString)(data.PackageID);
2343
2028
  }
2344
- if (data.PackageVersionHistoryList !== undefined && data.PackageVersionHistoryList !== null) {
2029
+ if (data.PackageVersionHistoryList != null) {
2345
2030
  contents.PackageVersionHistoryList = deserializeAws_restJson1PackageVersionHistoryList(data.PackageVersionHistoryList, context);
2346
2031
  }
2347
- return Promise.resolve(contents);
2032
+ return contents;
2348
2033
  };
2349
2034
  exports.deserializeAws_restJson1GetPackageVersionHistoryCommand = deserializeAws_restJson1GetPackageVersionHistoryCommand;
2350
2035
  const deserializeAws_restJson1GetPackageVersionHistoryCommandError = async (output, context) => {
@@ -2352,7 +2037,6 @@ const deserializeAws_restJson1GetPackageVersionHistoryCommandError = async (outp
2352
2037
  ...output,
2353
2038
  body: await parseBody(output.body, context),
2354
2039
  };
2355
- let response;
2356
2040
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2357
2041
  switch (errorCode) {
2358
2042
  case "AccessDeniedException":
@@ -2372,33 +2056,29 @@ const deserializeAws_restJson1GetPackageVersionHistoryCommandError = async (outp
2372
2056
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2373
2057
  default:
2374
2058
  const parsedBody = parsedOutput.body;
2375
- const $metadata = deserializeMetadata(output);
2376
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2377
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2378
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2379
- $fault: "client",
2380
- $metadata,
2059
+ (0, smithy_client_1.throwDefaultError)({
2060
+ output,
2061
+ parsedBody,
2062
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2063
+ errorCode,
2381
2064
  });
2382
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2383
2065
  }
2384
2066
  };
2385
2067
  const deserializeAws_restJson1GetUpgradeHistoryCommand = async (output, context) => {
2386
2068
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2387
2069
  return deserializeAws_restJson1GetUpgradeHistoryCommandError(output, context);
2388
2070
  }
2389
- const contents = {
2071
+ const contents = map({
2390
2072
  $metadata: deserializeMetadata(output),
2391
- NextToken: undefined,
2392
- UpgradeHistories: undefined,
2393
- };
2073
+ });
2394
2074
  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) {
2075
+ if (data.NextToken != null) {
2396
2076
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2397
2077
  }
2398
- if (data.UpgradeHistories !== undefined && data.UpgradeHistories !== null) {
2078
+ if (data.UpgradeHistories != null) {
2399
2079
  contents.UpgradeHistories = deserializeAws_restJson1UpgradeHistoryList(data.UpgradeHistories, context);
2400
2080
  }
2401
- return Promise.resolve(contents);
2081
+ return contents;
2402
2082
  };
2403
2083
  exports.deserializeAws_restJson1GetUpgradeHistoryCommand = deserializeAws_restJson1GetUpgradeHistoryCommand;
2404
2084
  const deserializeAws_restJson1GetUpgradeHistoryCommandError = async (output, context) => {
@@ -2406,7 +2086,6 @@ const deserializeAws_restJson1GetUpgradeHistoryCommandError = async (output, con
2406
2086
  ...output,
2407
2087
  body: await parseBody(output.body, context),
2408
2088
  };
2409
- let response;
2410
2089
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2411
2090
  switch (errorCode) {
2412
2091
  case "BaseException":
@@ -2426,37 +2105,32 @@ const deserializeAws_restJson1GetUpgradeHistoryCommandError = async (output, con
2426
2105
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2427
2106
  default:
2428
2107
  const parsedBody = parsedOutput.body;
2429
- const $metadata = deserializeMetadata(output);
2430
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2431
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2432
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2433
- $fault: "client",
2434
- $metadata,
2108
+ (0, smithy_client_1.throwDefaultError)({
2109
+ output,
2110
+ parsedBody,
2111
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2112
+ errorCode,
2435
2113
  });
2436
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2437
2114
  }
2438
2115
  };
2439
2116
  const deserializeAws_restJson1GetUpgradeStatusCommand = async (output, context) => {
2440
2117
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2441
2118
  return deserializeAws_restJson1GetUpgradeStatusCommandError(output, context);
2442
2119
  }
2443
- const contents = {
2120
+ const contents = map({
2444
2121
  $metadata: deserializeMetadata(output),
2445
- StepStatus: undefined,
2446
- UpgradeName: undefined,
2447
- UpgradeStep: undefined,
2448
- };
2122
+ });
2449
2123
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2450
- if (data.StepStatus !== undefined && data.StepStatus !== null) {
2124
+ if (data.StepStatus != null) {
2451
2125
  contents.StepStatus = (0, smithy_client_1.expectString)(data.StepStatus);
2452
2126
  }
2453
- if (data.UpgradeName !== undefined && data.UpgradeName !== null) {
2127
+ if (data.UpgradeName != null) {
2454
2128
  contents.UpgradeName = (0, smithy_client_1.expectString)(data.UpgradeName);
2455
2129
  }
2456
- if (data.UpgradeStep !== undefined && data.UpgradeStep !== null) {
2130
+ if (data.UpgradeStep != null) {
2457
2131
  contents.UpgradeStep = (0, smithy_client_1.expectString)(data.UpgradeStep);
2458
2132
  }
2459
- return Promise.resolve(contents);
2133
+ return contents;
2460
2134
  };
2461
2135
  exports.deserializeAws_restJson1GetUpgradeStatusCommand = deserializeAws_restJson1GetUpgradeStatusCommand;
2462
2136
  const deserializeAws_restJson1GetUpgradeStatusCommandError = async (output, context) => {
@@ -2464,7 +2138,6 @@ const deserializeAws_restJson1GetUpgradeStatusCommandError = async (output, cont
2464
2138
  ...output,
2465
2139
  body: await parseBody(output.body, context),
2466
2140
  };
2467
- let response;
2468
2141
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2469
2142
  switch (errorCode) {
2470
2143
  case "BaseException":
@@ -2484,29 +2157,26 @@ const deserializeAws_restJson1GetUpgradeStatusCommandError = async (output, cont
2484
2157
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2485
2158
  default:
2486
2159
  const parsedBody = parsedOutput.body;
2487
- const $metadata = deserializeMetadata(output);
2488
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2489
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2490
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2491
- $fault: "client",
2492
- $metadata,
2160
+ (0, smithy_client_1.throwDefaultError)({
2161
+ output,
2162
+ parsedBody,
2163
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2164
+ errorCode,
2493
2165
  });
2494
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2495
2166
  }
2496
2167
  };
2497
2168
  const deserializeAws_restJson1ListDomainNamesCommand = async (output, context) => {
2498
2169
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2499
2170
  return deserializeAws_restJson1ListDomainNamesCommandError(output, context);
2500
2171
  }
2501
- const contents = {
2172
+ const contents = map({
2502
2173
  $metadata: deserializeMetadata(output),
2503
- DomainNames: undefined,
2504
- };
2174
+ });
2505
2175
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2506
- if (data.DomainNames !== undefined && data.DomainNames !== null) {
2176
+ if (data.DomainNames != null) {
2507
2177
  contents.DomainNames = deserializeAws_restJson1DomainInfoList(data.DomainNames, context);
2508
2178
  }
2509
- return Promise.resolve(contents);
2179
+ return contents;
2510
2180
  };
2511
2181
  exports.deserializeAws_restJson1ListDomainNamesCommand = deserializeAws_restJson1ListDomainNamesCommand;
2512
2182
  const deserializeAws_restJson1ListDomainNamesCommandError = async (output, context) => {
@@ -2514,7 +2184,6 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
2514
2184
  ...output,
2515
2185
  body: await parseBody(output.body, context),
2516
2186
  };
2517
- let response;
2518
2187
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2519
2188
  switch (errorCode) {
2520
2189
  case "BaseException":
@@ -2525,33 +2194,29 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
2525
2194
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2526
2195
  default:
2527
2196
  const parsedBody = parsedOutput.body;
2528
- const $metadata = deserializeMetadata(output);
2529
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2530
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2531
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2532
- $fault: "client",
2533
- $metadata,
2197
+ (0, smithy_client_1.throwDefaultError)({
2198
+ output,
2199
+ parsedBody,
2200
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2201
+ errorCode,
2534
2202
  });
2535
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2536
2203
  }
2537
2204
  };
2538
2205
  const deserializeAws_restJson1ListDomainsForPackageCommand = async (output, context) => {
2539
2206
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2540
2207
  return deserializeAws_restJson1ListDomainsForPackageCommandError(output, context);
2541
2208
  }
2542
- const contents = {
2209
+ const contents = map({
2543
2210
  $metadata: deserializeMetadata(output),
2544
- DomainPackageDetailsList: undefined,
2545
- NextToken: undefined,
2546
- };
2211
+ });
2547
2212
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2548
- if (data.DomainPackageDetailsList !== undefined && data.DomainPackageDetailsList !== null) {
2213
+ if (data.DomainPackageDetailsList != null) {
2549
2214
  contents.DomainPackageDetailsList = deserializeAws_restJson1DomainPackageDetailsList(data.DomainPackageDetailsList, context);
2550
2215
  }
2551
- if (data.NextToken !== undefined && data.NextToken !== null) {
2216
+ if (data.NextToken != null) {
2552
2217
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2553
2218
  }
2554
- return Promise.resolve(contents);
2219
+ return contents;
2555
2220
  };
2556
2221
  exports.deserializeAws_restJson1ListDomainsForPackageCommand = deserializeAws_restJson1ListDomainsForPackageCommand;
2557
2222
  const deserializeAws_restJson1ListDomainsForPackageCommandError = async (output, context) => {
@@ -2559,7 +2224,6 @@ const deserializeAws_restJson1ListDomainsForPackageCommandError = async (output,
2559
2224
  ...output,
2560
2225
  body: await parseBody(output.body, context),
2561
2226
  };
2562
- let response;
2563
2227
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2564
2228
  switch (errorCode) {
2565
2229
  case "AccessDeniedException":
@@ -2579,33 +2243,29 @@ const deserializeAws_restJson1ListDomainsForPackageCommandError = async (output,
2579
2243
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2580
2244
  default:
2581
2245
  const parsedBody = parsedOutput.body;
2582
- const $metadata = deserializeMetadata(output);
2583
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2584
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2585
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2586
- $fault: "client",
2587
- $metadata,
2246
+ (0, smithy_client_1.throwDefaultError)({
2247
+ output,
2248
+ parsedBody,
2249
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2250
+ errorCode,
2588
2251
  });
2589
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2590
2252
  }
2591
2253
  };
2592
2254
  const deserializeAws_restJson1ListInstanceTypeDetailsCommand = async (output, context) => {
2593
2255
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2594
2256
  return deserializeAws_restJson1ListInstanceTypeDetailsCommandError(output, context);
2595
2257
  }
2596
- const contents = {
2258
+ const contents = map({
2597
2259
  $metadata: deserializeMetadata(output),
2598
- InstanceTypeDetails: undefined,
2599
- NextToken: undefined,
2600
- };
2260
+ });
2601
2261
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2602
- if (data.InstanceTypeDetails !== undefined && data.InstanceTypeDetails !== null) {
2262
+ if (data.InstanceTypeDetails != null) {
2603
2263
  contents.InstanceTypeDetails = deserializeAws_restJson1InstanceTypeDetailsList(data.InstanceTypeDetails, context);
2604
2264
  }
2605
- if (data.NextToken !== undefined && data.NextToken !== null) {
2265
+ if (data.NextToken != null) {
2606
2266
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2607
2267
  }
2608
- return Promise.resolve(contents);
2268
+ return contents;
2609
2269
  };
2610
2270
  exports.deserializeAws_restJson1ListInstanceTypeDetailsCommand = deserializeAws_restJson1ListInstanceTypeDetailsCommand;
2611
2271
  const deserializeAws_restJson1ListInstanceTypeDetailsCommandError = async (output, context) => {
@@ -2613,7 +2273,6 @@ const deserializeAws_restJson1ListInstanceTypeDetailsCommandError = async (outpu
2613
2273
  ...output,
2614
2274
  body: await parseBody(output.body, context),
2615
2275
  };
2616
- let response;
2617
2276
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2618
2277
  switch (errorCode) {
2619
2278
  case "BaseException":
@@ -2630,33 +2289,29 @@ const deserializeAws_restJson1ListInstanceTypeDetailsCommandError = async (outpu
2630
2289
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2631
2290
  default:
2632
2291
  const parsedBody = parsedOutput.body;
2633
- const $metadata = deserializeMetadata(output);
2634
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2635
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2636
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2637
- $fault: "client",
2638
- $metadata,
2292
+ (0, smithy_client_1.throwDefaultError)({
2293
+ output,
2294
+ parsedBody,
2295
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2296
+ errorCode,
2639
2297
  });
2640
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2641
2298
  }
2642
2299
  };
2643
2300
  const deserializeAws_restJson1ListPackagesForDomainCommand = async (output, context) => {
2644
2301
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2645
2302
  return deserializeAws_restJson1ListPackagesForDomainCommandError(output, context);
2646
2303
  }
2647
- const contents = {
2304
+ const contents = map({
2648
2305
  $metadata: deserializeMetadata(output),
2649
- DomainPackageDetailsList: undefined,
2650
- NextToken: undefined,
2651
- };
2306
+ });
2652
2307
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2653
- if (data.DomainPackageDetailsList !== undefined && data.DomainPackageDetailsList !== null) {
2308
+ if (data.DomainPackageDetailsList != null) {
2654
2309
  contents.DomainPackageDetailsList = deserializeAws_restJson1DomainPackageDetailsList(data.DomainPackageDetailsList, context);
2655
2310
  }
2656
- if (data.NextToken !== undefined && data.NextToken !== null) {
2311
+ if (data.NextToken != null) {
2657
2312
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2658
2313
  }
2659
- return Promise.resolve(contents);
2314
+ return contents;
2660
2315
  };
2661
2316
  exports.deserializeAws_restJson1ListPackagesForDomainCommand = deserializeAws_restJson1ListPackagesForDomainCommand;
2662
2317
  const deserializeAws_restJson1ListPackagesForDomainCommandError = async (output, context) => {
@@ -2664,7 +2319,6 @@ const deserializeAws_restJson1ListPackagesForDomainCommandError = async (output,
2664
2319
  ...output,
2665
2320
  body: await parseBody(output.body, context),
2666
2321
  };
2667
- let response;
2668
2322
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2669
2323
  switch (errorCode) {
2670
2324
  case "AccessDeniedException":
@@ -2684,29 +2338,26 @@ const deserializeAws_restJson1ListPackagesForDomainCommandError = async (output,
2684
2338
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2685
2339
  default:
2686
2340
  const parsedBody = parsedOutput.body;
2687
- const $metadata = deserializeMetadata(output);
2688
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2689
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2690
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2691
- $fault: "client",
2692
- $metadata,
2341
+ (0, smithy_client_1.throwDefaultError)({
2342
+ output,
2343
+ parsedBody,
2344
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2345
+ errorCode,
2693
2346
  });
2694
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2695
2347
  }
2696
2348
  };
2697
2349
  const deserializeAws_restJson1ListTagsCommand = async (output, context) => {
2698
2350
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2699
2351
  return deserializeAws_restJson1ListTagsCommandError(output, context);
2700
2352
  }
2701
- const contents = {
2353
+ const contents = map({
2702
2354
  $metadata: deserializeMetadata(output),
2703
- TagList: undefined,
2704
- };
2355
+ });
2705
2356
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2706
- if (data.TagList !== undefined && data.TagList !== null) {
2357
+ if (data.TagList != null) {
2707
2358
  contents.TagList = deserializeAws_restJson1TagList(data.TagList, context);
2708
2359
  }
2709
- return Promise.resolve(contents);
2360
+ return contents;
2710
2361
  };
2711
2362
  exports.deserializeAws_restJson1ListTagsCommand = deserializeAws_restJson1ListTagsCommand;
2712
2363
  const deserializeAws_restJson1ListTagsCommandError = async (output, context) => {
@@ -2714,7 +2365,6 @@ const deserializeAws_restJson1ListTagsCommandError = async (output, context) =>
2714
2365
  ...output,
2715
2366
  body: await parseBody(output.body, context),
2716
2367
  };
2717
- let response;
2718
2368
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2719
2369
  switch (errorCode) {
2720
2370
  case "BaseException":
@@ -2731,33 +2381,29 @@ const deserializeAws_restJson1ListTagsCommandError = async (output, context) =>
2731
2381
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2732
2382
  default:
2733
2383
  const parsedBody = parsedOutput.body;
2734
- const $metadata = deserializeMetadata(output);
2735
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2736
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2737
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2738
- $fault: "client",
2739
- $metadata,
2384
+ (0, smithy_client_1.throwDefaultError)({
2385
+ output,
2386
+ parsedBody,
2387
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2388
+ errorCode,
2740
2389
  });
2741
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2742
2390
  }
2743
2391
  };
2744
2392
  const deserializeAws_restJson1ListVersionsCommand = async (output, context) => {
2745
2393
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2746
2394
  return deserializeAws_restJson1ListVersionsCommandError(output, context);
2747
2395
  }
2748
- const contents = {
2396
+ const contents = map({
2749
2397
  $metadata: deserializeMetadata(output),
2750
- NextToken: undefined,
2751
- Versions: undefined,
2752
- };
2398
+ });
2753
2399
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2754
- if (data.NextToken !== undefined && data.NextToken !== null) {
2400
+ if (data.NextToken != null) {
2755
2401
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2756
2402
  }
2757
- if (data.Versions !== undefined && data.Versions !== null) {
2403
+ if (data.Versions != null) {
2758
2404
  contents.Versions = deserializeAws_restJson1VersionList(data.Versions, context);
2759
2405
  }
2760
- return Promise.resolve(contents);
2406
+ return contents;
2761
2407
  };
2762
2408
  exports.deserializeAws_restJson1ListVersionsCommand = deserializeAws_restJson1ListVersionsCommand;
2763
2409
  const deserializeAws_restJson1ListVersionsCommandError = async (output, context) => {
@@ -2765,7 +2411,6 @@ const deserializeAws_restJson1ListVersionsCommandError = async (output, context)
2765
2411
  ...output,
2766
2412
  body: await parseBody(output.body, context),
2767
2413
  };
2768
- let response;
2769
2414
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2770
2415
  switch (errorCode) {
2771
2416
  case "BaseException":
@@ -2782,33 +2427,29 @@ const deserializeAws_restJson1ListVersionsCommandError = async (output, context)
2782
2427
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2783
2428
  default:
2784
2429
  const parsedBody = parsedOutput.body;
2785
- const $metadata = deserializeMetadata(output);
2786
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2787
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2788
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2789
- $fault: "client",
2790
- $metadata,
2430
+ (0, smithy_client_1.throwDefaultError)({
2431
+ output,
2432
+ parsedBody,
2433
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2434
+ errorCode,
2791
2435
  });
2792
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2793
2436
  }
2794
2437
  };
2795
2438
  const deserializeAws_restJson1PurchaseReservedInstanceOfferingCommand = async (output, context) => {
2796
2439
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2797
2440
  return deserializeAws_restJson1PurchaseReservedInstanceOfferingCommandError(output, context);
2798
2441
  }
2799
- const contents = {
2442
+ const contents = map({
2800
2443
  $metadata: deserializeMetadata(output),
2801
- ReservationName: undefined,
2802
- ReservedInstanceId: undefined,
2803
- };
2444
+ });
2804
2445
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2805
- if (data.ReservationName !== undefined && data.ReservationName !== null) {
2446
+ if (data.ReservationName != null) {
2806
2447
  contents.ReservationName = (0, smithy_client_1.expectString)(data.ReservationName);
2807
2448
  }
2808
- if (data.ReservedInstanceId !== undefined && data.ReservedInstanceId !== null) {
2449
+ if (data.ReservedInstanceId != null) {
2809
2450
  contents.ReservedInstanceId = (0, smithy_client_1.expectString)(data.ReservedInstanceId);
2810
2451
  }
2811
- return Promise.resolve(contents);
2452
+ return contents;
2812
2453
  };
2813
2454
  exports.deserializeAws_restJson1PurchaseReservedInstanceOfferingCommand = deserializeAws_restJson1PurchaseReservedInstanceOfferingCommand;
2814
2455
  const deserializeAws_restJson1PurchaseReservedInstanceOfferingCommandError = async (output, context) => {
@@ -2816,7 +2457,6 @@ const deserializeAws_restJson1PurchaseReservedInstanceOfferingCommandError = asy
2816
2457
  ...output,
2817
2458
  body: await parseBody(output.body, context),
2818
2459
  };
2819
- let response;
2820
2460
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2821
2461
  switch (errorCode) {
2822
2462
  case "DisabledOperationException":
@@ -2839,29 +2479,26 @@ const deserializeAws_restJson1PurchaseReservedInstanceOfferingCommandError = asy
2839
2479
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2840
2480
  default:
2841
2481
  const parsedBody = parsedOutput.body;
2842
- const $metadata = deserializeMetadata(output);
2843
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2844
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2845
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2846
- $fault: "client",
2847
- $metadata,
2482
+ (0, smithy_client_1.throwDefaultError)({
2483
+ output,
2484
+ parsedBody,
2485
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2486
+ errorCode,
2848
2487
  });
2849
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2850
2488
  }
2851
2489
  };
2852
2490
  const deserializeAws_restJson1RejectInboundConnectionCommand = async (output, context) => {
2853
2491
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2854
2492
  return deserializeAws_restJson1RejectInboundConnectionCommandError(output, context);
2855
2493
  }
2856
- const contents = {
2494
+ const contents = map({
2857
2495
  $metadata: deserializeMetadata(output),
2858
- Connection: undefined,
2859
- };
2496
+ });
2860
2497
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2861
- if (data.Connection !== undefined && data.Connection !== null) {
2498
+ if (data.Connection != null) {
2862
2499
  contents.Connection = deserializeAws_restJson1InboundConnection(data.Connection, context);
2863
2500
  }
2864
- return Promise.resolve(contents);
2501
+ return contents;
2865
2502
  };
2866
2503
  exports.deserializeAws_restJson1RejectInboundConnectionCommand = deserializeAws_restJson1RejectInboundConnectionCommand;
2867
2504
  const deserializeAws_restJson1RejectInboundConnectionCommandError = async (output, context) => {
@@ -2869,7 +2506,6 @@ const deserializeAws_restJson1RejectInboundConnectionCommandError = async (outpu
2869
2506
  ...output,
2870
2507
  body: await parseBody(output.body, context),
2871
2508
  };
2872
- let response;
2873
2509
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2874
2510
  switch (errorCode) {
2875
2511
  case "DisabledOperationException":
@@ -2880,25 +2516,23 @@ const deserializeAws_restJson1RejectInboundConnectionCommandError = async (outpu
2880
2516
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2881
2517
  default:
2882
2518
  const parsedBody = parsedOutput.body;
2883
- const $metadata = deserializeMetadata(output);
2884
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2885
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2886
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2887
- $fault: "client",
2888
- $metadata,
2519
+ (0, smithy_client_1.throwDefaultError)({
2520
+ output,
2521
+ parsedBody,
2522
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2523
+ errorCode,
2889
2524
  });
2890
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2891
2525
  }
2892
2526
  };
2893
2527
  const deserializeAws_restJson1RemoveTagsCommand = async (output, context) => {
2894
2528
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2895
2529
  return deserializeAws_restJson1RemoveTagsCommandError(output, context);
2896
2530
  }
2897
- const contents = {
2531
+ const contents = map({
2898
2532
  $metadata: deserializeMetadata(output),
2899
- };
2533
+ });
2900
2534
  await collectBody(output.body, context);
2901
- return Promise.resolve(contents);
2535
+ return contents;
2902
2536
  };
2903
2537
  exports.deserializeAws_restJson1RemoveTagsCommand = deserializeAws_restJson1RemoveTagsCommand;
2904
2538
  const deserializeAws_restJson1RemoveTagsCommandError = async (output, context) => {
@@ -2906,7 +2540,6 @@ const deserializeAws_restJson1RemoveTagsCommandError = async (output, context) =
2906
2540
  ...output,
2907
2541
  body: await parseBody(output.body, context),
2908
2542
  };
2909
- let response;
2910
2543
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2911
2544
  switch (errorCode) {
2912
2545
  case "BaseException":
@@ -2920,29 +2553,26 @@ const deserializeAws_restJson1RemoveTagsCommandError = async (output, context) =
2920
2553
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2921
2554
  default:
2922
2555
  const parsedBody = parsedOutput.body;
2923
- const $metadata = deserializeMetadata(output);
2924
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2925
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2926
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2927
- $fault: "client",
2928
- $metadata,
2556
+ (0, smithy_client_1.throwDefaultError)({
2557
+ output,
2558
+ parsedBody,
2559
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2560
+ errorCode,
2929
2561
  });
2930
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2931
2562
  }
2932
2563
  };
2933
2564
  const deserializeAws_restJson1StartServiceSoftwareUpdateCommand = async (output, context) => {
2934
2565
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2935
2566
  return deserializeAws_restJson1StartServiceSoftwareUpdateCommandError(output, context);
2936
2567
  }
2937
- const contents = {
2568
+ const contents = map({
2938
2569
  $metadata: deserializeMetadata(output),
2939
- ServiceSoftwareOptions: undefined,
2940
- };
2570
+ });
2941
2571
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2942
- if (data.ServiceSoftwareOptions !== undefined && data.ServiceSoftwareOptions !== null) {
2572
+ if (data.ServiceSoftwareOptions != null) {
2943
2573
  contents.ServiceSoftwareOptions = deserializeAws_restJson1ServiceSoftwareOptions(data.ServiceSoftwareOptions, context);
2944
2574
  }
2945
- return Promise.resolve(contents);
2575
+ return contents;
2946
2576
  };
2947
2577
  exports.deserializeAws_restJson1StartServiceSoftwareUpdateCommand = deserializeAws_restJson1StartServiceSoftwareUpdateCommand;
2948
2578
  const deserializeAws_restJson1StartServiceSoftwareUpdateCommandError = async (output, context) => {
@@ -2950,7 +2580,6 @@ const deserializeAws_restJson1StartServiceSoftwareUpdateCommandError = async (ou
2950
2580
  ...output,
2951
2581
  body: await parseBody(output.body, context),
2952
2582
  };
2953
- let response;
2954
2583
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2955
2584
  switch (errorCode) {
2956
2585
  case "BaseException":
@@ -2967,33 +2596,29 @@ const deserializeAws_restJson1StartServiceSoftwareUpdateCommandError = async (ou
2967
2596
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2968
2597
  default:
2969
2598
  const parsedBody = parsedOutput.body;
2970
- const $metadata = deserializeMetadata(output);
2971
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2972
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
2973
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2974
- $fault: "client",
2975
- $metadata,
2599
+ (0, smithy_client_1.throwDefaultError)({
2600
+ output,
2601
+ parsedBody,
2602
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2603
+ errorCode,
2976
2604
  });
2977
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2978
2605
  }
2979
2606
  };
2980
2607
  const deserializeAws_restJson1UpdateDomainConfigCommand = async (output, context) => {
2981
2608
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2982
2609
  return deserializeAws_restJson1UpdateDomainConfigCommandError(output, context);
2983
2610
  }
2984
- const contents = {
2611
+ const contents = map({
2985
2612
  $metadata: deserializeMetadata(output),
2986
- DomainConfig: undefined,
2987
- DryRunResults: undefined,
2988
- };
2613
+ });
2989
2614
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2990
- if (data.DomainConfig !== undefined && data.DomainConfig !== null) {
2615
+ if (data.DomainConfig != null) {
2991
2616
  contents.DomainConfig = deserializeAws_restJson1DomainConfig(data.DomainConfig, context);
2992
2617
  }
2993
- if (data.DryRunResults !== undefined && data.DryRunResults !== null) {
2618
+ if (data.DryRunResults != null) {
2994
2619
  contents.DryRunResults = deserializeAws_restJson1DryRunResults(data.DryRunResults, context);
2995
2620
  }
2996
- return Promise.resolve(contents);
2621
+ return contents;
2997
2622
  };
2998
2623
  exports.deserializeAws_restJson1UpdateDomainConfigCommand = deserializeAws_restJson1UpdateDomainConfigCommand;
2999
2624
  const deserializeAws_restJson1UpdateDomainConfigCommandError = async (output, context) => {
@@ -3001,7 +2626,6 @@ const deserializeAws_restJson1UpdateDomainConfigCommandError = async (output, co
3001
2626
  ...output,
3002
2627
  body: await parseBody(output.body, context),
3003
2628
  };
3004
- let response;
3005
2629
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3006
2630
  switch (errorCode) {
3007
2631
  case "BaseException":
@@ -3024,29 +2648,26 @@ const deserializeAws_restJson1UpdateDomainConfigCommandError = async (output, co
3024
2648
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3025
2649
  default:
3026
2650
  const parsedBody = parsedOutput.body;
3027
- const $metadata = deserializeMetadata(output);
3028
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3029
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
3030
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3031
- $fault: "client",
3032
- $metadata,
2651
+ (0, smithy_client_1.throwDefaultError)({
2652
+ output,
2653
+ parsedBody,
2654
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2655
+ errorCode,
3033
2656
  });
3034
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3035
2657
  }
3036
2658
  };
3037
2659
  const deserializeAws_restJson1UpdatePackageCommand = async (output, context) => {
3038
2660
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3039
2661
  return deserializeAws_restJson1UpdatePackageCommandError(output, context);
3040
2662
  }
3041
- const contents = {
2663
+ const contents = map({
3042
2664
  $metadata: deserializeMetadata(output),
3043
- PackageDetails: undefined,
3044
- };
2665
+ });
3045
2666
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3046
- if (data.PackageDetails !== undefined && data.PackageDetails !== null) {
2667
+ if (data.PackageDetails != null) {
3047
2668
  contents.PackageDetails = deserializeAws_restJson1PackageDetails(data.PackageDetails, context);
3048
2669
  }
3049
- return Promise.resolve(contents);
2670
+ return contents;
3050
2671
  };
3051
2672
  exports.deserializeAws_restJson1UpdatePackageCommand = deserializeAws_restJson1UpdatePackageCommand;
3052
2673
  const deserializeAws_restJson1UpdatePackageCommandError = async (output, context) => {
@@ -3054,7 +2675,6 @@ const deserializeAws_restJson1UpdatePackageCommandError = async (output, context
3054
2675
  ...output,
3055
2676
  body: await parseBody(output.body, context),
3056
2677
  };
3057
- let response;
3058
2678
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3059
2679
  switch (errorCode) {
3060
2680
  case "AccessDeniedException":
@@ -3077,49 +2697,41 @@ const deserializeAws_restJson1UpdatePackageCommandError = async (output, context
3077
2697
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3078
2698
  default:
3079
2699
  const parsedBody = parsedOutput.body;
3080
- const $metadata = deserializeMetadata(output);
3081
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3082
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
3083
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3084
- $fault: "client",
3085
- $metadata,
2700
+ (0, smithy_client_1.throwDefaultError)({
2701
+ output,
2702
+ parsedBody,
2703
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2704
+ errorCode,
3086
2705
  });
3087
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3088
2706
  }
3089
2707
  };
3090
2708
  const deserializeAws_restJson1UpgradeDomainCommand = async (output, context) => {
3091
2709
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3092
2710
  return deserializeAws_restJson1UpgradeDomainCommandError(output, context);
3093
2711
  }
3094
- const contents = {
2712
+ const contents = map({
3095
2713
  $metadata: deserializeMetadata(output),
3096
- AdvancedOptions: undefined,
3097
- ChangeProgressDetails: undefined,
3098
- DomainName: undefined,
3099
- PerformCheckOnly: undefined,
3100
- TargetVersion: undefined,
3101
- UpgradeId: undefined,
3102
- };
2714
+ });
3103
2715
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3104
- if (data.AdvancedOptions !== undefined && data.AdvancedOptions !== null) {
2716
+ if (data.AdvancedOptions != null) {
3105
2717
  contents.AdvancedOptions = deserializeAws_restJson1AdvancedOptions(data.AdvancedOptions, context);
3106
2718
  }
3107
- if (data.ChangeProgressDetails !== undefined && data.ChangeProgressDetails !== null) {
2719
+ if (data.ChangeProgressDetails != null) {
3108
2720
  contents.ChangeProgressDetails = deserializeAws_restJson1ChangeProgressDetails(data.ChangeProgressDetails, context);
3109
2721
  }
3110
- if (data.DomainName !== undefined && data.DomainName !== null) {
2722
+ if (data.DomainName != null) {
3111
2723
  contents.DomainName = (0, smithy_client_1.expectString)(data.DomainName);
3112
2724
  }
3113
- if (data.PerformCheckOnly !== undefined && data.PerformCheckOnly !== null) {
2725
+ if (data.PerformCheckOnly != null) {
3114
2726
  contents.PerformCheckOnly = (0, smithy_client_1.expectBoolean)(data.PerformCheckOnly);
3115
2727
  }
3116
- if (data.TargetVersion !== undefined && data.TargetVersion !== null) {
2728
+ if (data.TargetVersion != null) {
3117
2729
  contents.TargetVersion = (0, smithy_client_1.expectString)(data.TargetVersion);
3118
2730
  }
3119
- if (data.UpgradeId !== undefined && data.UpgradeId !== null) {
2731
+ if (data.UpgradeId != null) {
3120
2732
  contents.UpgradeId = (0, smithy_client_1.expectString)(data.UpgradeId);
3121
2733
  }
3122
- return Promise.resolve(contents);
2734
+ return contents;
3123
2735
  };
3124
2736
  exports.deserializeAws_restJson1UpgradeDomainCommand = deserializeAws_restJson1UpgradeDomainCommand;
3125
2737
  const deserializeAws_restJson1UpgradeDomainCommandError = async (output, context) => {
@@ -3127,7 +2739,6 @@ const deserializeAws_restJson1UpgradeDomainCommandError = async (output, context
3127
2739
  ...output,
3128
2740
  body: await parseBody(output.body, context),
3129
2741
  };
3130
- let response;
3131
2742
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3132
2743
  switch (errorCode) {
3133
2744
  case "BaseException":
@@ -3150,20 +2761,19 @@ const deserializeAws_restJson1UpgradeDomainCommandError = async (output, context
3150
2761
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3151
2762
  default:
3152
2763
  const parsedBody = parsedOutput.body;
3153
- const $metadata = deserializeMetadata(output);
3154
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3155
- response = new OpenSearchServiceException_1.OpenSearchServiceException({
3156
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3157
- $fault: "client",
3158
- $metadata,
2764
+ (0, smithy_client_1.throwDefaultError)({
2765
+ output,
2766
+ parsedBody,
2767
+ exceptionCtor: OpenSearchServiceException_1.OpenSearchServiceException,
2768
+ errorCode,
3159
2769
  });
3160
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3161
2770
  }
3162
2771
  };
2772
+ const map = smithy_client_1.map;
3163
2773
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
3164
- const contents = {};
2774
+ const contents = map({});
3165
2775
  const data = parsedOutput.body;
3166
- if (data.message !== undefined && data.message !== null) {
2776
+ if (data.message != null) {
3167
2777
  contents.message = (0, smithy_client_1.expectString)(data.message);
3168
2778
  }
3169
2779
  const exception = new models_0_1.AccessDeniedException({
@@ -3173,9 +2783,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
3173
2783
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3174
2784
  };
3175
2785
  const deserializeAws_restJson1BaseExceptionResponse = async (parsedOutput, context) => {
3176
- const contents = {};
2786
+ const contents = map({});
3177
2787
  const data = parsedOutput.body;
3178
- if (data.message !== undefined && data.message !== null) {
2788
+ if (data.message != null) {
3179
2789
  contents.message = (0, smithy_client_1.expectString)(data.message);
3180
2790
  }
3181
2791
  const exception = new models_0_1.BaseException({
@@ -3185,9 +2795,9 @@ const deserializeAws_restJson1BaseExceptionResponse = async (parsedOutput, conte
3185
2795
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3186
2796
  };
3187
2797
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
3188
- const contents = {};
2798
+ const contents = map({});
3189
2799
  const data = parsedOutput.body;
3190
- if (data.message !== undefined && data.message !== null) {
2800
+ if (data.message != null) {
3191
2801
  contents.message = (0, smithy_client_1.expectString)(data.message);
3192
2802
  }
3193
2803
  const exception = new models_0_1.ConflictException({
@@ -3197,9 +2807,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
3197
2807
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3198
2808
  };
3199
2809
  const deserializeAws_restJson1DisabledOperationExceptionResponse = async (parsedOutput, context) => {
3200
- const contents = {};
2810
+ const contents = map({});
3201
2811
  const data = parsedOutput.body;
3202
- if (data.message !== undefined && data.message !== null) {
2812
+ if (data.message != null) {
3203
2813
  contents.message = (0, smithy_client_1.expectString)(data.message);
3204
2814
  }
3205
2815
  const exception = new models_0_1.DisabledOperationException({
@@ -3209,9 +2819,9 @@ const deserializeAws_restJson1DisabledOperationExceptionResponse = async (parsed
3209
2819
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3210
2820
  };
3211
2821
  const deserializeAws_restJson1InternalExceptionResponse = async (parsedOutput, context) => {
3212
- const contents = {};
2822
+ const contents = map({});
3213
2823
  const data = parsedOutput.body;
3214
- if (data.message !== undefined && data.message !== null) {
2824
+ if (data.message != null) {
3215
2825
  contents.message = (0, smithy_client_1.expectString)(data.message);
3216
2826
  }
3217
2827
  const exception = new models_0_1.InternalException({
@@ -3221,9 +2831,9 @@ const deserializeAws_restJson1InternalExceptionResponse = async (parsedOutput, c
3221
2831
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3222
2832
  };
3223
2833
  const deserializeAws_restJson1InvalidPaginationTokenExceptionResponse = async (parsedOutput, context) => {
3224
- const contents = {};
2834
+ const contents = map({});
3225
2835
  const data = parsedOutput.body;
3226
- if (data.message !== undefined && data.message !== null) {
2836
+ if (data.message != null) {
3227
2837
  contents.message = (0, smithy_client_1.expectString)(data.message);
3228
2838
  }
3229
2839
  const exception = new models_0_1.InvalidPaginationTokenException({
@@ -3233,9 +2843,9 @@ const deserializeAws_restJson1InvalidPaginationTokenExceptionResponse = async (p
3233
2843
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3234
2844
  };
3235
2845
  const deserializeAws_restJson1InvalidTypeExceptionResponse = async (parsedOutput, context) => {
3236
- const contents = {};
2846
+ const contents = map({});
3237
2847
  const data = parsedOutput.body;
3238
- if (data.message !== undefined && data.message !== null) {
2848
+ if (data.message != null) {
3239
2849
  contents.message = (0, smithy_client_1.expectString)(data.message);
3240
2850
  }
3241
2851
  const exception = new models_0_1.InvalidTypeException({
@@ -3245,9 +2855,9 @@ const deserializeAws_restJson1InvalidTypeExceptionResponse = async (parsedOutput
3245
2855
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3246
2856
  };
3247
2857
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
3248
- const contents = {};
2858
+ const contents = map({});
3249
2859
  const data = parsedOutput.body;
3250
- if (data.message !== undefined && data.message !== null) {
2860
+ if (data.message != null) {
3251
2861
  contents.message = (0, smithy_client_1.expectString)(data.message);
3252
2862
  }
3253
2863
  const exception = new models_0_1.LimitExceededException({
@@ -3257,9 +2867,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
3257
2867
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3258
2868
  };
3259
2869
  const deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
3260
- const contents = {};
2870
+ const contents = map({});
3261
2871
  const data = parsedOutput.body;
3262
- if (data.message !== undefined && data.message !== null) {
2872
+ if (data.message != null) {
3263
2873
  contents.message = (0, smithy_client_1.expectString)(data.message);
3264
2874
  }
3265
2875
  const exception = new models_0_1.ResourceAlreadyExistsException({
@@ -3269,9 +2879,9 @@ const deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = async (pa
3269
2879
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3270
2880
  };
3271
2881
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
3272
- const contents = {};
2882
+ const contents = map({});
3273
2883
  const data = parsedOutput.body;
3274
- if (data.message !== undefined && data.message !== null) {
2884
+ if (data.message != null) {
3275
2885
  contents.message = (0, smithy_client_1.expectString)(data.message);
3276
2886
  }
3277
2887
  const exception = new models_0_1.ResourceNotFoundException({
@@ -3281,9 +2891,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
3281
2891
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3282
2892
  };
3283
2893
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
3284
- const contents = {};
2894
+ const contents = map({});
3285
2895
  const data = parsedOutput.body;
3286
- if (data.message !== undefined && data.message !== null) {
2896
+ if (data.message != null) {
3287
2897
  contents.message = (0, smithy_client_1.expectString)(data.message);
3288
2898
  }
3289
2899
  const exception = new models_0_1.ValidationException({
@@ -3331,9 +2941,6 @@ const serializeAws_restJson1AutoTuneMaintenanceScheduleList = (input, context) =
3331
2941
  return input
3332
2942
  .filter((e) => e != null)
3333
2943
  .map((entry) => {
3334
- if (entry === null) {
3335
- return null;
3336
- }
3337
2944
  return serializeAws_restJson1AutoTuneMaintenanceSchedule(entry, context);
3338
2945
  });
3339
2946
  };
@@ -3403,9 +3010,6 @@ const serializeAws_restJson1DescribePackagesFilterList = (input, context) => {
3403
3010
  return input
3404
3011
  .filter((e) => e != null)
3405
3012
  .map((entry) => {
3406
- if (entry === null) {
3407
- return null;
3408
- }
3409
3013
  return serializeAws_restJson1DescribePackagesFilter(entry, context);
3410
3014
  });
3411
3015
  };
@@ -3413,9 +3017,6 @@ const serializeAws_restJson1DescribePackagesFilterValues = (input, context) => {
3413
3017
  return input
3414
3018
  .filter((e) => e != null)
3415
3019
  .map((entry) => {
3416
- if (entry === null) {
3417
- return null;
3418
- }
3419
3020
  return entry;
3420
3021
  });
3421
3022
  };
@@ -3441,9 +3042,6 @@ const serializeAws_restJson1DomainNameList = (input, context) => {
3441
3042
  return input
3442
3043
  .filter((e) => e != null)
3443
3044
  .map((entry) => {
3444
- if (entry === null) {
3445
- return null;
3446
- }
3447
3045
  return entry;
3448
3046
  });
3449
3047
  };
@@ -3478,9 +3076,6 @@ const serializeAws_restJson1FilterList = (input, context) => {
3478
3076
  return input
3479
3077
  .filter((e) => e != null)
3480
3078
  .map((entry) => {
3481
- if (entry === null) {
3482
- return null;
3483
- }
3484
3079
  return serializeAws_restJson1Filter(entry, context);
3485
3080
  });
3486
3081
  };
@@ -3545,9 +3140,6 @@ const serializeAws_restJson1StringList = (input, context) => {
3545
3140
  return input
3546
3141
  .filter((e) => e != null)
3547
3142
  .map((entry) => {
3548
- if (entry === null) {
3549
- return null;
3550
- }
3551
3143
  return entry;
3552
3144
  });
3553
3145
  };
@@ -3561,9 +3153,6 @@ const serializeAws_restJson1TagList = (input, context) => {
3561
3153
  return input
3562
3154
  .filter((e) => e != null)
3563
3155
  .map((entry) => {
3564
- if (entry === null) {
3565
- return null;
3566
- }
3567
3156
  return serializeAws_restJson1Tag(entry, context);
3568
3157
  });
3569
3158
  };
@@ -3571,9 +3160,6 @@ const serializeAws_restJson1ValueStringList = (input, context) => {
3571
3160
  return input
3572
3161
  .filter((e) => e != null)
3573
3162
  .map((entry) => {
3574
- if (entry === null) {
3575
- return null;
3576
- }
3577
3163
  return entry;
3578
3164
  });
3579
3165
  };