@aws-sdk/client-cloudhsm-v2 3.310.0 → 3.315.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.
@@ -1,140 +1,95 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { CloudHSMV2ServiceException as __BaseException } from "../models/CloudHSMV2ServiceException";
4
4
  import { CloudHsmAccessDeniedException, CloudHsmInternalFailureException, CloudHsmInvalidRequestException, CloudHsmResourceNotFoundException, CloudHsmServiceException, CloudHsmTagException, } from "../models/models_0";
5
5
  export const se_CopyBackupToRegionCommand = async (input, context) => {
6
- const headers = {
7
- "content-type": "application/x-amz-json-1.1",
8
- "x-amz-target": "BaldrApiService.CopyBackupToRegion",
9
- };
6
+ const headers = sharedHeaders("CopyBackupToRegion");
10
7
  let body;
11
- body = JSON.stringify(se_CopyBackupToRegionRequest(input, context));
8
+ body = JSON.stringify(_json(input));
12
9
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
13
10
  };
14
11
  export const se_CreateClusterCommand = async (input, context) => {
15
- const headers = {
16
- "content-type": "application/x-amz-json-1.1",
17
- "x-amz-target": "BaldrApiService.CreateCluster",
18
- };
12
+ const headers = sharedHeaders("CreateCluster");
19
13
  let body;
20
- body = JSON.stringify(se_CreateClusterRequest(input, context));
14
+ body = JSON.stringify(_json(input));
21
15
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
22
16
  };
23
17
  export const se_CreateHsmCommand = async (input, context) => {
24
- const headers = {
25
- "content-type": "application/x-amz-json-1.1",
26
- "x-amz-target": "BaldrApiService.CreateHsm",
27
- };
18
+ const headers = sharedHeaders("CreateHsm");
28
19
  let body;
29
- body = JSON.stringify(se_CreateHsmRequest(input, context));
20
+ body = JSON.stringify(_json(input));
30
21
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
31
22
  };
32
23
  export const se_DeleteBackupCommand = async (input, context) => {
33
- const headers = {
34
- "content-type": "application/x-amz-json-1.1",
35
- "x-amz-target": "BaldrApiService.DeleteBackup",
36
- };
24
+ const headers = sharedHeaders("DeleteBackup");
37
25
  let body;
38
- body = JSON.stringify(se_DeleteBackupRequest(input, context));
26
+ body = JSON.stringify(_json(input));
39
27
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
40
28
  };
41
29
  export const se_DeleteClusterCommand = async (input, context) => {
42
- const headers = {
43
- "content-type": "application/x-amz-json-1.1",
44
- "x-amz-target": "BaldrApiService.DeleteCluster",
45
- };
30
+ const headers = sharedHeaders("DeleteCluster");
46
31
  let body;
47
- body = JSON.stringify(se_DeleteClusterRequest(input, context));
32
+ body = JSON.stringify(_json(input));
48
33
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
49
34
  };
50
35
  export const se_DeleteHsmCommand = async (input, context) => {
51
- const headers = {
52
- "content-type": "application/x-amz-json-1.1",
53
- "x-amz-target": "BaldrApiService.DeleteHsm",
54
- };
36
+ const headers = sharedHeaders("DeleteHsm");
55
37
  let body;
56
- body = JSON.stringify(se_DeleteHsmRequest(input, context));
38
+ body = JSON.stringify(_json(input));
57
39
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
58
40
  };
59
41
  export const se_DescribeBackupsCommand = async (input, context) => {
60
- const headers = {
61
- "content-type": "application/x-amz-json-1.1",
62
- "x-amz-target": "BaldrApiService.DescribeBackups",
63
- };
42
+ const headers = sharedHeaders("DescribeBackups");
64
43
  let body;
65
- body = JSON.stringify(se_DescribeBackupsRequest(input, context));
44
+ body = JSON.stringify(_json(input));
66
45
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
67
46
  };
68
47
  export const se_DescribeClustersCommand = async (input, context) => {
69
- const headers = {
70
- "content-type": "application/x-amz-json-1.1",
71
- "x-amz-target": "BaldrApiService.DescribeClusters",
72
- };
48
+ const headers = sharedHeaders("DescribeClusters");
73
49
  let body;
74
- body = JSON.stringify(se_DescribeClustersRequest(input, context));
50
+ body = JSON.stringify(_json(input));
75
51
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
76
52
  };
77
53
  export const se_InitializeClusterCommand = async (input, context) => {
78
- const headers = {
79
- "content-type": "application/x-amz-json-1.1",
80
- "x-amz-target": "BaldrApiService.InitializeCluster",
81
- };
54
+ const headers = sharedHeaders("InitializeCluster");
82
55
  let body;
83
- body = JSON.stringify(se_InitializeClusterRequest(input, context));
56
+ body = JSON.stringify(_json(input));
84
57
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
85
58
  };
86
59
  export const se_ListTagsCommand = async (input, context) => {
87
- const headers = {
88
- "content-type": "application/x-amz-json-1.1",
89
- "x-amz-target": "BaldrApiService.ListTags",
90
- };
60
+ const headers = sharedHeaders("ListTags");
91
61
  let body;
92
- body = JSON.stringify(se_ListTagsRequest(input, context));
62
+ body = JSON.stringify(_json(input));
93
63
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
94
64
  };
95
65
  export const se_ModifyBackupAttributesCommand = async (input, context) => {
96
- const headers = {
97
- "content-type": "application/x-amz-json-1.1",
98
- "x-amz-target": "BaldrApiService.ModifyBackupAttributes",
99
- };
66
+ const headers = sharedHeaders("ModifyBackupAttributes");
100
67
  let body;
101
- body = JSON.stringify(se_ModifyBackupAttributesRequest(input, context));
68
+ body = JSON.stringify(_json(input));
102
69
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
103
70
  };
104
71
  export const se_ModifyClusterCommand = async (input, context) => {
105
- const headers = {
106
- "content-type": "application/x-amz-json-1.1",
107
- "x-amz-target": "BaldrApiService.ModifyCluster",
108
- };
72
+ const headers = sharedHeaders("ModifyCluster");
109
73
  let body;
110
- body = JSON.stringify(se_ModifyClusterRequest(input, context));
74
+ body = JSON.stringify(_json(input));
111
75
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
112
76
  };
113
77
  export const se_RestoreBackupCommand = async (input, context) => {
114
- const headers = {
115
- "content-type": "application/x-amz-json-1.1",
116
- "x-amz-target": "BaldrApiService.RestoreBackup",
117
- };
78
+ const headers = sharedHeaders("RestoreBackup");
118
79
  let body;
119
- body = JSON.stringify(se_RestoreBackupRequest(input, context));
80
+ body = JSON.stringify(_json(input));
120
81
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
121
82
  };
122
83
  export const se_TagResourceCommand = async (input, context) => {
123
- const headers = {
124
- "content-type": "application/x-amz-json-1.1",
125
- "x-amz-target": "BaldrApiService.TagResource",
126
- };
84
+ const headers = sharedHeaders("TagResource");
127
85
  let body;
128
- body = JSON.stringify(se_TagResourceRequest(input, context));
86
+ body = JSON.stringify(_json(input));
129
87
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
130
88
  };
131
89
  export const se_UntagResourceCommand = async (input, context) => {
132
- const headers = {
133
- "content-type": "application/x-amz-json-1.1",
134
- "x-amz-target": "BaldrApiService.UntagResource",
135
- };
90
+ const headers = sharedHeaders("UntagResource");
136
91
  let body;
137
- body = JSON.stringify(se_UntagResourceRequest(input, context));
92
+ body = JSON.stringify(_json(input));
138
93
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
139
94
  };
140
95
  export const de_CopyBackupToRegionCommand = async (output, context) => {
@@ -148,7 +103,7 @@ export const de_CopyBackupToRegionCommand = async (output, context) => {
148
103
  $metadata: deserializeMetadata(output),
149
104
  ...contents,
150
105
  };
151
- return Promise.resolve(response);
106
+ return response;
152
107
  };
153
108
  const de_CopyBackupToRegionCommandError = async (output, context) => {
154
109
  const parsedOutput = {
@@ -177,10 +132,9 @@ const de_CopyBackupToRegionCommandError = async (output, context) => {
177
132
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
178
133
  default:
179
134
  const parsedBody = parsedOutput.body;
180
- throwDefaultError({
135
+ return throwDefaultError({
181
136
  output,
182
137
  parsedBody,
183
- exceptionCtor: __BaseException,
184
138
  errorCode,
185
139
  });
186
140
  }
@@ -196,7 +150,7 @@ export const de_CreateClusterCommand = async (output, context) => {
196
150
  $metadata: deserializeMetadata(output),
197
151
  ...contents,
198
152
  };
199
- return Promise.resolve(response);
153
+ return response;
200
154
  };
201
155
  const de_CreateClusterCommandError = async (output, context) => {
202
156
  const parsedOutput = {
@@ -225,10 +179,9 @@ const de_CreateClusterCommandError = async (output, context) => {
225
179
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
226
180
  default:
227
181
  const parsedBody = parsedOutput.body;
228
- throwDefaultError({
182
+ return throwDefaultError({
229
183
  output,
230
184
  parsedBody,
231
- exceptionCtor: __BaseException,
232
185
  errorCode,
233
186
  });
234
187
  }
@@ -239,12 +192,12 @@ export const de_CreateHsmCommand = async (output, context) => {
239
192
  }
240
193
  const data = await parseBody(output.body, context);
241
194
  let contents = {};
242
- contents = de_CreateHsmResponse(data, context);
195
+ contents = _json(data);
243
196
  const response = {
244
197
  $metadata: deserializeMetadata(output),
245
198
  ...contents,
246
199
  };
247
- return Promise.resolve(response);
200
+ return response;
248
201
  };
249
202
  const de_CreateHsmCommandError = async (output, context) => {
250
203
  const parsedOutput = {
@@ -270,10 +223,9 @@ const de_CreateHsmCommandError = async (output, context) => {
270
223
  throw await de_CloudHsmServiceExceptionRes(parsedOutput, context);
271
224
  default:
272
225
  const parsedBody = parsedOutput.body;
273
- throwDefaultError({
226
+ return throwDefaultError({
274
227
  output,
275
228
  parsedBody,
276
- exceptionCtor: __BaseException,
277
229
  errorCode,
278
230
  });
279
231
  }
@@ -289,7 +241,7 @@ export const de_DeleteBackupCommand = async (output, context) => {
289
241
  $metadata: deserializeMetadata(output),
290
242
  ...contents,
291
243
  };
292
- return Promise.resolve(response);
244
+ return response;
293
245
  };
294
246
  const de_DeleteBackupCommandError = async (output, context) => {
295
247
  const parsedOutput = {
@@ -315,10 +267,9 @@ const de_DeleteBackupCommandError = async (output, context) => {
315
267
  throw await de_CloudHsmServiceExceptionRes(parsedOutput, context);
316
268
  default:
317
269
  const parsedBody = parsedOutput.body;
318
- throwDefaultError({
270
+ return throwDefaultError({
319
271
  output,
320
272
  parsedBody,
321
- exceptionCtor: __BaseException,
322
273
  errorCode,
323
274
  });
324
275
  }
@@ -334,7 +285,7 @@ export const de_DeleteClusterCommand = async (output, context) => {
334
285
  $metadata: deserializeMetadata(output),
335
286
  ...contents,
336
287
  };
337
- return Promise.resolve(response);
288
+ return response;
338
289
  };
339
290
  const de_DeleteClusterCommandError = async (output, context) => {
340
291
  const parsedOutput = {
@@ -363,10 +314,9 @@ const de_DeleteClusterCommandError = async (output, context) => {
363
314
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
364
315
  default:
365
316
  const parsedBody = parsedOutput.body;
366
- throwDefaultError({
317
+ return throwDefaultError({
367
318
  output,
368
319
  parsedBody,
369
- exceptionCtor: __BaseException,
370
320
  errorCode,
371
321
  });
372
322
  }
@@ -377,12 +327,12 @@ export const de_DeleteHsmCommand = async (output, context) => {
377
327
  }
378
328
  const data = await parseBody(output.body, context);
379
329
  let contents = {};
380
- contents = de_DeleteHsmResponse(data, context);
330
+ contents = _json(data);
381
331
  const response = {
382
332
  $metadata: deserializeMetadata(output),
383
333
  ...contents,
384
334
  };
385
- return Promise.resolve(response);
335
+ return response;
386
336
  };
387
337
  const de_DeleteHsmCommandError = async (output, context) => {
388
338
  const parsedOutput = {
@@ -408,10 +358,9 @@ const de_DeleteHsmCommandError = async (output, context) => {
408
358
  throw await de_CloudHsmServiceExceptionRes(parsedOutput, context);
409
359
  default:
410
360
  const parsedBody = parsedOutput.body;
411
- throwDefaultError({
361
+ return throwDefaultError({
412
362
  output,
413
363
  parsedBody,
414
- exceptionCtor: __BaseException,
415
364
  errorCode,
416
365
  });
417
366
  }
@@ -427,7 +376,7 @@ export const de_DescribeBackupsCommand = async (output, context) => {
427
376
  $metadata: deserializeMetadata(output),
428
377
  ...contents,
429
378
  };
430
- return Promise.resolve(response);
379
+ return response;
431
380
  };
432
381
  const de_DescribeBackupsCommandError = async (output, context) => {
433
382
  const parsedOutput = {
@@ -456,10 +405,9 @@ const de_DescribeBackupsCommandError = async (output, context) => {
456
405
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
457
406
  default:
458
407
  const parsedBody = parsedOutput.body;
459
- throwDefaultError({
408
+ return throwDefaultError({
460
409
  output,
461
410
  parsedBody,
462
- exceptionCtor: __BaseException,
463
411
  errorCode,
464
412
  });
465
413
  }
@@ -475,7 +423,7 @@ export const de_DescribeClustersCommand = async (output, context) => {
475
423
  $metadata: deserializeMetadata(output),
476
424
  ...contents,
477
425
  };
478
- return Promise.resolve(response);
426
+ return response;
479
427
  };
480
428
  const de_DescribeClustersCommandError = async (output, context) => {
481
429
  const parsedOutput = {
@@ -501,10 +449,9 @@ const de_DescribeClustersCommandError = async (output, context) => {
501
449
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
502
450
  default:
503
451
  const parsedBody = parsedOutput.body;
504
- throwDefaultError({
452
+ return throwDefaultError({
505
453
  output,
506
454
  parsedBody,
507
- exceptionCtor: __BaseException,
508
455
  errorCode,
509
456
  });
510
457
  }
@@ -515,12 +462,12 @@ export const de_InitializeClusterCommand = async (output, context) => {
515
462
  }
516
463
  const data = await parseBody(output.body, context);
517
464
  let contents = {};
518
- contents = de_InitializeClusterResponse(data, context);
465
+ contents = _json(data);
519
466
  const response = {
520
467
  $metadata: deserializeMetadata(output),
521
468
  ...contents,
522
469
  };
523
- return Promise.resolve(response);
470
+ return response;
524
471
  };
525
472
  const de_InitializeClusterCommandError = async (output, context) => {
526
473
  const parsedOutput = {
@@ -546,10 +493,9 @@ const de_InitializeClusterCommandError = async (output, context) => {
546
493
  throw await de_CloudHsmServiceExceptionRes(parsedOutput, context);
547
494
  default:
548
495
  const parsedBody = parsedOutput.body;
549
- throwDefaultError({
496
+ return throwDefaultError({
550
497
  output,
551
498
  parsedBody,
552
- exceptionCtor: __BaseException,
553
499
  errorCode,
554
500
  });
555
501
  }
@@ -560,12 +506,12 @@ export const de_ListTagsCommand = async (output, context) => {
560
506
  }
561
507
  const data = await parseBody(output.body, context);
562
508
  let contents = {};
563
- contents = de_ListTagsResponse(data, context);
509
+ contents = _json(data);
564
510
  const response = {
565
511
  $metadata: deserializeMetadata(output),
566
512
  ...contents,
567
513
  };
568
- return Promise.resolve(response);
514
+ return response;
569
515
  };
570
516
  const de_ListTagsCommandError = async (output, context) => {
571
517
  const parsedOutput = {
@@ -594,10 +540,9 @@ const de_ListTagsCommandError = async (output, context) => {
594
540
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
595
541
  default:
596
542
  const parsedBody = parsedOutput.body;
597
- throwDefaultError({
543
+ return throwDefaultError({
598
544
  output,
599
545
  parsedBody,
600
- exceptionCtor: __BaseException,
601
546
  errorCode,
602
547
  });
603
548
  }
@@ -613,7 +558,7 @@ export const de_ModifyBackupAttributesCommand = async (output, context) => {
613
558
  $metadata: deserializeMetadata(output),
614
559
  ...contents,
615
560
  };
616
- return Promise.resolve(response);
561
+ return response;
617
562
  };
618
563
  const de_ModifyBackupAttributesCommandError = async (output, context) => {
619
564
  const parsedOutput = {
@@ -639,10 +584,9 @@ const de_ModifyBackupAttributesCommandError = async (output, context) => {
639
584
  throw await de_CloudHsmServiceExceptionRes(parsedOutput, context);
640
585
  default:
641
586
  const parsedBody = parsedOutput.body;
642
- throwDefaultError({
587
+ return throwDefaultError({
643
588
  output,
644
589
  parsedBody,
645
- exceptionCtor: __BaseException,
646
590
  errorCode,
647
591
  });
648
592
  }
@@ -658,7 +602,7 @@ export const de_ModifyClusterCommand = async (output, context) => {
658
602
  $metadata: deserializeMetadata(output),
659
603
  ...contents,
660
604
  };
661
- return Promise.resolve(response);
605
+ return response;
662
606
  };
663
607
  const de_ModifyClusterCommandError = async (output, context) => {
664
608
  const parsedOutput = {
@@ -684,10 +628,9 @@ const de_ModifyClusterCommandError = async (output, context) => {
684
628
  throw await de_CloudHsmServiceExceptionRes(parsedOutput, context);
685
629
  default:
686
630
  const parsedBody = parsedOutput.body;
687
- throwDefaultError({
631
+ return throwDefaultError({
688
632
  output,
689
633
  parsedBody,
690
- exceptionCtor: __BaseException,
691
634
  errorCode,
692
635
  });
693
636
  }
@@ -703,7 +646,7 @@ export const de_RestoreBackupCommand = async (output, context) => {
703
646
  $metadata: deserializeMetadata(output),
704
647
  ...contents,
705
648
  };
706
- return Promise.resolve(response);
649
+ return response;
707
650
  };
708
651
  const de_RestoreBackupCommandError = async (output, context) => {
709
652
  const parsedOutput = {
@@ -729,10 +672,9 @@ const de_RestoreBackupCommandError = async (output, context) => {
729
672
  throw await de_CloudHsmServiceExceptionRes(parsedOutput, context);
730
673
  default:
731
674
  const parsedBody = parsedOutput.body;
732
- throwDefaultError({
675
+ return throwDefaultError({
733
676
  output,
734
677
  parsedBody,
735
- exceptionCtor: __BaseException,
736
678
  errorCode,
737
679
  });
738
680
  }
@@ -743,12 +685,12 @@ export const de_TagResourceCommand = async (output, context) => {
743
685
  }
744
686
  const data = await parseBody(output.body, context);
745
687
  let contents = {};
746
- contents = de_TagResourceResponse(data, context);
688
+ contents = _json(data);
747
689
  const response = {
748
690
  $metadata: deserializeMetadata(output),
749
691
  ...contents,
750
692
  };
751
- return Promise.resolve(response);
693
+ return response;
752
694
  };
753
695
  const de_TagResourceCommandError = async (output, context) => {
754
696
  const parsedOutput = {
@@ -777,10 +719,9 @@ const de_TagResourceCommandError = async (output, context) => {
777
719
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
778
720
  default:
779
721
  const parsedBody = parsedOutput.body;
780
- throwDefaultError({
722
+ return throwDefaultError({
781
723
  output,
782
724
  parsedBody,
783
- exceptionCtor: __BaseException,
784
725
  errorCode,
785
726
  });
786
727
  }
@@ -791,12 +732,12 @@ export const de_UntagResourceCommand = async (output, context) => {
791
732
  }
792
733
  const data = await parseBody(output.body, context);
793
734
  let contents = {};
794
- contents = de_UntagResourceResponse(data, context);
735
+ contents = _json(data);
795
736
  const response = {
796
737
  $metadata: deserializeMetadata(output),
797
738
  ...contents,
798
739
  };
799
- return Promise.resolve(response);
740
+ return response;
800
741
  };
801
742
  const de_UntagResourceCommandError = async (output, context) => {
802
743
  const parsedOutput = {
@@ -825,17 +766,16 @@ const de_UntagResourceCommandError = async (output, context) => {
825
766
  throw await de_CloudHsmTagExceptionRes(parsedOutput, context);
826
767
  default:
827
768
  const parsedBody = parsedOutput.body;
828
- throwDefaultError({
769
+ return throwDefaultError({
829
770
  output,
830
771
  parsedBody,
831
- exceptionCtor: __BaseException,
832
772
  errorCode,
833
773
  });
834
774
  }
835
775
  };
836
776
  const de_CloudHsmAccessDeniedExceptionRes = async (parsedOutput, context) => {
837
777
  const body = parsedOutput.body;
838
- const deserialized = de_CloudHsmAccessDeniedException(body, context);
778
+ const deserialized = _json(body);
839
779
  const exception = new CloudHsmAccessDeniedException({
840
780
  $metadata: deserializeMetadata(parsedOutput),
841
781
  ...deserialized,
@@ -844,7 +784,7 @@ const de_CloudHsmAccessDeniedExceptionRes = async (parsedOutput, context) => {
844
784
  };
845
785
  const de_CloudHsmInternalFailureExceptionRes = async (parsedOutput, context) => {
846
786
  const body = parsedOutput.body;
847
- const deserialized = de_CloudHsmInternalFailureException(body, context);
787
+ const deserialized = _json(body);
848
788
  const exception = new CloudHsmInternalFailureException({
849
789
  $metadata: deserializeMetadata(parsedOutput),
850
790
  ...deserialized,
@@ -853,7 +793,7 @@ const de_CloudHsmInternalFailureExceptionRes = async (parsedOutput, context) =>
853
793
  };
854
794
  const de_CloudHsmInvalidRequestExceptionRes = async (parsedOutput, context) => {
855
795
  const body = parsedOutput.body;
856
- const deserialized = de_CloudHsmInvalidRequestException(body, context);
796
+ const deserialized = _json(body);
857
797
  const exception = new CloudHsmInvalidRequestException({
858
798
  $metadata: deserializeMetadata(parsedOutput),
859
799
  ...deserialized,
@@ -862,7 +802,7 @@ const de_CloudHsmInvalidRequestExceptionRes = async (parsedOutput, context) => {
862
802
  };
863
803
  const de_CloudHsmResourceNotFoundExceptionRes = async (parsedOutput, context) => {
864
804
  const body = parsedOutput.body;
865
- const deserialized = de_CloudHsmResourceNotFoundException(body, context);
805
+ const deserialized = _json(body);
866
806
  const exception = new CloudHsmResourceNotFoundException({
867
807
  $metadata: deserializeMetadata(parsedOutput),
868
808
  ...deserialized,
@@ -871,7 +811,7 @@ const de_CloudHsmResourceNotFoundExceptionRes = async (parsedOutput, context) =>
871
811
  };
872
812
  const de_CloudHsmServiceExceptionRes = async (parsedOutput, context) => {
873
813
  const body = parsedOutput.body;
874
- const deserialized = de_CloudHsmServiceException(body, context);
814
+ const deserialized = _json(body);
875
815
  const exception = new CloudHsmServiceException({
876
816
  $metadata: deserializeMetadata(parsedOutput),
877
817
  ...deserialized,
@@ -880,409 +820,117 @@ const de_CloudHsmServiceExceptionRes = async (parsedOutput, context) => {
880
820
  };
881
821
  const de_CloudHsmTagExceptionRes = async (parsedOutput, context) => {
882
822
  const body = parsedOutput.body;
883
- const deserialized = de_CloudHsmTagException(body, context);
823
+ const deserialized = _json(body);
884
824
  const exception = new CloudHsmTagException({
885
825
  $metadata: deserializeMetadata(parsedOutput),
886
826
  ...deserialized,
887
827
  });
888
828
  return __decorateServiceException(exception, body);
889
829
  };
890
- const se_BackupRetentionPolicy = (input, context) => {
891
- return {
892
- ...(input.Type != null && { Type: input.Type }),
893
- ...(input.Value != null && { Value: input.Value }),
894
- };
895
- };
896
- const se_CopyBackupToRegionRequest = (input, context) => {
897
- return {
898
- ...(input.BackupId != null && { BackupId: input.BackupId }),
899
- ...(input.DestinationRegion != null && { DestinationRegion: input.DestinationRegion }),
900
- ...(input.TagList != null && { TagList: se_TagList(input.TagList, context) }),
901
- };
902
- };
903
- const se_CreateClusterRequest = (input, context) => {
904
- return {
905
- ...(input.BackupRetentionPolicy != null && {
906
- BackupRetentionPolicy: se_BackupRetentionPolicy(input.BackupRetentionPolicy, context),
907
- }),
908
- ...(input.HsmType != null && { HsmType: input.HsmType }),
909
- ...(input.SourceBackupId != null && { SourceBackupId: input.SourceBackupId }),
910
- ...(input.SubnetIds != null && { SubnetIds: se_SubnetIds(input.SubnetIds, context) }),
911
- ...(input.TagList != null && { TagList: se_TagList(input.TagList, context) }),
912
- };
913
- };
914
- const se_CreateHsmRequest = (input, context) => {
915
- return {
916
- ...(input.AvailabilityZone != null && { AvailabilityZone: input.AvailabilityZone }),
917
- ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
918
- ...(input.IpAddress != null && { IpAddress: input.IpAddress }),
919
- };
920
- };
921
- const se_DeleteBackupRequest = (input, context) => {
922
- return {
923
- ...(input.BackupId != null && { BackupId: input.BackupId }),
924
- };
925
- };
926
- const se_DeleteClusterRequest = (input, context) => {
927
- return {
928
- ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
929
- };
930
- };
931
- const se_DeleteHsmRequest = (input, context) => {
932
- return {
933
- ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
934
- ...(input.EniId != null && { EniId: input.EniId }),
935
- ...(input.EniIp != null && { EniIp: input.EniIp }),
936
- ...(input.HsmId != null && { HsmId: input.HsmId }),
937
- };
938
- };
939
- const se_DescribeBackupsRequest = (input, context) => {
940
- return {
941
- ...(input.Filters != null && { Filters: se_Filters(input.Filters, context) }),
942
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
943
- ...(input.NextToken != null && { NextToken: input.NextToken }),
944
- ...(input.SortAscending != null && { SortAscending: input.SortAscending }),
945
- };
946
- };
947
- const se_DescribeClustersRequest = (input, context) => {
948
- return {
949
- ...(input.Filters != null && { Filters: se_Filters(input.Filters, context) }),
950
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
951
- ...(input.NextToken != null && { NextToken: input.NextToken }),
952
- };
953
- };
954
- const se_Filters = (input, context) => {
955
- return Object.entries(input).reduce((acc, [key, value]) => {
956
- if (value === null) {
957
- return acc;
958
- }
959
- acc[key] = se_Strings(value, context);
960
- return acc;
961
- }, {});
962
- };
963
- const se_InitializeClusterRequest = (input, context) => {
964
- return {
965
- ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
966
- ...(input.SignedCert != null && { SignedCert: input.SignedCert }),
967
- ...(input.TrustAnchor != null && { TrustAnchor: input.TrustAnchor }),
968
- };
969
- };
970
- const se_ListTagsRequest = (input, context) => {
971
- return {
972
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
973
- ...(input.NextToken != null && { NextToken: input.NextToken }),
974
- ...(input.ResourceId != null && { ResourceId: input.ResourceId }),
975
- };
976
- };
977
- const se_ModifyBackupAttributesRequest = (input, context) => {
978
- return {
979
- ...(input.BackupId != null && { BackupId: input.BackupId }),
980
- ...(input.NeverExpires != null && { NeverExpires: input.NeverExpires }),
981
- };
982
- };
983
- const se_ModifyClusterRequest = (input, context) => {
984
- return {
985
- ...(input.BackupRetentionPolicy != null && {
986
- BackupRetentionPolicy: se_BackupRetentionPolicy(input.BackupRetentionPolicy, context),
987
- }),
988
- ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
989
- };
990
- };
991
- const se_RestoreBackupRequest = (input, context) => {
992
- return {
993
- ...(input.BackupId != null && { BackupId: input.BackupId }),
994
- };
995
- };
996
- const se_Strings = (input, context) => {
997
- return input
998
- .filter((e) => e != null)
999
- .map((entry) => {
1000
- return entry;
1001
- });
1002
- };
1003
- const se_SubnetIds = (input, context) => {
1004
- return input
1005
- .filter((e) => e != null)
1006
- .map((entry) => {
1007
- return entry;
1008
- });
1009
- };
1010
- const se_Tag = (input, context) => {
1011
- return {
1012
- ...(input.Key != null && { Key: input.Key }),
1013
- ...(input.Value != null && { Value: input.Value }),
1014
- };
1015
- };
1016
- const se_TagKeyList = (input, context) => {
1017
- return input
1018
- .filter((e) => e != null)
1019
- .map((entry) => {
1020
- return entry;
1021
- });
1022
- };
1023
- const se_TagList = (input, context) => {
1024
- return input
1025
- .filter((e) => e != null)
1026
- .map((entry) => {
1027
- return se_Tag(entry, context);
1028
- });
1029
- };
1030
- const se_TagResourceRequest = (input, context) => {
1031
- return {
1032
- ...(input.ResourceId != null && { ResourceId: input.ResourceId }),
1033
- ...(input.TagList != null && { TagList: se_TagList(input.TagList, context) }),
1034
- };
1035
- };
1036
- const se_UntagResourceRequest = (input, context) => {
1037
- return {
1038
- ...(input.ResourceId != null && { ResourceId: input.ResourceId }),
1039
- ...(input.TagKeyList != null && { TagKeyList: se_TagKeyList(input.TagKeyList, context) }),
1040
- };
1041
- };
1042
830
  const de_Backup = (output, context) => {
1043
- return {
1044
- BackupId: __expectString(output.BackupId),
1045
- BackupState: __expectString(output.BackupState),
1046
- ClusterId: __expectString(output.ClusterId),
1047
- CopyTimestamp: output.CopyTimestamp != null
1048
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CopyTimestamp)))
1049
- : undefined,
1050
- CreateTimestamp: output.CreateTimestamp != null
1051
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreateTimestamp)))
1052
- : undefined,
1053
- DeleteTimestamp: output.DeleteTimestamp != null
1054
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.DeleteTimestamp)))
1055
- : undefined,
1056
- NeverExpires: __expectBoolean(output.NeverExpires),
1057
- SourceBackup: __expectString(output.SourceBackup),
1058
- SourceCluster: __expectString(output.SourceCluster),
1059
- SourceRegion: __expectString(output.SourceRegion),
1060
- TagList: output.TagList != null ? de_TagList(output.TagList, context) : undefined,
1061
- };
1062
- };
1063
- const de_BackupRetentionPolicy = (output, context) => {
1064
- return {
1065
- Type: __expectString(output.Type),
1066
- Value: __expectString(output.Value),
1067
- };
831
+ return take(output, {
832
+ BackupId: __expectString,
833
+ BackupState: __expectString,
834
+ ClusterId: __expectString,
835
+ CopyTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
836
+ CreateTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
837
+ DeleteTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
838
+ NeverExpires: __expectBoolean,
839
+ SourceBackup: __expectString,
840
+ SourceCluster: __expectString,
841
+ SourceRegion: __expectString,
842
+ TagList: _json,
843
+ });
1068
844
  };
1069
845
  const de_Backups = (output, context) => {
1070
846
  const retVal = (output || [])
1071
847
  .filter((e) => e != null)
1072
848
  .map((entry) => {
1073
- if (entry === null) {
1074
- return null;
1075
- }
1076
849
  return de_Backup(entry, context);
1077
850
  });
1078
851
  return retVal;
1079
852
  };
1080
- const de_Certificates = (output, context) => {
1081
- return {
1082
- AwsHardwareCertificate: __expectString(output.AwsHardwareCertificate),
1083
- ClusterCertificate: __expectString(output.ClusterCertificate),
1084
- ClusterCsr: __expectString(output.ClusterCsr),
1085
- HsmCertificate: __expectString(output.HsmCertificate),
1086
- ManufacturerHardwareCertificate: __expectString(output.ManufacturerHardwareCertificate),
1087
- };
1088
- };
1089
- const de_CloudHsmAccessDeniedException = (output, context) => {
1090
- return {
1091
- Message: __expectString(output.Message),
1092
- };
1093
- };
1094
- const de_CloudHsmInternalFailureException = (output, context) => {
1095
- return {
1096
- Message: __expectString(output.Message),
1097
- };
1098
- };
1099
- const de_CloudHsmInvalidRequestException = (output, context) => {
1100
- return {
1101
- Message: __expectString(output.Message),
1102
- };
1103
- };
1104
- const de_CloudHsmResourceNotFoundException = (output, context) => {
1105
- return {
1106
- Message: __expectString(output.Message),
1107
- };
1108
- };
1109
- const de_CloudHsmServiceException = (output, context) => {
1110
- return {
1111
- Message: __expectString(output.Message),
1112
- };
1113
- };
1114
- const de_CloudHsmTagException = (output, context) => {
1115
- return {
1116
- Message: __expectString(output.Message),
1117
- };
1118
- };
1119
853
  const de_Cluster = (output, context) => {
1120
- return {
1121
- BackupPolicy: __expectString(output.BackupPolicy),
1122
- BackupRetentionPolicy: output.BackupRetentionPolicy != null
1123
- ? de_BackupRetentionPolicy(output.BackupRetentionPolicy, context)
1124
- : undefined,
1125
- Certificates: output.Certificates != null ? de_Certificates(output.Certificates, context) : undefined,
1126
- ClusterId: __expectString(output.ClusterId),
1127
- CreateTimestamp: output.CreateTimestamp != null
1128
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreateTimestamp)))
1129
- : undefined,
1130
- HsmType: __expectString(output.HsmType),
1131
- Hsms: output.Hsms != null ? de_Hsms(output.Hsms, context) : undefined,
1132
- PreCoPassword: __expectString(output.PreCoPassword),
1133
- SecurityGroup: __expectString(output.SecurityGroup),
1134
- SourceBackupId: __expectString(output.SourceBackupId),
1135
- State: __expectString(output.State),
1136
- StateMessage: __expectString(output.StateMessage),
1137
- SubnetMapping: output.SubnetMapping != null ? de_ExternalSubnetMapping(output.SubnetMapping, context) : undefined,
1138
- TagList: output.TagList != null ? de_TagList(output.TagList, context) : undefined,
1139
- VpcId: __expectString(output.VpcId),
1140
- };
854
+ return take(output, {
855
+ BackupPolicy: __expectString,
856
+ BackupRetentionPolicy: _json,
857
+ Certificates: _json,
858
+ ClusterId: __expectString,
859
+ CreateTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
860
+ HsmType: __expectString,
861
+ Hsms: _json,
862
+ PreCoPassword: __expectString,
863
+ SecurityGroup: __expectString,
864
+ SourceBackupId: __expectString,
865
+ State: __expectString,
866
+ StateMessage: __expectString,
867
+ SubnetMapping: _json,
868
+ TagList: _json,
869
+ VpcId: __expectString,
870
+ });
1141
871
  };
1142
872
  const de_Clusters = (output, context) => {
1143
873
  const retVal = (output || [])
1144
874
  .filter((e) => e != null)
1145
875
  .map((entry) => {
1146
- if (entry === null) {
1147
- return null;
1148
- }
1149
876
  return de_Cluster(entry, context);
1150
877
  });
1151
878
  return retVal;
1152
879
  };
1153
880
  const de_CopyBackupToRegionResponse = (output, context) => {
1154
- return {
1155
- DestinationBackup: output.DestinationBackup != null ? de_DestinationBackup(output.DestinationBackup, context) : undefined,
1156
- };
881
+ return take(output, {
882
+ DestinationBackup: (_) => de_DestinationBackup(_, context),
883
+ });
1157
884
  };
1158
885
  const de_CreateClusterResponse = (output, context) => {
1159
- return {
1160
- Cluster: output.Cluster != null ? de_Cluster(output.Cluster, context) : undefined,
1161
- };
1162
- };
1163
- const de_CreateHsmResponse = (output, context) => {
1164
- return {
1165
- Hsm: output.Hsm != null ? de_Hsm(output.Hsm, context) : undefined,
1166
- };
886
+ return take(output, {
887
+ Cluster: (_) => de_Cluster(_, context),
888
+ });
1167
889
  };
1168
890
  const de_DeleteBackupResponse = (output, context) => {
1169
- return {
1170
- Backup: output.Backup != null ? de_Backup(output.Backup, context) : undefined,
1171
- };
891
+ return take(output, {
892
+ Backup: (_) => de_Backup(_, context),
893
+ });
1172
894
  };
1173
895
  const de_DeleteClusterResponse = (output, context) => {
1174
- return {
1175
- Cluster: output.Cluster != null ? de_Cluster(output.Cluster, context) : undefined,
1176
- };
1177
- };
1178
- const de_DeleteHsmResponse = (output, context) => {
1179
- return {
1180
- HsmId: __expectString(output.HsmId),
1181
- };
896
+ return take(output, {
897
+ Cluster: (_) => de_Cluster(_, context),
898
+ });
1182
899
  };
1183
900
  const de_DescribeBackupsResponse = (output, context) => {
1184
- return {
1185
- Backups: output.Backups != null ? de_Backups(output.Backups, context) : undefined,
1186
- NextToken: __expectString(output.NextToken),
1187
- };
901
+ return take(output, {
902
+ Backups: (_) => de_Backups(_, context),
903
+ NextToken: __expectString,
904
+ });
1188
905
  };
1189
906
  const de_DescribeClustersResponse = (output, context) => {
1190
- return {
1191
- Clusters: output.Clusters != null ? de_Clusters(output.Clusters, context) : undefined,
1192
- NextToken: __expectString(output.NextToken),
1193
- };
907
+ return take(output, {
908
+ Clusters: (_) => de_Clusters(_, context),
909
+ NextToken: __expectString,
910
+ });
1194
911
  };
1195
912
  const de_DestinationBackup = (output, context) => {
1196
- return {
1197
- CreateTimestamp: output.CreateTimestamp != null
1198
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreateTimestamp)))
1199
- : undefined,
1200
- SourceBackup: __expectString(output.SourceBackup),
1201
- SourceCluster: __expectString(output.SourceCluster),
1202
- SourceRegion: __expectString(output.SourceRegion),
1203
- };
1204
- };
1205
- const de_ExternalSubnetMapping = (output, context) => {
1206
- return Object.entries(output).reduce((acc, [key, value]) => {
1207
- if (value === null) {
1208
- return acc;
1209
- }
1210
- acc[key] = __expectString(value);
1211
- return acc;
1212
- }, {});
1213
- };
1214
- const de_Hsm = (output, context) => {
1215
- return {
1216
- AvailabilityZone: __expectString(output.AvailabilityZone),
1217
- ClusterId: __expectString(output.ClusterId),
1218
- EniId: __expectString(output.EniId),
1219
- EniIp: __expectString(output.EniIp),
1220
- HsmId: __expectString(output.HsmId),
1221
- State: __expectString(output.State),
1222
- StateMessage: __expectString(output.StateMessage),
1223
- SubnetId: __expectString(output.SubnetId),
1224
- };
1225
- };
1226
- const de_Hsms = (output, context) => {
1227
- const retVal = (output || [])
1228
- .filter((e) => e != null)
1229
- .map((entry) => {
1230
- if (entry === null) {
1231
- return null;
1232
- }
1233
- return de_Hsm(entry, context);
913
+ return take(output, {
914
+ CreateTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
915
+ SourceBackup: __expectString,
916
+ SourceCluster: __expectString,
917
+ SourceRegion: __expectString,
1234
918
  });
1235
- return retVal;
1236
- };
1237
- const de_InitializeClusterResponse = (output, context) => {
1238
- return {
1239
- State: __expectString(output.State),
1240
- StateMessage: __expectString(output.StateMessage),
1241
- };
1242
- };
1243
- const de_ListTagsResponse = (output, context) => {
1244
- return {
1245
- NextToken: __expectString(output.NextToken),
1246
- TagList: output.TagList != null ? de_TagList(output.TagList, context) : undefined,
1247
- };
1248
919
  };
1249
920
  const de_ModifyBackupAttributesResponse = (output, context) => {
1250
- return {
1251
- Backup: output.Backup != null ? de_Backup(output.Backup, context) : undefined,
1252
- };
921
+ return take(output, {
922
+ Backup: (_) => de_Backup(_, context),
923
+ });
1253
924
  };
1254
925
  const de_ModifyClusterResponse = (output, context) => {
1255
- return {
1256
- Cluster: output.Cluster != null ? de_Cluster(output.Cluster, context) : undefined,
1257
- };
926
+ return take(output, {
927
+ Cluster: (_) => de_Cluster(_, context),
928
+ });
1258
929
  };
1259
930
  const de_RestoreBackupResponse = (output, context) => {
1260
- return {
1261
- Backup: output.Backup != null ? de_Backup(output.Backup, context) : undefined,
1262
- };
1263
- };
1264
- const de_Tag = (output, context) => {
1265
- return {
1266
- Key: __expectString(output.Key),
1267
- Value: __expectString(output.Value),
1268
- };
1269
- };
1270
- const de_TagList = (output, context) => {
1271
- const retVal = (output || [])
1272
- .filter((e) => e != null)
1273
- .map((entry) => {
1274
- if (entry === null) {
1275
- return null;
1276
- }
1277
- return de_Tag(entry, context);
931
+ return take(output, {
932
+ Backup: (_) => de_Backup(_, context),
1278
933
  });
1279
- return retVal;
1280
- };
1281
- const de_TagResourceResponse = (output, context) => {
1282
- return {};
1283
- };
1284
- const de_UntagResourceResponse = (output, context) => {
1285
- return {};
1286
934
  };
1287
935
  const deserializeMetadata = (output) => ({
1288
936
  httpStatusCode: output.statusCode,
@@ -1297,6 +945,7 @@ const collectBody = (streamBody = new Uint8Array(), context) => {
1297
945
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1298
946
  };
1299
947
  const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
948
+ const throwDefaultError = withBaseException(__BaseException);
1300
949
  const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
1301
950
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1302
951
  const contents = {
@@ -1315,6 +964,12 @@ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, bod
1315
964
  }
1316
965
  return new __HttpRequest(contents);
1317
966
  };
967
+ function sharedHeaders(operation) {
968
+ return {
969
+ "content-type": "application/x-amz-json-1.1",
970
+ "x-amz-target": `BaldrApiService.${operation}`,
971
+ };
972
+ }
1318
973
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1319
974
  if (encoded.length) {
1320
975
  return JSON.parse(encoded);