@aws-sdk/client-cloudhsm-v2 3.186.0 → 3.188.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist-es/CloudHSMV2.js +62 -69
  3. package/dist-es/CloudHSMV2Client.js +22 -28
  4. package/dist-es/commands/CopyBackupToRegionCommand.js +21 -28
  5. package/dist-es/commands/CreateClusterCommand.js +21 -28
  6. package/dist-es/commands/CreateHsmCommand.js +21 -28
  7. package/dist-es/commands/DeleteBackupCommand.js +21 -28
  8. package/dist-es/commands/DeleteClusterCommand.js +21 -28
  9. package/dist-es/commands/DeleteHsmCommand.js +21 -28
  10. package/dist-es/commands/DescribeBackupsCommand.js +21 -28
  11. package/dist-es/commands/DescribeClustersCommand.js +21 -28
  12. package/dist-es/commands/InitializeClusterCommand.js +21 -28
  13. package/dist-es/commands/ListTagsCommand.js +21 -28
  14. package/dist-es/commands/ModifyBackupAttributesCommand.js +21 -28
  15. package/dist-es/commands/ModifyClusterCommand.js +21 -28
  16. package/dist-es/commands/RestoreBackupCommand.js +21 -28
  17. package/dist-es/commands/TagResourceCommand.js +21 -28
  18. package/dist-es/commands/UntagResourceCommand.js +21 -28
  19. package/dist-es/endpoints.js +8 -8
  20. package/dist-es/models/CloudHSMV2ServiceException.js +5 -10
  21. package/dist-es/models/models_0.js +183 -110
  22. package/dist-es/pagination/DescribeBackupsPaginator.js +25 -68
  23. package/dist-es/pagination/DescribeClustersPaginator.js +25 -68
  24. package/dist-es/pagination/ListTagsPaginator.js +25 -68
  25. package/dist-es/protocols/Aws_json1_1.js +1086 -1415
  26. package/dist-es/runtimeConfig.browser.js +26 -12
  27. package/dist-es/runtimeConfig.js +30 -12
  28. package/dist-es/runtimeConfig.native.js +8 -5
  29. package/dist-es/runtimeConfig.shared.js +8 -11
  30. package/package.json +33 -33
@@ -1,1354 +1,1047 @@
1
- import { __assign, __awaiter, __generator, __read } from "tslib";
2
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
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";
4
3
  import { CloudHSMV2ServiceException as __BaseException } from "../models/CloudHSMV2ServiceException";
5
4
  import { CloudHsmAccessDeniedException, CloudHsmInternalFailureException, CloudHsmInvalidRequestException, CloudHsmResourceNotFoundException, CloudHsmServiceException, CloudHsmTagException, } from "../models/models_0";
6
- export var serializeAws_json1_1CopyBackupToRegionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var headers, body;
8
- return __generator(this, function (_a) {
9
- headers = {
10
- "content-type": "application/x-amz-json-1.1",
11
- "x-amz-target": "BaldrApiService.CopyBackupToRegion",
12
- };
13
- body = JSON.stringify(serializeAws_json1_1CopyBackupToRegionRequest(input, context));
14
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
15
- });
16
- }); };
17
- export var serializeAws_json1_1CreateClusterCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
18
- var headers, body;
19
- return __generator(this, function (_a) {
20
- headers = {
21
- "content-type": "application/x-amz-json-1.1",
22
- "x-amz-target": "BaldrApiService.CreateCluster",
23
- };
24
- body = JSON.stringify(serializeAws_json1_1CreateClusterRequest(input, context));
25
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
26
- });
27
- }); };
28
- export var serializeAws_json1_1CreateHsmCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
29
- var headers, body;
30
- return __generator(this, function (_a) {
31
- headers = {
32
- "content-type": "application/x-amz-json-1.1",
33
- "x-amz-target": "BaldrApiService.CreateHsm",
34
- };
35
- body = JSON.stringify(serializeAws_json1_1CreateHsmRequest(input, context));
36
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
37
- });
38
- }); };
39
- export var serializeAws_json1_1DeleteBackupCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
40
- var headers, body;
41
- return __generator(this, function (_a) {
42
- headers = {
43
- "content-type": "application/x-amz-json-1.1",
44
- "x-amz-target": "BaldrApiService.DeleteBackup",
45
- };
46
- body = JSON.stringify(serializeAws_json1_1DeleteBackupRequest(input, context));
47
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
48
- });
49
- }); };
50
- export var serializeAws_json1_1DeleteClusterCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
51
- var headers, body;
52
- return __generator(this, function (_a) {
53
- headers = {
54
- "content-type": "application/x-amz-json-1.1",
55
- "x-amz-target": "BaldrApiService.DeleteCluster",
56
- };
57
- body = JSON.stringify(serializeAws_json1_1DeleteClusterRequest(input, context));
58
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
59
- });
60
- }); };
61
- export var serializeAws_json1_1DeleteHsmCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
62
- var headers, body;
63
- return __generator(this, function (_a) {
64
- headers = {
65
- "content-type": "application/x-amz-json-1.1",
66
- "x-amz-target": "BaldrApiService.DeleteHsm",
67
- };
68
- body = JSON.stringify(serializeAws_json1_1DeleteHsmRequest(input, context));
69
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
70
- });
71
- }); };
72
- export var serializeAws_json1_1DescribeBackupsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
73
- var headers, body;
74
- return __generator(this, function (_a) {
75
- headers = {
76
- "content-type": "application/x-amz-json-1.1",
77
- "x-amz-target": "BaldrApiService.DescribeBackups",
78
- };
79
- body = JSON.stringify(serializeAws_json1_1DescribeBackupsRequest(input, context));
80
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
81
- });
82
- }); };
83
- export var serializeAws_json1_1DescribeClustersCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
84
- var headers, body;
85
- return __generator(this, function (_a) {
86
- headers = {
87
- "content-type": "application/x-amz-json-1.1",
88
- "x-amz-target": "BaldrApiService.DescribeClusters",
89
- };
90
- body = JSON.stringify(serializeAws_json1_1DescribeClustersRequest(input, context));
91
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
92
- });
93
- }); };
94
- export var serializeAws_json1_1InitializeClusterCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
95
- var headers, body;
96
- return __generator(this, function (_a) {
97
- headers = {
98
- "content-type": "application/x-amz-json-1.1",
99
- "x-amz-target": "BaldrApiService.InitializeCluster",
100
- };
101
- body = JSON.stringify(serializeAws_json1_1InitializeClusterRequest(input, context));
102
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
103
- });
104
- }); };
105
- export var serializeAws_json1_1ListTagsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
106
- var headers, body;
107
- return __generator(this, function (_a) {
108
- headers = {
109
- "content-type": "application/x-amz-json-1.1",
110
- "x-amz-target": "BaldrApiService.ListTags",
111
- };
112
- body = JSON.stringify(serializeAws_json1_1ListTagsRequest(input, context));
113
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
114
- });
115
- }); };
116
- export var serializeAws_json1_1ModifyBackupAttributesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
117
- var headers, body;
118
- return __generator(this, function (_a) {
119
- headers = {
120
- "content-type": "application/x-amz-json-1.1",
121
- "x-amz-target": "BaldrApiService.ModifyBackupAttributes",
122
- };
123
- body = JSON.stringify(serializeAws_json1_1ModifyBackupAttributesRequest(input, context));
124
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
125
- });
126
- }); };
127
- export var serializeAws_json1_1ModifyClusterCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
128
- var headers, body;
129
- return __generator(this, function (_a) {
130
- headers = {
131
- "content-type": "application/x-amz-json-1.1",
132
- "x-amz-target": "BaldrApiService.ModifyCluster",
133
- };
134
- body = JSON.stringify(serializeAws_json1_1ModifyClusterRequest(input, context));
135
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
136
- });
137
- }); };
138
- export var serializeAws_json1_1RestoreBackupCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
139
- var headers, body;
140
- return __generator(this, function (_a) {
141
- headers = {
142
- "content-type": "application/x-amz-json-1.1",
143
- "x-amz-target": "BaldrApiService.RestoreBackup",
144
- };
145
- body = JSON.stringify(serializeAws_json1_1RestoreBackupRequest(input, context));
146
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
147
- });
148
- }); };
149
- export var serializeAws_json1_1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
150
- var headers, body;
151
- return __generator(this, function (_a) {
152
- headers = {
153
- "content-type": "application/x-amz-json-1.1",
154
- "x-amz-target": "BaldrApiService.TagResource",
155
- };
156
- body = JSON.stringify(serializeAws_json1_1TagResourceRequest(input, context));
157
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
158
- });
159
- }); };
160
- export var serializeAws_json1_1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
161
- var headers, body;
162
- return __generator(this, function (_a) {
163
- headers = {
164
- "content-type": "application/x-amz-json-1.1",
165
- "x-amz-target": "BaldrApiService.UntagResource",
166
- };
167
- body = JSON.stringify(serializeAws_json1_1UntagResourceRequest(input, context));
168
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
169
- });
170
- }); };
171
- export var deserializeAws_json1_1CopyBackupToRegionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
172
- var data, contents, response;
173
- return __generator(this, function (_a) {
174
- switch (_a.label) {
175
- case 0:
176
- if (output.statusCode >= 300) {
177
- return [2, deserializeAws_json1_1CopyBackupToRegionCommandError(output, context)];
178
- }
179
- return [4, parseBody(output.body, context)];
180
- case 1:
181
- data = _a.sent();
182
- contents = {};
183
- contents = deserializeAws_json1_1CopyBackupToRegionResponse(data, context);
184
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
185
- return [2, Promise.resolve(response)];
186
- }
187
- });
188
- }); };
189
- var deserializeAws_json1_1CopyBackupToRegionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
190
- var parsedOutput, _a, errorCode, _b, parsedBody;
191
- var _c;
192
- return __generator(this, function (_d) {
193
- switch (_d.label) {
194
- case 0:
195
- _a = [__assign({}, output)];
196
- _c = {};
197
- return [4, parseErrorBody(output.body, context)];
198
- case 1:
199
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
200
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
201
- _b = errorCode;
202
- switch (_b) {
203
- case "CloudHsmAccessDeniedException": return [3, 2];
204
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
205
- case "CloudHsmInternalFailureException": return [3, 4];
206
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
207
- case "CloudHsmInvalidRequestException": return [3, 6];
208
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
209
- case "CloudHsmResourceNotFoundException": return [3, 8];
210
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
211
- case "CloudHsmServiceException": return [3, 10];
212
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
213
- case "CloudHsmTagException": return [3, 12];
214
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 12];
215
- }
216
- return [3, 14];
217
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
218
- case 3: throw _d.sent();
219
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
220
- case 5: throw _d.sent();
221
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
222
- case 7: throw _d.sent();
223
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
224
- case 9: throw _d.sent();
225
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
226
- case 11: throw _d.sent();
227
- case 12: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
228
- case 13: throw _d.sent();
229
- case 14:
230
- parsedBody = parsedOutput.body;
231
- throwDefaultError({
232
- output: output,
233
- parsedBody: parsedBody,
234
- exceptionCtor: __BaseException,
235
- errorCode: errorCode,
236
- });
237
- _d.label = 15;
238
- case 15: return [2];
239
- }
240
- });
241
- }); };
242
- export var deserializeAws_json1_1CreateClusterCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
243
- var data, contents, response;
244
- return __generator(this, function (_a) {
245
- switch (_a.label) {
246
- case 0:
247
- if (output.statusCode >= 300) {
248
- return [2, deserializeAws_json1_1CreateClusterCommandError(output, context)];
249
- }
250
- return [4, parseBody(output.body, context)];
251
- case 1:
252
- data = _a.sent();
253
- contents = {};
254
- contents = deserializeAws_json1_1CreateClusterResponse(data, context);
255
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
256
- return [2, Promise.resolve(response)];
257
- }
258
- });
259
- }); };
260
- var deserializeAws_json1_1CreateClusterCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
261
- var parsedOutput, _a, errorCode, _b, parsedBody;
262
- var _c;
263
- return __generator(this, function (_d) {
264
- switch (_d.label) {
265
- case 0:
266
- _a = [__assign({}, output)];
267
- _c = {};
268
- return [4, parseErrorBody(output.body, context)];
269
- case 1:
270
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
271
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
272
- _b = errorCode;
273
- switch (_b) {
274
- case "CloudHsmAccessDeniedException": return [3, 2];
275
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
276
- case "CloudHsmInternalFailureException": return [3, 4];
277
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
278
- case "CloudHsmInvalidRequestException": return [3, 6];
279
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
280
- case "CloudHsmResourceNotFoundException": return [3, 8];
281
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
282
- case "CloudHsmServiceException": return [3, 10];
283
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
284
- case "CloudHsmTagException": return [3, 12];
285
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 12];
286
- }
287
- return [3, 14];
288
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
289
- case 3: throw _d.sent();
290
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
291
- case 5: throw _d.sent();
292
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
293
- case 7: throw _d.sent();
294
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
295
- case 9: throw _d.sent();
296
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
297
- case 11: throw _d.sent();
298
- case 12: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
299
- case 13: throw _d.sent();
300
- case 14:
301
- parsedBody = parsedOutput.body;
302
- throwDefaultError({
303
- output: output,
304
- parsedBody: parsedBody,
305
- exceptionCtor: __BaseException,
306
- errorCode: errorCode,
307
- });
308
- _d.label = 15;
309
- case 15: return [2];
310
- }
311
- });
312
- }); };
313
- export var deserializeAws_json1_1CreateHsmCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
314
- var data, contents, response;
315
- return __generator(this, function (_a) {
316
- switch (_a.label) {
317
- case 0:
318
- if (output.statusCode >= 300) {
319
- return [2, deserializeAws_json1_1CreateHsmCommandError(output, context)];
320
- }
321
- return [4, parseBody(output.body, context)];
322
- case 1:
323
- data = _a.sent();
324
- contents = {};
325
- contents = deserializeAws_json1_1CreateHsmResponse(data, context);
326
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
327
- return [2, Promise.resolve(response)];
328
- }
329
- });
330
- }); };
331
- var deserializeAws_json1_1CreateHsmCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
332
- var parsedOutput, _a, errorCode, _b, parsedBody;
333
- var _c;
334
- return __generator(this, function (_d) {
335
- switch (_d.label) {
336
- case 0:
337
- _a = [__assign({}, output)];
338
- _c = {};
339
- return [4, parseErrorBody(output.body, context)];
340
- case 1:
341
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
342
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
343
- _b = errorCode;
344
- switch (_b) {
345
- case "CloudHsmAccessDeniedException": return [3, 2];
346
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
347
- case "CloudHsmInternalFailureException": return [3, 4];
348
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
349
- case "CloudHsmInvalidRequestException": return [3, 6];
350
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
351
- case "CloudHsmResourceNotFoundException": return [3, 8];
352
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
353
- case "CloudHsmServiceException": return [3, 10];
354
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
355
- }
356
- return [3, 12];
357
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
358
- case 3: throw _d.sent();
359
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
360
- case 5: throw _d.sent();
361
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
362
- case 7: throw _d.sent();
363
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
364
- case 9: throw _d.sent();
365
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
366
- case 11: throw _d.sent();
367
- case 12:
368
- parsedBody = parsedOutput.body;
369
- throwDefaultError({
370
- output: output,
371
- parsedBody: parsedBody,
372
- exceptionCtor: __BaseException,
373
- errorCode: errorCode,
374
- });
375
- _d.label = 13;
376
- case 13: return [2];
377
- }
378
- });
379
- }); };
380
- export var deserializeAws_json1_1DeleteBackupCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
381
- var data, contents, response;
382
- return __generator(this, function (_a) {
383
- switch (_a.label) {
384
- case 0:
385
- if (output.statusCode >= 300) {
386
- return [2, deserializeAws_json1_1DeleteBackupCommandError(output, context)];
387
- }
388
- return [4, parseBody(output.body, context)];
389
- case 1:
390
- data = _a.sent();
391
- contents = {};
392
- contents = deserializeAws_json1_1DeleteBackupResponse(data, context);
393
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
394
- return [2, Promise.resolve(response)];
395
- }
396
- });
397
- }); };
398
- var deserializeAws_json1_1DeleteBackupCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
399
- var parsedOutput, _a, errorCode, _b, parsedBody;
400
- var _c;
401
- return __generator(this, function (_d) {
402
- switch (_d.label) {
403
- case 0:
404
- _a = [__assign({}, output)];
405
- _c = {};
406
- return [4, parseErrorBody(output.body, context)];
407
- case 1:
408
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
409
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
410
- _b = errorCode;
411
- switch (_b) {
412
- case "CloudHsmAccessDeniedException": return [3, 2];
413
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
414
- case "CloudHsmInternalFailureException": return [3, 4];
415
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
416
- case "CloudHsmInvalidRequestException": return [3, 6];
417
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
418
- case "CloudHsmResourceNotFoundException": return [3, 8];
419
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
420
- case "CloudHsmServiceException": return [3, 10];
421
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
422
- }
423
- return [3, 12];
424
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
425
- case 3: throw _d.sent();
426
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
427
- case 5: throw _d.sent();
428
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
429
- case 7: throw _d.sent();
430
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
431
- case 9: throw _d.sent();
432
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
433
- case 11: throw _d.sent();
434
- case 12:
435
- parsedBody = parsedOutput.body;
436
- throwDefaultError({
437
- output: output,
438
- parsedBody: parsedBody,
439
- exceptionCtor: __BaseException,
440
- errorCode: errorCode,
441
- });
442
- _d.label = 13;
443
- case 13: return [2];
444
- }
445
- });
446
- }); };
447
- export var deserializeAws_json1_1DeleteClusterCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
448
- var data, contents, response;
449
- return __generator(this, function (_a) {
450
- switch (_a.label) {
451
- case 0:
452
- if (output.statusCode >= 300) {
453
- return [2, deserializeAws_json1_1DeleteClusterCommandError(output, context)];
454
- }
455
- return [4, parseBody(output.body, context)];
456
- case 1:
457
- data = _a.sent();
458
- contents = {};
459
- contents = deserializeAws_json1_1DeleteClusterResponse(data, context);
460
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
461
- return [2, Promise.resolve(response)];
462
- }
463
- });
464
- }); };
465
- var deserializeAws_json1_1DeleteClusterCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
466
- var parsedOutput, _a, errorCode, _b, parsedBody;
467
- var _c;
468
- return __generator(this, function (_d) {
469
- switch (_d.label) {
470
- case 0:
471
- _a = [__assign({}, output)];
472
- _c = {};
473
- return [4, parseErrorBody(output.body, context)];
474
- case 1:
475
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
476
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
477
- _b = errorCode;
478
- switch (_b) {
479
- case "CloudHsmAccessDeniedException": return [3, 2];
480
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
481
- case "CloudHsmInternalFailureException": return [3, 4];
482
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
483
- case "CloudHsmInvalidRequestException": return [3, 6];
484
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
485
- case "CloudHsmResourceNotFoundException": return [3, 8];
486
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
487
- case "CloudHsmServiceException": return [3, 10];
488
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
489
- case "CloudHsmTagException": return [3, 12];
490
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 12];
491
- }
492
- return [3, 14];
493
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
494
- case 3: throw _d.sent();
495
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
496
- case 5: throw _d.sent();
497
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
498
- case 7: throw _d.sent();
499
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
500
- case 9: throw _d.sent();
501
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
502
- case 11: throw _d.sent();
503
- case 12: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
504
- case 13: throw _d.sent();
505
- case 14:
506
- parsedBody = parsedOutput.body;
507
- throwDefaultError({
508
- output: output,
509
- parsedBody: parsedBody,
510
- exceptionCtor: __BaseException,
511
- errorCode: errorCode,
512
- });
513
- _d.label = 15;
514
- case 15: return [2];
515
- }
516
- });
517
- }); };
518
- export var deserializeAws_json1_1DeleteHsmCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
519
- var data, contents, response;
520
- return __generator(this, function (_a) {
521
- switch (_a.label) {
522
- case 0:
523
- if (output.statusCode >= 300) {
524
- return [2, deserializeAws_json1_1DeleteHsmCommandError(output, context)];
525
- }
526
- return [4, parseBody(output.body, context)];
527
- case 1:
528
- data = _a.sent();
529
- contents = {};
530
- contents = deserializeAws_json1_1DeleteHsmResponse(data, context);
531
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
532
- return [2, Promise.resolve(response)];
533
- }
534
- });
535
- }); };
536
- var deserializeAws_json1_1DeleteHsmCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
537
- var parsedOutput, _a, errorCode, _b, parsedBody;
538
- var _c;
539
- return __generator(this, function (_d) {
540
- switch (_d.label) {
541
- case 0:
542
- _a = [__assign({}, output)];
543
- _c = {};
544
- return [4, parseErrorBody(output.body, context)];
545
- case 1:
546
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
547
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
548
- _b = errorCode;
549
- switch (_b) {
550
- case "CloudHsmAccessDeniedException": return [3, 2];
551
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
552
- case "CloudHsmInternalFailureException": return [3, 4];
553
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
554
- case "CloudHsmInvalidRequestException": return [3, 6];
555
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
556
- case "CloudHsmResourceNotFoundException": return [3, 8];
557
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
558
- case "CloudHsmServiceException": return [3, 10];
559
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
560
- }
561
- return [3, 12];
562
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
563
- case 3: throw _d.sent();
564
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
565
- case 5: throw _d.sent();
566
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
567
- case 7: throw _d.sent();
568
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
569
- case 9: throw _d.sent();
570
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
571
- case 11: throw _d.sent();
572
- case 12:
573
- parsedBody = parsedOutput.body;
574
- throwDefaultError({
575
- output: output,
576
- parsedBody: parsedBody,
577
- exceptionCtor: __BaseException,
578
- errorCode: errorCode,
579
- });
580
- _d.label = 13;
581
- case 13: return [2];
582
- }
583
- });
584
- }); };
585
- export var deserializeAws_json1_1DescribeBackupsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
586
- var data, contents, response;
587
- return __generator(this, function (_a) {
588
- switch (_a.label) {
589
- case 0:
590
- if (output.statusCode >= 300) {
591
- return [2, deserializeAws_json1_1DescribeBackupsCommandError(output, context)];
592
- }
593
- return [4, parseBody(output.body, context)];
594
- case 1:
595
- data = _a.sent();
596
- contents = {};
597
- contents = deserializeAws_json1_1DescribeBackupsResponse(data, context);
598
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
599
- return [2, Promise.resolve(response)];
600
- }
601
- });
602
- }); };
603
- var deserializeAws_json1_1DescribeBackupsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
604
- var parsedOutput, _a, errorCode, _b, parsedBody;
605
- var _c;
606
- return __generator(this, function (_d) {
607
- switch (_d.label) {
608
- case 0:
609
- _a = [__assign({}, output)];
610
- _c = {};
611
- return [4, parseErrorBody(output.body, context)];
612
- case 1:
613
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
614
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
615
- _b = errorCode;
616
- switch (_b) {
617
- case "CloudHsmAccessDeniedException": return [3, 2];
618
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
619
- case "CloudHsmInternalFailureException": return [3, 4];
620
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
621
- case "CloudHsmInvalidRequestException": return [3, 6];
622
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
623
- case "CloudHsmResourceNotFoundException": return [3, 8];
624
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
625
- case "CloudHsmServiceException": return [3, 10];
626
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
627
- case "CloudHsmTagException": return [3, 12];
628
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 12];
629
- }
630
- return [3, 14];
631
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
632
- case 3: throw _d.sent();
633
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
634
- case 5: throw _d.sent();
635
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
636
- case 7: throw _d.sent();
637
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
638
- case 9: throw _d.sent();
639
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
640
- case 11: throw _d.sent();
641
- case 12: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
642
- case 13: throw _d.sent();
643
- case 14:
644
- parsedBody = parsedOutput.body;
645
- throwDefaultError({
646
- output: output,
647
- parsedBody: parsedBody,
648
- exceptionCtor: __BaseException,
649
- errorCode: errorCode,
650
- });
651
- _d.label = 15;
652
- case 15: return [2];
653
- }
654
- });
655
- }); };
656
- export var deserializeAws_json1_1DescribeClustersCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
657
- var data, contents, response;
658
- return __generator(this, function (_a) {
659
- switch (_a.label) {
660
- case 0:
661
- if (output.statusCode >= 300) {
662
- return [2, deserializeAws_json1_1DescribeClustersCommandError(output, context)];
663
- }
664
- return [4, parseBody(output.body, context)];
665
- case 1:
666
- data = _a.sent();
667
- contents = {};
668
- contents = deserializeAws_json1_1DescribeClustersResponse(data, context);
669
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
670
- return [2, Promise.resolve(response)];
671
- }
672
- });
673
- }); };
674
- var deserializeAws_json1_1DescribeClustersCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
675
- var parsedOutput, _a, errorCode, _b, parsedBody;
676
- var _c;
677
- return __generator(this, function (_d) {
678
- switch (_d.label) {
679
- case 0:
680
- _a = [__assign({}, output)];
681
- _c = {};
682
- return [4, parseErrorBody(output.body, context)];
683
- case 1:
684
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
685
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
686
- _b = errorCode;
687
- switch (_b) {
688
- case "CloudHsmAccessDeniedException": return [3, 2];
689
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
690
- case "CloudHsmInternalFailureException": return [3, 4];
691
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
692
- case "CloudHsmInvalidRequestException": return [3, 6];
693
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
694
- case "CloudHsmServiceException": return [3, 8];
695
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 8];
696
- case "CloudHsmTagException": return [3, 10];
697
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 10];
698
- }
699
- return [3, 12];
700
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
701
- case 3: throw _d.sent();
702
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
703
- case 5: throw _d.sent();
704
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
705
- case 7: throw _d.sent();
706
- case 8: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
707
- case 9: throw _d.sent();
708
- case 10: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
709
- case 11: throw _d.sent();
710
- case 12:
711
- parsedBody = parsedOutput.body;
712
- throwDefaultError({
713
- output: output,
714
- parsedBody: parsedBody,
715
- exceptionCtor: __BaseException,
716
- errorCode: errorCode,
717
- });
718
- _d.label = 13;
719
- case 13: return [2];
720
- }
721
- });
722
- }); };
723
- export var deserializeAws_json1_1InitializeClusterCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
724
- var data, contents, response;
725
- return __generator(this, function (_a) {
726
- switch (_a.label) {
727
- case 0:
728
- if (output.statusCode >= 300) {
729
- return [2, deserializeAws_json1_1InitializeClusterCommandError(output, context)];
730
- }
731
- return [4, parseBody(output.body, context)];
732
- case 1:
733
- data = _a.sent();
734
- contents = {};
735
- contents = deserializeAws_json1_1InitializeClusterResponse(data, context);
736
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
737
- return [2, Promise.resolve(response)];
738
- }
739
- });
740
- }); };
741
- var deserializeAws_json1_1InitializeClusterCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
742
- var parsedOutput, _a, errorCode, _b, parsedBody;
743
- var _c;
744
- return __generator(this, function (_d) {
745
- switch (_d.label) {
746
- case 0:
747
- _a = [__assign({}, output)];
748
- _c = {};
749
- return [4, parseErrorBody(output.body, context)];
750
- case 1:
751
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
752
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
753
- _b = errorCode;
754
- switch (_b) {
755
- case "CloudHsmAccessDeniedException": return [3, 2];
756
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
757
- case "CloudHsmInternalFailureException": return [3, 4];
758
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
759
- case "CloudHsmInvalidRequestException": return [3, 6];
760
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
761
- case "CloudHsmResourceNotFoundException": return [3, 8];
762
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
763
- case "CloudHsmServiceException": return [3, 10];
764
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
765
- }
766
- return [3, 12];
767
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
768
- case 3: throw _d.sent();
769
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
770
- case 5: throw _d.sent();
771
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
772
- case 7: throw _d.sent();
773
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
774
- case 9: throw _d.sent();
775
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
776
- case 11: throw _d.sent();
777
- case 12:
778
- parsedBody = parsedOutput.body;
779
- throwDefaultError({
780
- output: output,
781
- parsedBody: parsedBody,
782
- exceptionCtor: __BaseException,
783
- errorCode: errorCode,
784
- });
785
- _d.label = 13;
786
- case 13: return [2];
787
- }
788
- });
789
- }); };
790
- export var deserializeAws_json1_1ListTagsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
791
- var data, contents, response;
792
- return __generator(this, function (_a) {
793
- switch (_a.label) {
794
- case 0:
795
- if (output.statusCode >= 300) {
796
- return [2, deserializeAws_json1_1ListTagsCommandError(output, context)];
797
- }
798
- return [4, parseBody(output.body, context)];
799
- case 1:
800
- data = _a.sent();
801
- contents = {};
802
- contents = deserializeAws_json1_1ListTagsResponse(data, context);
803
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
804
- return [2, Promise.resolve(response)];
805
- }
806
- });
807
- }); };
808
- var deserializeAws_json1_1ListTagsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
809
- var parsedOutput, _a, errorCode, _b, parsedBody;
810
- var _c;
811
- return __generator(this, function (_d) {
812
- switch (_d.label) {
813
- case 0:
814
- _a = [__assign({}, output)];
815
- _c = {};
816
- return [4, parseErrorBody(output.body, context)];
817
- case 1:
818
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
819
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
820
- _b = errorCode;
821
- switch (_b) {
822
- case "CloudHsmAccessDeniedException": return [3, 2];
823
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
824
- case "CloudHsmInternalFailureException": return [3, 4];
825
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
826
- case "CloudHsmInvalidRequestException": return [3, 6];
827
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
828
- case "CloudHsmResourceNotFoundException": return [3, 8];
829
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
830
- case "CloudHsmServiceException": return [3, 10];
831
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
832
- case "CloudHsmTagException": return [3, 12];
833
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 12];
834
- }
835
- return [3, 14];
836
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
837
- case 3: throw _d.sent();
838
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
839
- case 5: throw _d.sent();
840
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
841
- case 7: throw _d.sent();
842
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
843
- case 9: throw _d.sent();
844
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
845
- case 11: throw _d.sent();
846
- case 12: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
847
- case 13: throw _d.sent();
848
- case 14:
849
- parsedBody = parsedOutput.body;
850
- throwDefaultError({
851
- output: output,
852
- parsedBody: parsedBody,
853
- exceptionCtor: __BaseException,
854
- errorCode: errorCode,
855
- });
856
- _d.label = 15;
857
- case 15: return [2];
858
- }
859
- });
860
- }); };
861
- export var deserializeAws_json1_1ModifyBackupAttributesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
862
- var data, contents, response;
863
- return __generator(this, function (_a) {
864
- switch (_a.label) {
865
- case 0:
866
- if (output.statusCode >= 300) {
867
- return [2, deserializeAws_json1_1ModifyBackupAttributesCommandError(output, context)];
868
- }
869
- return [4, parseBody(output.body, context)];
870
- case 1:
871
- data = _a.sent();
872
- contents = {};
873
- contents = deserializeAws_json1_1ModifyBackupAttributesResponse(data, context);
874
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
875
- return [2, Promise.resolve(response)];
876
- }
877
- });
878
- }); };
879
- var deserializeAws_json1_1ModifyBackupAttributesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
880
- var parsedOutput, _a, errorCode, _b, parsedBody;
881
- var _c;
882
- return __generator(this, function (_d) {
883
- switch (_d.label) {
884
- case 0:
885
- _a = [__assign({}, output)];
886
- _c = {};
887
- return [4, parseErrorBody(output.body, context)];
888
- case 1:
889
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
890
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
891
- _b = errorCode;
892
- switch (_b) {
893
- case "CloudHsmAccessDeniedException": return [3, 2];
894
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
895
- case "CloudHsmInternalFailureException": return [3, 4];
896
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
897
- case "CloudHsmInvalidRequestException": return [3, 6];
898
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
899
- case "CloudHsmResourceNotFoundException": return [3, 8];
900
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
901
- case "CloudHsmServiceException": return [3, 10];
902
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
903
- }
904
- return [3, 12];
905
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
906
- case 3: throw _d.sent();
907
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
908
- case 5: throw _d.sent();
909
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
910
- case 7: throw _d.sent();
911
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
912
- case 9: throw _d.sent();
913
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
914
- case 11: throw _d.sent();
915
- case 12:
916
- parsedBody = parsedOutput.body;
917
- throwDefaultError({
918
- output: output,
919
- parsedBody: parsedBody,
920
- exceptionCtor: __BaseException,
921
- errorCode: errorCode,
922
- });
923
- _d.label = 13;
924
- case 13: return [2];
925
- }
926
- });
927
- }); };
928
- export var deserializeAws_json1_1ModifyClusterCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
929
- var data, contents, response;
930
- return __generator(this, function (_a) {
931
- switch (_a.label) {
932
- case 0:
933
- if (output.statusCode >= 300) {
934
- return [2, deserializeAws_json1_1ModifyClusterCommandError(output, context)];
935
- }
936
- return [4, parseBody(output.body, context)];
937
- case 1:
938
- data = _a.sent();
939
- contents = {};
940
- contents = deserializeAws_json1_1ModifyClusterResponse(data, context);
941
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
942
- return [2, Promise.resolve(response)];
943
- }
944
- });
945
- }); };
946
- var deserializeAws_json1_1ModifyClusterCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
947
- var parsedOutput, _a, errorCode, _b, parsedBody;
948
- var _c;
949
- return __generator(this, function (_d) {
950
- switch (_d.label) {
951
- case 0:
952
- _a = [__assign({}, output)];
953
- _c = {};
954
- return [4, parseErrorBody(output.body, context)];
955
- case 1:
956
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
957
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
958
- _b = errorCode;
959
- switch (_b) {
960
- case "CloudHsmAccessDeniedException": return [3, 2];
961
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
962
- case "CloudHsmInternalFailureException": return [3, 4];
963
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
964
- case "CloudHsmInvalidRequestException": return [3, 6];
965
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
966
- case "CloudHsmResourceNotFoundException": return [3, 8];
967
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
968
- case "CloudHsmServiceException": return [3, 10];
969
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
970
- }
971
- return [3, 12];
972
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
973
- case 3: throw _d.sent();
974
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
975
- case 5: throw _d.sent();
976
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
977
- case 7: throw _d.sent();
978
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
979
- case 9: throw _d.sent();
980
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
981
- case 11: throw _d.sent();
982
- case 12:
983
- parsedBody = parsedOutput.body;
984
- throwDefaultError({
985
- output: output,
986
- parsedBody: parsedBody,
987
- exceptionCtor: __BaseException,
988
- errorCode: errorCode,
989
- });
990
- _d.label = 13;
991
- case 13: return [2];
992
- }
993
- });
994
- }); };
995
- export var deserializeAws_json1_1RestoreBackupCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
996
- var data, contents, response;
997
- return __generator(this, function (_a) {
998
- switch (_a.label) {
999
- case 0:
1000
- if (output.statusCode >= 300) {
1001
- return [2, deserializeAws_json1_1RestoreBackupCommandError(output, context)];
1002
- }
1003
- return [4, parseBody(output.body, context)];
1004
- case 1:
1005
- data = _a.sent();
1006
- contents = {};
1007
- contents = deserializeAws_json1_1RestoreBackupResponse(data, context);
1008
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
1009
- return [2, Promise.resolve(response)];
1010
- }
1011
- });
1012
- }); };
1013
- var deserializeAws_json1_1RestoreBackupCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1014
- var parsedOutput, _a, errorCode, _b, parsedBody;
1015
- var _c;
1016
- return __generator(this, function (_d) {
1017
- switch (_d.label) {
1018
- case 0:
1019
- _a = [__assign({}, output)];
1020
- _c = {};
1021
- return [4, parseErrorBody(output.body, context)];
1022
- case 1:
1023
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1024
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1025
- _b = errorCode;
1026
- switch (_b) {
1027
- case "CloudHsmAccessDeniedException": return [3, 2];
1028
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
1029
- case "CloudHsmInternalFailureException": return [3, 4];
1030
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
1031
- case "CloudHsmInvalidRequestException": return [3, 6];
1032
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
1033
- case "CloudHsmResourceNotFoundException": return [3, 8];
1034
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
1035
- case "CloudHsmServiceException": return [3, 10];
1036
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
1037
- }
1038
- return [3, 12];
1039
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
1040
- case 3: throw _d.sent();
1041
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
1042
- case 5: throw _d.sent();
1043
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
1044
- case 7: throw _d.sent();
1045
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
1046
- case 9: throw _d.sent();
1047
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
1048
- case 11: throw _d.sent();
1049
- case 12:
1050
- parsedBody = parsedOutput.body;
1051
- throwDefaultError({
1052
- output: output,
1053
- parsedBody: parsedBody,
1054
- exceptionCtor: __BaseException,
1055
- errorCode: errorCode,
1056
- });
1057
- _d.label = 13;
1058
- case 13: return [2];
1059
- }
1060
- });
1061
- }); };
1062
- export var deserializeAws_json1_1TagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1063
- var data, contents, response;
1064
- return __generator(this, function (_a) {
1065
- switch (_a.label) {
1066
- case 0:
1067
- if (output.statusCode >= 300) {
1068
- return [2, deserializeAws_json1_1TagResourceCommandError(output, context)];
1069
- }
1070
- return [4, parseBody(output.body, context)];
1071
- case 1:
1072
- data = _a.sent();
1073
- contents = {};
1074
- contents = deserializeAws_json1_1TagResourceResponse(data, context);
1075
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
1076
- return [2, Promise.resolve(response)];
1077
- }
1078
- });
1079
- }); };
1080
- var deserializeAws_json1_1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1081
- var parsedOutput, _a, errorCode, _b, parsedBody;
1082
- var _c;
1083
- return __generator(this, function (_d) {
1084
- switch (_d.label) {
1085
- case 0:
1086
- _a = [__assign({}, output)];
1087
- _c = {};
1088
- return [4, parseErrorBody(output.body, context)];
1089
- case 1:
1090
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1091
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1092
- _b = errorCode;
1093
- switch (_b) {
1094
- case "CloudHsmAccessDeniedException": return [3, 2];
1095
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
1096
- case "CloudHsmInternalFailureException": return [3, 4];
1097
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
1098
- case "CloudHsmInvalidRequestException": return [3, 6];
1099
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
1100
- case "CloudHsmResourceNotFoundException": return [3, 8];
1101
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
1102
- case "CloudHsmServiceException": return [3, 10];
1103
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
1104
- case "CloudHsmTagException": return [3, 12];
1105
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 12];
1106
- }
1107
- return [3, 14];
1108
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
1109
- case 3: throw _d.sent();
1110
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
1111
- case 5: throw _d.sent();
1112
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
1113
- case 7: throw _d.sent();
1114
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
1115
- case 9: throw _d.sent();
1116
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
1117
- case 11: throw _d.sent();
1118
- case 12: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
1119
- case 13: throw _d.sent();
1120
- case 14:
1121
- parsedBody = parsedOutput.body;
1122
- throwDefaultError({
1123
- output: output,
1124
- parsedBody: parsedBody,
1125
- exceptionCtor: __BaseException,
1126
- errorCode: errorCode,
1127
- });
1128
- _d.label = 15;
1129
- case 15: return [2];
1130
- }
1131
- });
1132
- }); };
1133
- export var deserializeAws_json1_1UntagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1134
- var data, contents, response;
1135
- return __generator(this, function (_a) {
1136
- switch (_a.label) {
1137
- case 0:
1138
- if (output.statusCode >= 300) {
1139
- return [2, deserializeAws_json1_1UntagResourceCommandError(output, context)];
1140
- }
1141
- return [4, parseBody(output.body, context)];
1142
- case 1:
1143
- data = _a.sent();
1144
- contents = {};
1145
- contents = deserializeAws_json1_1UntagResourceResponse(data, context);
1146
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
1147
- return [2, Promise.resolve(response)];
1148
- }
1149
- });
1150
- }); };
1151
- var deserializeAws_json1_1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1152
- var parsedOutput, _a, errorCode, _b, parsedBody;
1153
- var _c;
1154
- return __generator(this, function (_d) {
1155
- switch (_d.label) {
1156
- case 0:
1157
- _a = [__assign({}, output)];
1158
- _c = {};
1159
- return [4, parseErrorBody(output.body, context)];
1160
- case 1:
1161
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1162
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1163
- _b = errorCode;
1164
- switch (_b) {
1165
- case "CloudHsmAccessDeniedException": return [3, 2];
1166
- case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException": return [3, 2];
1167
- case "CloudHsmInternalFailureException": return [3, 4];
1168
- case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException": return [3, 4];
1169
- case "CloudHsmInvalidRequestException": return [3, 6];
1170
- case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException": return [3, 6];
1171
- case "CloudHsmResourceNotFoundException": return [3, 8];
1172
- case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException": return [3, 8];
1173
- case "CloudHsmServiceException": return [3, 10];
1174
- case "com.amazonaws.cloudhsmv2#CloudHsmServiceException": return [3, 10];
1175
- case "CloudHsmTagException": return [3, 12];
1176
- case "com.amazonaws.cloudhsmv2#CloudHsmTagException": return [3, 12];
1177
- }
1178
- return [3, 14];
1179
- case 2: return [4, deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context)];
1180
- case 3: throw _d.sent();
1181
- case 4: return [4, deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context)];
1182
- case 5: throw _d.sent();
1183
- case 6: return [4, deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context)];
1184
- case 7: throw _d.sent();
1185
- case 8: return [4, deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context)];
1186
- case 9: throw _d.sent();
1187
- case 10: return [4, deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context)];
1188
- case 11: throw _d.sent();
1189
- case 12: return [4, deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context)];
1190
- case 13: throw _d.sent();
1191
- case 14:
1192
- parsedBody = parsedOutput.body;
1193
- throwDefaultError({
1194
- output: output,
1195
- parsedBody: parsedBody,
1196
- exceptionCtor: __BaseException,
1197
- errorCode: errorCode,
1198
- });
1199
- _d.label = 15;
1200
- case 15: return [2];
1201
- }
1202
- });
1203
- }); };
1204
- var deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1205
- var body, deserialized, exception;
1206
- return __generator(this, function (_a) {
1207
- body = parsedOutput.body;
1208
- deserialized = deserializeAws_json1_1CloudHsmAccessDeniedException(body, context);
1209
- exception = new CloudHsmAccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
1210
- return [2, __decorateServiceException(exception, body)];
5
+ export const serializeAws_json1_1CopyBackupToRegionCommand = async (input, context) => {
6
+ const headers = {
7
+ "content-type": "application/x-amz-json-1.1",
8
+ "x-amz-target": "BaldrApiService.CopyBackupToRegion",
9
+ };
10
+ let body;
11
+ body = JSON.stringify(serializeAws_json1_1CopyBackupToRegionRequest(input, context));
12
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
13
+ };
14
+ export const serializeAws_json1_1CreateClusterCommand = async (input, context) => {
15
+ const headers = {
16
+ "content-type": "application/x-amz-json-1.1",
17
+ "x-amz-target": "BaldrApiService.CreateCluster",
18
+ };
19
+ let body;
20
+ body = JSON.stringify(serializeAws_json1_1CreateClusterRequest(input, context));
21
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
22
+ };
23
+ export const serializeAws_json1_1CreateHsmCommand = async (input, context) => {
24
+ const headers = {
25
+ "content-type": "application/x-amz-json-1.1",
26
+ "x-amz-target": "BaldrApiService.CreateHsm",
27
+ };
28
+ let body;
29
+ body = JSON.stringify(serializeAws_json1_1CreateHsmRequest(input, context));
30
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
31
+ };
32
+ export const serializeAws_json1_1DeleteBackupCommand = async (input, context) => {
33
+ const headers = {
34
+ "content-type": "application/x-amz-json-1.1",
35
+ "x-amz-target": "BaldrApiService.DeleteBackup",
36
+ };
37
+ let body;
38
+ body = JSON.stringify(serializeAws_json1_1DeleteBackupRequest(input, context));
39
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
40
+ };
41
+ export const serializeAws_json1_1DeleteClusterCommand = async (input, context) => {
42
+ const headers = {
43
+ "content-type": "application/x-amz-json-1.1",
44
+ "x-amz-target": "BaldrApiService.DeleteCluster",
45
+ };
46
+ let body;
47
+ body = JSON.stringify(serializeAws_json1_1DeleteClusterRequest(input, context));
48
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
49
+ };
50
+ export const serializeAws_json1_1DeleteHsmCommand = async (input, context) => {
51
+ const headers = {
52
+ "content-type": "application/x-amz-json-1.1",
53
+ "x-amz-target": "BaldrApiService.DeleteHsm",
54
+ };
55
+ let body;
56
+ body = JSON.stringify(serializeAws_json1_1DeleteHsmRequest(input, context));
57
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
58
+ };
59
+ export const serializeAws_json1_1DescribeBackupsCommand = async (input, context) => {
60
+ const headers = {
61
+ "content-type": "application/x-amz-json-1.1",
62
+ "x-amz-target": "BaldrApiService.DescribeBackups",
63
+ };
64
+ let body;
65
+ body = JSON.stringify(serializeAws_json1_1DescribeBackupsRequest(input, context));
66
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
67
+ };
68
+ export const serializeAws_json1_1DescribeClustersCommand = async (input, context) => {
69
+ const headers = {
70
+ "content-type": "application/x-amz-json-1.1",
71
+ "x-amz-target": "BaldrApiService.DescribeClusters",
72
+ };
73
+ let body;
74
+ body = JSON.stringify(serializeAws_json1_1DescribeClustersRequest(input, context));
75
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
76
+ };
77
+ export const serializeAws_json1_1InitializeClusterCommand = async (input, context) => {
78
+ const headers = {
79
+ "content-type": "application/x-amz-json-1.1",
80
+ "x-amz-target": "BaldrApiService.InitializeCluster",
81
+ };
82
+ let body;
83
+ body = JSON.stringify(serializeAws_json1_1InitializeClusterRequest(input, context));
84
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
85
+ };
86
+ export const serializeAws_json1_1ListTagsCommand = async (input, context) => {
87
+ const headers = {
88
+ "content-type": "application/x-amz-json-1.1",
89
+ "x-amz-target": "BaldrApiService.ListTags",
90
+ };
91
+ let body;
92
+ body = JSON.stringify(serializeAws_json1_1ListTagsRequest(input, context));
93
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
94
+ };
95
+ export const serializeAws_json1_1ModifyBackupAttributesCommand = async (input, context) => {
96
+ const headers = {
97
+ "content-type": "application/x-amz-json-1.1",
98
+ "x-amz-target": "BaldrApiService.ModifyBackupAttributes",
99
+ };
100
+ let body;
101
+ body = JSON.stringify(serializeAws_json1_1ModifyBackupAttributesRequest(input, context));
102
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
103
+ };
104
+ export const serializeAws_json1_1ModifyClusterCommand = async (input, context) => {
105
+ const headers = {
106
+ "content-type": "application/x-amz-json-1.1",
107
+ "x-amz-target": "BaldrApiService.ModifyCluster",
108
+ };
109
+ let body;
110
+ body = JSON.stringify(serializeAws_json1_1ModifyClusterRequest(input, context));
111
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
112
+ };
113
+ export const serializeAws_json1_1RestoreBackupCommand = async (input, context) => {
114
+ const headers = {
115
+ "content-type": "application/x-amz-json-1.1",
116
+ "x-amz-target": "BaldrApiService.RestoreBackup",
117
+ };
118
+ let body;
119
+ body = JSON.stringify(serializeAws_json1_1RestoreBackupRequest(input, context));
120
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
121
+ };
122
+ export const serializeAws_json1_1TagResourceCommand = async (input, context) => {
123
+ const headers = {
124
+ "content-type": "application/x-amz-json-1.1",
125
+ "x-amz-target": "BaldrApiService.TagResource",
126
+ };
127
+ let body;
128
+ body = JSON.stringify(serializeAws_json1_1TagResourceRequest(input, context));
129
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
130
+ };
131
+ export const serializeAws_json1_1UntagResourceCommand = async (input, context) => {
132
+ const headers = {
133
+ "content-type": "application/x-amz-json-1.1",
134
+ "x-amz-target": "BaldrApiService.UntagResource",
135
+ };
136
+ let body;
137
+ body = JSON.stringify(serializeAws_json1_1UntagResourceRequest(input, context));
138
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
139
+ };
140
+ export const deserializeAws_json1_1CopyBackupToRegionCommand = async (output, context) => {
141
+ if (output.statusCode >= 300) {
142
+ return deserializeAws_json1_1CopyBackupToRegionCommandError(output, context);
143
+ }
144
+ const data = await parseBody(output.body, context);
145
+ let contents = {};
146
+ contents = deserializeAws_json1_1CopyBackupToRegionResponse(data, context);
147
+ const response = {
148
+ $metadata: deserializeMetadata(output),
149
+ ...contents,
150
+ };
151
+ return Promise.resolve(response);
152
+ };
153
+ const deserializeAws_json1_1CopyBackupToRegionCommandError = async (output, context) => {
154
+ const parsedOutput = {
155
+ ...output,
156
+ body: await parseErrorBody(output.body, context),
157
+ };
158
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
159
+ switch (errorCode) {
160
+ case "CloudHsmAccessDeniedException":
161
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
162
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
163
+ case "CloudHsmInternalFailureException":
164
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
165
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
166
+ case "CloudHsmInvalidRequestException":
167
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
168
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
169
+ case "CloudHsmResourceNotFoundException":
170
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
171
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
172
+ case "CloudHsmServiceException":
173
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
174
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
175
+ case "CloudHsmTagException":
176
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
177
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
178
+ default:
179
+ const parsedBody = parsedOutput.body;
180
+ throwDefaultError({
181
+ output,
182
+ parsedBody,
183
+ exceptionCtor: __BaseException,
184
+ errorCode,
185
+ });
186
+ }
187
+ };
188
+ export const deserializeAws_json1_1CreateClusterCommand = async (output, context) => {
189
+ if (output.statusCode >= 300) {
190
+ return deserializeAws_json1_1CreateClusterCommandError(output, context);
191
+ }
192
+ const data = await parseBody(output.body, context);
193
+ let contents = {};
194
+ contents = deserializeAws_json1_1CreateClusterResponse(data, context);
195
+ const response = {
196
+ $metadata: deserializeMetadata(output),
197
+ ...contents,
198
+ };
199
+ return Promise.resolve(response);
200
+ };
201
+ const deserializeAws_json1_1CreateClusterCommandError = async (output, context) => {
202
+ const parsedOutput = {
203
+ ...output,
204
+ body: await parseErrorBody(output.body, context),
205
+ };
206
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
207
+ switch (errorCode) {
208
+ case "CloudHsmAccessDeniedException":
209
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
210
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
211
+ case "CloudHsmInternalFailureException":
212
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
213
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
214
+ case "CloudHsmInvalidRequestException":
215
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
216
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
217
+ case "CloudHsmResourceNotFoundException":
218
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
219
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
220
+ case "CloudHsmServiceException":
221
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
222
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
223
+ case "CloudHsmTagException":
224
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
225
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
226
+ default:
227
+ const parsedBody = parsedOutput.body;
228
+ throwDefaultError({
229
+ output,
230
+ parsedBody,
231
+ exceptionCtor: __BaseException,
232
+ errorCode,
233
+ });
234
+ }
235
+ };
236
+ export const deserializeAws_json1_1CreateHsmCommand = async (output, context) => {
237
+ if (output.statusCode >= 300) {
238
+ return deserializeAws_json1_1CreateHsmCommandError(output, context);
239
+ }
240
+ const data = await parseBody(output.body, context);
241
+ let contents = {};
242
+ contents = deserializeAws_json1_1CreateHsmResponse(data, context);
243
+ const response = {
244
+ $metadata: deserializeMetadata(output),
245
+ ...contents,
246
+ };
247
+ return Promise.resolve(response);
248
+ };
249
+ const deserializeAws_json1_1CreateHsmCommandError = async (output, context) => {
250
+ const parsedOutput = {
251
+ ...output,
252
+ body: await parseErrorBody(output.body, context),
253
+ };
254
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
255
+ switch (errorCode) {
256
+ case "CloudHsmAccessDeniedException":
257
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
258
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
259
+ case "CloudHsmInternalFailureException":
260
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
261
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
262
+ case "CloudHsmInvalidRequestException":
263
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
264
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
265
+ case "CloudHsmResourceNotFoundException":
266
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
267
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
268
+ case "CloudHsmServiceException":
269
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
270
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
271
+ default:
272
+ const parsedBody = parsedOutput.body;
273
+ throwDefaultError({
274
+ output,
275
+ parsedBody,
276
+ exceptionCtor: __BaseException,
277
+ errorCode,
278
+ });
279
+ }
280
+ };
281
+ export const deserializeAws_json1_1DeleteBackupCommand = async (output, context) => {
282
+ if (output.statusCode >= 300) {
283
+ return deserializeAws_json1_1DeleteBackupCommandError(output, context);
284
+ }
285
+ const data = await parseBody(output.body, context);
286
+ let contents = {};
287
+ contents = deserializeAws_json1_1DeleteBackupResponse(data, context);
288
+ const response = {
289
+ $metadata: deserializeMetadata(output),
290
+ ...contents,
291
+ };
292
+ return Promise.resolve(response);
293
+ };
294
+ const deserializeAws_json1_1DeleteBackupCommandError = async (output, context) => {
295
+ const parsedOutput = {
296
+ ...output,
297
+ body: await parseErrorBody(output.body, context),
298
+ };
299
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
300
+ switch (errorCode) {
301
+ case "CloudHsmAccessDeniedException":
302
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
303
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
304
+ case "CloudHsmInternalFailureException":
305
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
306
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
307
+ case "CloudHsmInvalidRequestException":
308
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
309
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
310
+ case "CloudHsmResourceNotFoundException":
311
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
312
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
313
+ case "CloudHsmServiceException":
314
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
315
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
316
+ default:
317
+ const parsedBody = parsedOutput.body;
318
+ throwDefaultError({
319
+ output,
320
+ parsedBody,
321
+ exceptionCtor: __BaseException,
322
+ errorCode,
323
+ });
324
+ }
325
+ };
326
+ export const deserializeAws_json1_1DeleteClusterCommand = async (output, context) => {
327
+ if (output.statusCode >= 300) {
328
+ return deserializeAws_json1_1DeleteClusterCommandError(output, context);
329
+ }
330
+ const data = await parseBody(output.body, context);
331
+ let contents = {};
332
+ contents = deserializeAws_json1_1DeleteClusterResponse(data, context);
333
+ const response = {
334
+ $metadata: deserializeMetadata(output),
335
+ ...contents,
336
+ };
337
+ return Promise.resolve(response);
338
+ };
339
+ const deserializeAws_json1_1DeleteClusterCommandError = async (output, context) => {
340
+ const parsedOutput = {
341
+ ...output,
342
+ body: await parseErrorBody(output.body, context),
343
+ };
344
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
345
+ switch (errorCode) {
346
+ case "CloudHsmAccessDeniedException":
347
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
348
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
349
+ case "CloudHsmInternalFailureException":
350
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
351
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
352
+ case "CloudHsmInvalidRequestException":
353
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
354
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
355
+ case "CloudHsmResourceNotFoundException":
356
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
357
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
358
+ case "CloudHsmServiceException":
359
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
360
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
361
+ case "CloudHsmTagException":
362
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
363
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
364
+ default:
365
+ const parsedBody = parsedOutput.body;
366
+ throwDefaultError({
367
+ output,
368
+ parsedBody,
369
+ exceptionCtor: __BaseException,
370
+ errorCode,
371
+ });
372
+ }
373
+ };
374
+ export const deserializeAws_json1_1DeleteHsmCommand = async (output, context) => {
375
+ if (output.statusCode >= 300) {
376
+ return deserializeAws_json1_1DeleteHsmCommandError(output, context);
377
+ }
378
+ const data = await parseBody(output.body, context);
379
+ let contents = {};
380
+ contents = deserializeAws_json1_1DeleteHsmResponse(data, context);
381
+ const response = {
382
+ $metadata: deserializeMetadata(output),
383
+ ...contents,
384
+ };
385
+ return Promise.resolve(response);
386
+ };
387
+ const deserializeAws_json1_1DeleteHsmCommandError = async (output, context) => {
388
+ const parsedOutput = {
389
+ ...output,
390
+ body: await parseErrorBody(output.body, context),
391
+ };
392
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
393
+ switch (errorCode) {
394
+ case "CloudHsmAccessDeniedException":
395
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
396
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
397
+ case "CloudHsmInternalFailureException":
398
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
399
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
400
+ case "CloudHsmInvalidRequestException":
401
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
402
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
403
+ case "CloudHsmResourceNotFoundException":
404
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
405
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
406
+ case "CloudHsmServiceException":
407
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
408
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
409
+ default:
410
+ const parsedBody = parsedOutput.body;
411
+ throwDefaultError({
412
+ output,
413
+ parsedBody,
414
+ exceptionCtor: __BaseException,
415
+ errorCode,
416
+ });
417
+ }
418
+ };
419
+ export const deserializeAws_json1_1DescribeBackupsCommand = async (output, context) => {
420
+ if (output.statusCode >= 300) {
421
+ return deserializeAws_json1_1DescribeBackupsCommandError(output, context);
422
+ }
423
+ const data = await parseBody(output.body, context);
424
+ let contents = {};
425
+ contents = deserializeAws_json1_1DescribeBackupsResponse(data, context);
426
+ const response = {
427
+ $metadata: deserializeMetadata(output),
428
+ ...contents,
429
+ };
430
+ return Promise.resolve(response);
431
+ };
432
+ const deserializeAws_json1_1DescribeBackupsCommandError = async (output, context) => {
433
+ const parsedOutput = {
434
+ ...output,
435
+ body: await parseErrorBody(output.body, context),
436
+ };
437
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
438
+ switch (errorCode) {
439
+ case "CloudHsmAccessDeniedException":
440
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
441
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
442
+ case "CloudHsmInternalFailureException":
443
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
444
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
445
+ case "CloudHsmInvalidRequestException":
446
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
447
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
448
+ case "CloudHsmResourceNotFoundException":
449
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
450
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
451
+ case "CloudHsmServiceException":
452
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
453
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
454
+ case "CloudHsmTagException":
455
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
456
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
457
+ default:
458
+ const parsedBody = parsedOutput.body;
459
+ throwDefaultError({
460
+ output,
461
+ parsedBody,
462
+ exceptionCtor: __BaseException,
463
+ errorCode,
464
+ });
465
+ }
466
+ };
467
+ export const deserializeAws_json1_1DescribeClustersCommand = async (output, context) => {
468
+ if (output.statusCode >= 300) {
469
+ return deserializeAws_json1_1DescribeClustersCommandError(output, context);
470
+ }
471
+ const data = await parseBody(output.body, context);
472
+ let contents = {};
473
+ contents = deserializeAws_json1_1DescribeClustersResponse(data, context);
474
+ const response = {
475
+ $metadata: deserializeMetadata(output),
476
+ ...contents,
477
+ };
478
+ return Promise.resolve(response);
479
+ };
480
+ const deserializeAws_json1_1DescribeClustersCommandError = async (output, context) => {
481
+ const parsedOutput = {
482
+ ...output,
483
+ body: await parseErrorBody(output.body, context),
484
+ };
485
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
486
+ switch (errorCode) {
487
+ case "CloudHsmAccessDeniedException":
488
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
489
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
490
+ case "CloudHsmInternalFailureException":
491
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
492
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
493
+ case "CloudHsmInvalidRequestException":
494
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
495
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
496
+ case "CloudHsmServiceException":
497
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
498
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
499
+ case "CloudHsmTagException":
500
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
501
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
502
+ default:
503
+ const parsedBody = parsedOutput.body;
504
+ throwDefaultError({
505
+ output,
506
+ parsedBody,
507
+ exceptionCtor: __BaseException,
508
+ errorCode,
509
+ });
510
+ }
511
+ };
512
+ export const deserializeAws_json1_1InitializeClusterCommand = async (output, context) => {
513
+ if (output.statusCode >= 300) {
514
+ return deserializeAws_json1_1InitializeClusterCommandError(output, context);
515
+ }
516
+ const data = await parseBody(output.body, context);
517
+ let contents = {};
518
+ contents = deserializeAws_json1_1InitializeClusterResponse(data, context);
519
+ const response = {
520
+ $metadata: deserializeMetadata(output),
521
+ ...contents,
522
+ };
523
+ return Promise.resolve(response);
524
+ };
525
+ const deserializeAws_json1_1InitializeClusterCommandError = async (output, context) => {
526
+ const parsedOutput = {
527
+ ...output,
528
+ body: await parseErrorBody(output.body, context),
529
+ };
530
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
531
+ switch (errorCode) {
532
+ case "CloudHsmAccessDeniedException":
533
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
534
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
535
+ case "CloudHsmInternalFailureException":
536
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
537
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
538
+ case "CloudHsmInvalidRequestException":
539
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
540
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
541
+ case "CloudHsmResourceNotFoundException":
542
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
543
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
544
+ case "CloudHsmServiceException":
545
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
546
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
547
+ default:
548
+ const parsedBody = parsedOutput.body;
549
+ throwDefaultError({
550
+ output,
551
+ parsedBody,
552
+ exceptionCtor: __BaseException,
553
+ errorCode,
554
+ });
555
+ }
556
+ };
557
+ export const deserializeAws_json1_1ListTagsCommand = async (output, context) => {
558
+ if (output.statusCode >= 300) {
559
+ return deserializeAws_json1_1ListTagsCommandError(output, context);
560
+ }
561
+ const data = await parseBody(output.body, context);
562
+ let contents = {};
563
+ contents = deserializeAws_json1_1ListTagsResponse(data, context);
564
+ const response = {
565
+ $metadata: deserializeMetadata(output),
566
+ ...contents,
567
+ };
568
+ return Promise.resolve(response);
569
+ };
570
+ const deserializeAws_json1_1ListTagsCommandError = async (output, context) => {
571
+ const parsedOutput = {
572
+ ...output,
573
+ body: await parseErrorBody(output.body, context),
574
+ };
575
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
576
+ switch (errorCode) {
577
+ case "CloudHsmAccessDeniedException":
578
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
579
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
580
+ case "CloudHsmInternalFailureException":
581
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
582
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
583
+ case "CloudHsmInvalidRequestException":
584
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
585
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
586
+ case "CloudHsmResourceNotFoundException":
587
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
588
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
589
+ case "CloudHsmServiceException":
590
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
591
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
592
+ case "CloudHsmTagException":
593
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
594
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
595
+ default:
596
+ const parsedBody = parsedOutput.body;
597
+ throwDefaultError({
598
+ output,
599
+ parsedBody,
600
+ exceptionCtor: __BaseException,
601
+ errorCode,
602
+ });
603
+ }
604
+ };
605
+ export const deserializeAws_json1_1ModifyBackupAttributesCommand = async (output, context) => {
606
+ if (output.statusCode >= 300) {
607
+ return deserializeAws_json1_1ModifyBackupAttributesCommandError(output, context);
608
+ }
609
+ const data = await parseBody(output.body, context);
610
+ let contents = {};
611
+ contents = deserializeAws_json1_1ModifyBackupAttributesResponse(data, context);
612
+ const response = {
613
+ $metadata: deserializeMetadata(output),
614
+ ...contents,
615
+ };
616
+ return Promise.resolve(response);
617
+ };
618
+ const deserializeAws_json1_1ModifyBackupAttributesCommandError = async (output, context) => {
619
+ const parsedOutput = {
620
+ ...output,
621
+ body: await parseErrorBody(output.body, context),
622
+ };
623
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
624
+ switch (errorCode) {
625
+ case "CloudHsmAccessDeniedException":
626
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
627
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
628
+ case "CloudHsmInternalFailureException":
629
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
630
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
631
+ case "CloudHsmInvalidRequestException":
632
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
633
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
634
+ case "CloudHsmResourceNotFoundException":
635
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
636
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
637
+ case "CloudHsmServiceException":
638
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
639
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
640
+ default:
641
+ const parsedBody = parsedOutput.body;
642
+ throwDefaultError({
643
+ output,
644
+ parsedBody,
645
+ exceptionCtor: __BaseException,
646
+ errorCode,
647
+ });
648
+ }
649
+ };
650
+ export const deserializeAws_json1_1ModifyClusterCommand = async (output, context) => {
651
+ if (output.statusCode >= 300) {
652
+ return deserializeAws_json1_1ModifyClusterCommandError(output, context);
653
+ }
654
+ const data = await parseBody(output.body, context);
655
+ let contents = {};
656
+ contents = deserializeAws_json1_1ModifyClusterResponse(data, context);
657
+ const response = {
658
+ $metadata: deserializeMetadata(output),
659
+ ...contents,
660
+ };
661
+ return Promise.resolve(response);
662
+ };
663
+ const deserializeAws_json1_1ModifyClusterCommandError = async (output, context) => {
664
+ const parsedOutput = {
665
+ ...output,
666
+ body: await parseErrorBody(output.body, context),
667
+ };
668
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
669
+ switch (errorCode) {
670
+ case "CloudHsmAccessDeniedException":
671
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
672
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
673
+ case "CloudHsmInternalFailureException":
674
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
675
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
676
+ case "CloudHsmInvalidRequestException":
677
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
678
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
679
+ case "CloudHsmResourceNotFoundException":
680
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
681
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
682
+ case "CloudHsmServiceException":
683
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
684
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
685
+ default:
686
+ const parsedBody = parsedOutput.body;
687
+ throwDefaultError({
688
+ output,
689
+ parsedBody,
690
+ exceptionCtor: __BaseException,
691
+ errorCode,
692
+ });
693
+ }
694
+ };
695
+ export const deserializeAws_json1_1RestoreBackupCommand = async (output, context) => {
696
+ if (output.statusCode >= 300) {
697
+ return deserializeAws_json1_1RestoreBackupCommandError(output, context);
698
+ }
699
+ const data = await parseBody(output.body, context);
700
+ let contents = {};
701
+ contents = deserializeAws_json1_1RestoreBackupResponse(data, context);
702
+ const response = {
703
+ $metadata: deserializeMetadata(output),
704
+ ...contents,
705
+ };
706
+ return Promise.resolve(response);
707
+ };
708
+ const deserializeAws_json1_1RestoreBackupCommandError = async (output, context) => {
709
+ const parsedOutput = {
710
+ ...output,
711
+ body: await parseErrorBody(output.body, context),
712
+ };
713
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
714
+ switch (errorCode) {
715
+ case "CloudHsmAccessDeniedException":
716
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
717
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
718
+ case "CloudHsmInternalFailureException":
719
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
720
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
721
+ case "CloudHsmInvalidRequestException":
722
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
723
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
724
+ case "CloudHsmResourceNotFoundException":
725
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
726
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
727
+ case "CloudHsmServiceException":
728
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
729
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
730
+ default:
731
+ const parsedBody = parsedOutput.body;
732
+ throwDefaultError({
733
+ output,
734
+ parsedBody,
735
+ exceptionCtor: __BaseException,
736
+ errorCode,
737
+ });
738
+ }
739
+ };
740
+ export const deserializeAws_json1_1TagResourceCommand = async (output, context) => {
741
+ if (output.statusCode >= 300) {
742
+ return deserializeAws_json1_1TagResourceCommandError(output, context);
743
+ }
744
+ const data = await parseBody(output.body, context);
745
+ let contents = {};
746
+ contents = deserializeAws_json1_1TagResourceResponse(data, context);
747
+ const response = {
748
+ $metadata: deserializeMetadata(output),
749
+ ...contents,
750
+ };
751
+ return Promise.resolve(response);
752
+ };
753
+ const deserializeAws_json1_1TagResourceCommandError = async (output, context) => {
754
+ const parsedOutput = {
755
+ ...output,
756
+ body: await parseErrorBody(output.body, context),
757
+ };
758
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
759
+ switch (errorCode) {
760
+ case "CloudHsmAccessDeniedException":
761
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
762
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
763
+ case "CloudHsmInternalFailureException":
764
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
765
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
766
+ case "CloudHsmInvalidRequestException":
767
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
768
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
769
+ case "CloudHsmResourceNotFoundException":
770
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
771
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
772
+ case "CloudHsmServiceException":
773
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
774
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
775
+ case "CloudHsmTagException":
776
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
777
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
778
+ default:
779
+ const parsedBody = parsedOutput.body;
780
+ throwDefaultError({
781
+ output,
782
+ parsedBody,
783
+ exceptionCtor: __BaseException,
784
+ errorCode,
785
+ });
786
+ }
787
+ };
788
+ export const deserializeAws_json1_1UntagResourceCommand = async (output, context) => {
789
+ if (output.statusCode >= 300) {
790
+ return deserializeAws_json1_1UntagResourceCommandError(output, context);
791
+ }
792
+ const data = await parseBody(output.body, context);
793
+ let contents = {};
794
+ contents = deserializeAws_json1_1UntagResourceResponse(data, context);
795
+ const response = {
796
+ $metadata: deserializeMetadata(output),
797
+ ...contents,
798
+ };
799
+ return Promise.resolve(response);
800
+ };
801
+ const deserializeAws_json1_1UntagResourceCommandError = async (output, context) => {
802
+ const parsedOutput = {
803
+ ...output,
804
+ body: await parseErrorBody(output.body, context),
805
+ };
806
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
807
+ switch (errorCode) {
808
+ case "CloudHsmAccessDeniedException":
809
+ case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
810
+ throw await deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse(parsedOutput, context);
811
+ case "CloudHsmInternalFailureException":
812
+ case "com.amazonaws.cloudhsmv2#CloudHsmInternalFailureException":
813
+ throw await deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse(parsedOutput, context);
814
+ case "CloudHsmInvalidRequestException":
815
+ case "com.amazonaws.cloudhsmv2#CloudHsmInvalidRequestException":
816
+ throw await deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse(parsedOutput, context);
817
+ case "CloudHsmResourceNotFoundException":
818
+ case "com.amazonaws.cloudhsmv2#CloudHsmResourceNotFoundException":
819
+ throw await deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse(parsedOutput, context);
820
+ case "CloudHsmServiceException":
821
+ case "com.amazonaws.cloudhsmv2#CloudHsmServiceException":
822
+ throw await deserializeAws_json1_1CloudHsmServiceExceptionResponse(parsedOutput, context);
823
+ case "CloudHsmTagException":
824
+ case "com.amazonaws.cloudhsmv2#CloudHsmTagException":
825
+ throw await deserializeAws_json1_1CloudHsmTagExceptionResponse(parsedOutput, context);
826
+ default:
827
+ const parsedBody = parsedOutput.body;
828
+ throwDefaultError({
829
+ output,
830
+ parsedBody,
831
+ exceptionCtor: __BaseException,
832
+ errorCode,
833
+ });
834
+ }
835
+ };
836
+ const deserializeAws_json1_1CloudHsmAccessDeniedExceptionResponse = async (parsedOutput, context) => {
837
+ const body = parsedOutput.body;
838
+ const deserialized = deserializeAws_json1_1CloudHsmAccessDeniedException(body, context);
839
+ const exception = new CloudHsmAccessDeniedException({
840
+ $metadata: deserializeMetadata(parsedOutput),
841
+ ...deserialized,
1211
842
  });
1212
- }); };
1213
- var deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1214
- var body, deserialized, exception;
1215
- return __generator(this, function (_a) {
1216
- body = parsedOutput.body;
1217
- deserialized = deserializeAws_json1_1CloudHsmInternalFailureException(body, context);
1218
- exception = new CloudHsmInternalFailureException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
1219
- return [2, __decorateServiceException(exception, body)];
843
+ return __decorateServiceException(exception, body);
844
+ };
845
+ const deserializeAws_json1_1CloudHsmInternalFailureExceptionResponse = async (parsedOutput, context) => {
846
+ const body = parsedOutput.body;
847
+ const deserialized = deserializeAws_json1_1CloudHsmInternalFailureException(body, context);
848
+ const exception = new CloudHsmInternalFailureException({
849
+ $metadata: deserializeMetadata(parsedOutput),
850
+ ...deserialized,
1220
851
  });
1221
- }); };
1222
- var deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1223
- var body, deserialized, exception;
1224
- return __generator(this, function (_a) {
1225
- body = parsedOutput.body;
1226
- deserialized = deserializeAws_json1_1CloudHsmInvalidRequestException(body, context);
1227
- exception = new CloudHsmInvalidRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
1228
- return [2, __decorateServiceException(exception, body)];
852
+ return __decorateServiceException(exception, body);
853
+ };
854
+ const deserializeAws_json1_1CloudHsmInvalidRequestExceptionResponse = async (parsedOutput, context) => {
855
+ const body = parsedOutput.body;
856
+ const deserialized = deserializeAws_json1_1CloudHsmInvalidRequestException(body, context);
857
+ const exception = new CloudHsmInvalidRequestException({
858
+ $metadata: deserializeMetadata(parsedOutput),
859
+ ...deserialized,
1229
860
  });
1230
- }); };
1231
- var deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1232
- var body, deserialized, exception;
1233
- return __generator(this, function (_a) {
1234
- body = parsedOutput.body;
1235
- deserialized = deserializeAws_json1_1CloudHsmResourceNotFoundException(body, context);
1236
- exception = new CloudHsmResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
1237
- return [2, __decorateServiceException(exception, body)];
861
+ return __decorateServiceException(exception, body);
862
+ };
863
+ const deserializeAws_json1_1CloudHsmResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
864
+ const body = parsedOutput.body;
865
+ const deserialized = deserializeAws_json1_1CloudHsmResourceNotFoundException(body, context);
866
+ const exception = new CloudHsmResourceNotFoundException({
867
+ $metadata: deserializeMetadata(parsedOutput),
868
+ ...deserialized,
1238
869
  });
1239
- }); };
1240
- var deserializeAws_json1_1CloudHsmServiceExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1241
- var body, deserialized, exception;
1242
- return __generator(this, function (_a) {
1243
- body = parsedOutput.body;
1244
- deserialized = deserializeAws_json1_1CloudHsmServiceException(body, context);
1245
- exception = new CloudHsmServiceException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
1246
- return [2, __decorateServiceException(exception, body)];
870
+ return __decorateServiceException(exception, body);
871
+ };
872
+ const deserializeAws_json1_1CloudHsmServiceExceptionResponse = async (parsedOutput, context) => {
873
+ const body = parsedOutput.body;
874
+ const deserialized = deserializeAws_json1_1CloudHsmServiceException(body, context);
875
+ const exception = new CloudHsmServiceException({
876
+ $metadata: deserializeMetadata(parsedOutput),
877
+ ...deserialized,
1247
878
  });
1248
- }); };
1249
- var deserializeAws_json1_1CloudHsmTagExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1250
- var body, deserialized, exception;
1251
- return __generator(this, function (_a) {
1252
- body = parsedOutput.body;
1253
- deserialized = deserializeAws_json1_1CloudHsmTagException(body, context);
1254
- exception = new CloudHsmTagException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
1255
- return [2, __decorateServiceException(exception, body)];
879
+ return __decorateServiceException(exception, body);
880
+ };
881
+ const deserializeAws_json1_1CloudHsmTagExceptionResponse = async (parsedOutput, context) => {
882
+ const body = parsedOutput.body;
883
+ const deserialized = deserializeAws_json1_1CloudHsmTagException(body, context);
884
+ const exception = new CloudHsmTagException({
885
+ $metadata: deserializeMetadata(parsedOutput),
886
+ ...deserialized,
1256
887
  });
1257
- }); };
1258
- var serializeAws_json1_1BackupRetentionPolicy = function (input, context) {
1259
- return __assign(__assign({}, (input.Type != null && { Type: input.Type })), (input.Value != null && { Value: input.Value }));
888
+ return __decorateServiceException(exception, body);
1260
889
  };
1261
- var serializeAws_json1_1CopyBackupToRegionRequest = function (input, context) {
1262
- return __assign(__assign(__assign({}, (input.BackupId != null && { BackupId: input.BackupId })), (input.DestinationRegion != null && { DestinationRegion: input.DestinationRegion })), (input.TagList != null && { TagList: serializeAws_json1_1TagList(input.TagList, context) }));
890
+ const serializeAws_json1_1BackupRetentionPolicy = (input, context) => {
891
+ return {
892
+ ...(input.Type != null && { Type: input.Type }),
893
+ ...(input.Value != null && { Value: input.Value }),
894
+ };
1263
895
  };
1264
- var serializeAws_json1_1CreateClusterRequest = function (input, context) {
1265
- return __assign(__assign(__assign(__assign(__assign({}, (input.BackupRetentionPolicy != null && {
1266
- BackupRetentionPolicy: serializeAws_json1_1BackupRetentionPolicy(input.BackupRetentionPolicy, context),
1267
- })), (input.HsmType != null && { HsmType: input.HsmType })), (input.SourceBackupId != null && { SourceBackupId: input.SourceBackupId })), (input.SubnetIds != null && { SubnetIds: serializeAws_json1_1SubnetIds(input.SubnetIds, context) })), (input.TagList != null && { TagList: serializeAws_json1_1TagList(input.TagList, context) }));
896
+ const serializeAws_json1_1CopyBackupToRegionRequest = (input, context) => {
897
+ return {
898
+ ...(input.BackupId != null && { BackupId: input.BackupId }),
899
+ ...(input.DestinationRegion != null && { DestinationRegion: input.DestinationRegion }),
900
+ ...(input.TagList != null && { TagList: serializeAws_json1_1TagList(input.TagList, context) }),
901
+ };
902
+ };
903
+ const serializeAws_json1_1CreateClusterRequest = (input, context) => {
904
+ return {
905
+ ...(input.BackupRetentionPolicy != null && {
906
+ BackupRetentionPolicy: serializeAws_json1_1BackupRetentionPolicy(input.BackupRetentionPolicy, context),
907
+ }),
908
+ ...(input.HsmType != null && { HsmType: input.HsmType }),
909
+ ...(input.SourceBackupId != null && { SourceBackupId: input.SourceBackupId }),
910
+ ...(input.SubnetIds != null && { SubnetIds: serializeAws_json1_1SubnetIds(input.SubnetIds, context) }),
911
+ ...(input.TagList != null && { TagList: serializeAws_json1_1TagList(input.TagList, context) }),
912
+ };
1268
913
  };
1269
- var serializeAws_json1_1CreateHsmRequest = function (input, context) {
1270
- return __assign(__assign(__assign({}, (input.AvailabilityZone != null && { AvailabilityZone: input.AvailabilityZone })), (input.ClusterId != null && { ClusterId: input.ClusterId })), (input.IpAddress != null && { IpAddress: input.IpAddress }));
914
+ const serializeAws_json1_1CreateHsmRequest = (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
+ };
1271
920
  };
1272
- var serializeAws_json1_1DeleteBackupRequest = function (input, context) {
1273
- return __assign({}, (input.BackupId != null && { BackupId: input.BackupId }));
921
+ const serializeAws_json1_1DeleteBackupRequest = (input, context) => {
922
+ return {
923
+ ...(input.BackupId != null && { BackupId: input.BackupId }),
924
+ };
1274
925
  };
1275
- var serializeAws_json1_1DeleteClusterRequest = function (input, context) {
1276
- return __assign({}, (input.ClusterId != null && { ClusterId: input.ClusterId }));
926
+ const serializeAws_json1_1DeleteClusterRequest = (input, context) => {
927
+ return {
928
+ ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
929
+ };
1277
930
  };
1278
- var serializeAws_json1_1DeleteHsmRequest = function (input, context) {
1279
- return __assign(__assign(__assign(__assign({}, (input.ClusterId != null && { ClusterId: input.ClusterId })), (input.EniId != null && { EniId: input.EniId })), (input.EniIp != null && { EniIp: input.EniIp })), (input.HsmId != null && { HsmId: input.HsmId }));
931
+ const serializeAws_json1_1DeleteHsmRequest = (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
+ };
1280
938
  };
1281
- var serializeAws_json1_1DescribeBackupsRequest = function (input, context) {
1282
- return __assign(__assign(__assign(__assign({}, (input.Filters != null && { Filters: serializeAws_json1_1Filters(input.Filters, context) })), (input.MaxResults != null && { MaxResults: input.MaxResults })), (input.NextToken != null && { NextToken: input.NextToken })), (input.SortAscending != null && { SortAscending: input.SortAscending }));
939
+ const serializeAws_json1_1DescribeBackupsRequest = (input, context) => {
940
+ return {
941
+ ...(input.Filters != null && { Filters: serializeAws_json1_1Filters(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
+ };
1283
946
  };
1284
- var serializeAws_json1_1DescribeClustersRequest = function (input, context) {
1285
- return __assign(__assign(__assign({}, (input.Filters != null && { Filters: serializeAws_json1_1Filters(input.Filters, context) })), (input.MaxResults != null && { MaxResults: input.MaxResults })), (input.NextToken != null && { NextToken: input.NextToken }));
947
+ const serializeAws_json1_1DescribeClustersRequest = (input, context) => {
948
+ return {
949
+ ...(input.Filters != null && { Filters: serializeAws_json1_1Filters(input.Filters, context) }),
950
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
951
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
952
+ };
1286
953
  };
1287
- var serializeAws_json1_1Filters = function (input, context) {
1288
- return Object.entries(input).reduce(function (acc, _a) {
1289
- var _b;
1290
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
954
+ const serializeAws_json1_1Filters = (input, context) => {
955
+ return Object.entries(input).reduce((acc, [key, value]) => {
1291
956
  if (value === null) {
1292
957
  return acc;
1293
958
  }
1294
- return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_json1_1Strings(value, context), _b));
959
+ return {
960
+ ...acc,
961
+ [key]: serializeAws_json1_1Strings(value, context),
962
+ };
1295
963
  }, {});
1296
964
  };
1297
- var serializeAws_json1_1InitializeClusterRequest = function (input, context) {
1298
- return __assign(__assign(__assign({}, (input.ClusterId != null && { ClusterId: input.ClusterId })), (input.SignedCert != null && { SignedCert: input.SignedCert })), (input.TrustAnchor != null && { TrustAnchor: input.TrustAnchor }));
965
+ const serializeAws_json1_1InitializeClusterRequest = (input, context) => {
966
+ return {
967
+ ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
968
+ ...(input.SignedCert != null && { SignedCert: input.SignedCert }),
969
+ ...(input.TrustAnchor != null && { TrustAnchor: input.TrustAnchor }),
970
+ };
1299
971
  };
1300
- var serializeAws_json1_1ListTagsRequest = function (input, context) {
1301
- return __assign(__assign(__assign({}, (input.MaxResults != null && { MaxResults: input.MaxResults })), (input.NextToken != null && { NextToken: input.NextToken })), (input.ResourceId != null && { ResourceId: input.ResourceId }));
972
+ const serializeAws_json1_1ListTagsRequest = (input, context) => {
973
+ return {
974
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
975
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
976
+ ...(input.ResourceId != null && { ResourceId: input.ResourceId }),
977
+ };
1302
978
  };
1303
- var serializeAws_json1_1ModifyBackupAttributesRequest = function (input, context) {
1304
- return __assign(__assign({}, (input.BackupId != null && { BackupId: input.BackupId })), (input.NeverExpires != null && { NeverExpires: input.NeverExpires }));
979
+ const serializeAws_json1_1ModifyBackupAttributesRequest = (input, context) => {
980
+ return {
981
+ ...(input.BackupId != null && { BackupId: input.BackupId }),
982
+ ...(input.NeverExpires != null && { NeverExpires: input.NeverExpires }),
983
+ };
1305
984
  };
1306
- var serializeAws_json1_1ModifyClusterRequest = function (input, context) {
1307
- return __assign(__assign({}, (input.BackupRetentionPolicy != null && {
1308
- BackupRetentionPolicy: serializeAws_json1_1BackupRetentionPolicy(input.BackupRetentionPolicy, context),
1309
- })), (input.ClusterId != null && { ClusterId: input.ClusterId }));
985
+ const serializeAws_json1_1ModifyClusterRequest = (input, context) => {
986
+ return {
987
+ ...(input.BackupRetentionPolicy != null && {
988
+ BackupRetentionPolicy: serializeAws_json1_1BackupRetentionPolicy(input.BackupRetentionPolicy, context),
989
+ }),
990
+ ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
991
+ };
1310
992
  };
1311
- var serializeAws_json1_1RestoreBackupRequest = function (input, context) {
1312
- return __assign({}, (input.BackupId != null && { BackupId: input.BackupId }));
993
+ const serializeAws_json1_1RestoreBackupRequest = (input, context) => {
994
+ return {
995
+ ...(input.BackupId != null && { BackupId: input.BackupId }),
996
+ };
1313
997
  };
1314
- var serializeAws_json1_1Strings = function (input, context) {
998
+ const serializeAws_json1_1Strings = (input, context) => {
1315
999
  return input
1316
- .filter(function (e) { return e != null; })
1317
- .map(function (entry) {
1000
+ .filter((e) => e != null)
1001
+ .map((entry) => {
1318
1002
  return entry;
1319
1003
  });
1320
1004
  };
1321
- var serializeAws_json1_1SubnetIds = function (input, context) {
1005
+ const serializeAws_json1_1SubnetIds = (input, context) => {
1322
1006
  return input
1323
- .filter(function (e) { return e != null; })
1324
- .map(function (entry) {
1007
+ .filter((e) => e != null)
1008
+ .map((entry) => {
1325
1009
  return entry;
1326
1010
  });
1327
1011
  };
1328
- var serializeAws_json1_1Tag = function (input, context) {
1329
- return __assign(__assign({}, (input.Key != null && { Key: input.Key })), (input.Value != null && { Value: input.Value }));
1012
+ const serializeAws_json1_1Tag = (input, context) => {
1013
+ return {
1014
+ ...(input.Key != null && { Key: input.Key }),
1015
+ ...(input.Value != null && { Value: input.Value }),
1016
+ };
1330
1017
  };
1331
- var serializeAws_json1_1TagKeyList = function (input, context) {
1018
+ const serializeAws_json1_1TagKeyList = (input, context) => {
1332
1019
  return input
1333
- .filter(function (e) { return e != null; })
1334
- .map(function (entry) {
1020
+ .filter((e) => e != null)
1021
+ .map((entry) => {
1335
1022
  return entry;
1336
1023
  });
1337
1024
  };
1338
- var serializeAws_json1_1TagList = function (input, context) {
1025
+ const serializeAws_json1_1TagList = (input, context) => {
1339
1026
  return input
1340
- .filter(function (e) { return e != null; })
1341
- .map(function (entry) {
1027
+ .filter((e) => e != null)
1028
+ .map((entry) => {
1342
1029
  return serializeAws_json1_1Tag(entry, context);
1343
1030
  });
1344
1031
  };
1345
- var serializeAws_json1_1TagResourceRequest = function (input, context) {
1346
- return __assign(__assign({}, (input.ResourceId != null && { ResourceId: input.ResourceId })), (input.TagList != null && { TagList: serializeAws_json1_1TagList(input.TagList, context) }));
1032
+ const serializeAws_json1_1TagResourceRequest = (input, context) => {
1033
+ return {
1034
+ ...(input.ResourceId != null && { ResourceId: input.ResourceId }),
1035
+ ...(input.TagList != null && { TagList: serializeAws_json1_1TagList(input.TagList, context) }),
1036
+ };
1347
1037
  };
1348
- var serializeAws_json1_1UntagResourceRequest = function (input, context) {
1349
- return __assign(__assign({}, (input.ResourceId != null && { ResourceId: input.ResourceId })), (input.TagKeyList != null && { TagKeyList: serializeAws_json1_1TagKeyList(input.TagKeyList, context) }));
1038
+ const serializeAws_json1_1UntagResourceRequest = (input, context) => {
1039
+ return {
1040
+ ...(input.ResourceId != null && { ResourceId: input.ResourceId }),
1041
+ ...(input.TagKeyList != null && { TagKeyList: serializeAws_json1_1TagKeyList(input.TagKeyList, context) }),
1042
+ };
1350
1043
  };
1351
- var deserializeAws_json1_1Backup = function (output, context) {
1044
+ const deserializeAws_json1_1Backup = (output, context) => {
1352
1045
  return {
1353
1046
  BackupId: __expectString(output.BackupId),
1354
1047
  BackupState: __expectString(output.BackupState),
@@ -1369,16 +1062,16 @@ var deserializeAws_json1_1Backup = function (output, context) {
1369
1062
  TagList: output.TagList != null ? deserializeAws_json1_1TagList(output.TagList, context) : undefined,
1370
1063
  };
1371
1064
  };
1372
- var deserializeAws_json1_1BackupRetentionPolicy = function (output, context) {
1065
+ const deserializeAws_json1_1BackupRetentionPolicy = (output, context) => {
1373
1066
  return {
1374
1067
  Type: __expectString(output.Type),
1375
1068
  Value: __expectString(output.Value),
1376
1069
  };
1377
1070
  };
1378
- var deserializeAws_json1_1Backups = function (output, context) {
1379
- var retVal = (output || [])
1380
- .filter(function (e) { return e != null; })
1381
- .map(function (entry) {
1071
+ const deserializeAws_json1_1Backups = (output, context) => {
1072
+ const retVal = (output || [])
1073
+ .filter((e) => e != null)
1074
+ .map((entry) => {
1382
1075
  if (entry === null) {
1383
1076
  return null;
1384
1077
  }
@@ -1386,7 +1079,7 @@ var deserializeAws_json1_1Backups = function (output, context) {
1386
1079
  });
1387
1080
  return retVal;
1388
1081
  };
1389
- var deserializeAws_json1_1Certificates = function (output, context) {
1082
+ const deserializeAws_json1_1Certificates = (output, context) => {
1390
1083
  return {
1391
1084
  AwsHardwareCertificate: __expectString(output.AwsHardwareCertificate),
1392
1085
  ClusterCertificate: __expectString(output.ClusterCertificate),
@@ -1395,37 +1088,37 @@ var deserializeAws_json1_1Certificates = function (output, context) {
1395
1088
  ManufacturerHardwareCertificate: __expectString(output.ManufacturerHardwareCertificate),
1396
1089
  };
1397
1090
  };
1398
- var deserializeAws_json1_1CloudHsmAccessDeniedException = function (output, context) {
1091
+ const deserializeAws_json1_1CloudHsmAccessDeniedException = (output, context) => {
1399
1092
  return {
1400
1093
  Message: __expectString(output.Message),
1401
1094
  };
1402
1095
  };
1403
- var deserializeAws_json1_1CloudHsmInternalFailureException = function (output, context) {
1096
+ const deserializeAws_json1_1CloudHsmInternalFailureException = (output, context) => {
1404
1097
  return {
1405
1098
  Message: __expectString(output.Message),
1406
1099
  };
1407
1100
  };
1408
- var deserializeAws_json1_1CloudHsmInvalidRequestException = function (output, context) {
1101
+ const deserializeAws_json1_1CloudHsmInvalidRequestException = (output, context) => {
1409
1102
  return {
1410
1103
  Message: __expectString(output.Message),
1411
1104
  };
1412
1105
  };
1413
- var deserializeAws_json1_1CloudHsmResourceNotFoundException = function (output, context) {
1106
+ const deserializeAws_json1_1CloudHsmResourceNotFoundException = (output, context) => {
1414
1107
  return {
1415
1108
  Message: __expectString(output.Message),
1416
1109
  };
1417
1110
  };
1418
- var deserializeAws_json1_1CloudHsmServiceException = function (output, context) {
1111
+ const deserializeAws_json1_1CloudHsmServiceException = (output, context) => {
1419
1112
  return {
1420
1113
  Message: __expectString(output.Message),
1421
1114
  };
1422
1115
  };
1423
- var deserializeAws_json1_1CloudHsmTagException = function (output, context) {
1116
+ const deserializeAws_json1_1CloudHsmTagException = (output, context) => {
1424
1117
  return {
1425
1118
  Message: __expectString(output.Message),
1426
1119
  };
1427
1120
  };
1428
- var deserializeAws_json1_1Cluster = function (output, context) {
1121
+ const deserializeAws_json1_1Cluster = (output, context) => {
1429
1122
  return {
1430
1123
  BackupPolicy: __expectString(output.BackupPolicy),
1431
1124
  BackupRetentionPolicy: output.BackupRetentionPolicy != null
@@ -1450,10 +1143,10 @@ var deserializeAws_json1_1Cluster = function (output, context) {
1450
1143
  VpcId: __expectString(output.VpcId),
1451
1144
  };
1452
1145
  };
1453
- var deserializeAws_json1_1Clusters = function (output, context) {
1454
- var retVal = (output || [])
1455
- .filter(function (e) { return e != null; })
1456
- .map(function (entry) {
1146
+ const deserializeAws_json1_1Clusters = (output, context) => {
1147
+ const retVal = (output || [])
1148
+ .filter((e) => e != null)
1149
+ .map((entry) => {
1457
1150
  if (entry === null) {
1458
1151
  return null;
1459
1152
  }
@@ -1461,51 +1154,51 @@ var deserializeAws_json1_1Clusters = function (output, context) {
1461
1154
  });
1462
1155
  return retVal;
1463
1156
  };
1464
- var deserializeAws_json1_1CopyBackupToRegionResponse = function (output, context) {
1157
+ const deserializeAws_json1_1CopyBackupToRegionResponse = (output, context) => {
1465
1158
  return {
1466
1159
  DestinationBackup: output.DestinationBackup != null
1467
1160
  ? deserializeAws_json1_1DestinationBackup(output.DestinationBackup, context)
1468
1161
  : undefined,
1469
1162
  };
1470
1163
  };
1471
- var deserializeAws_json1_1CreateClusterResponse = function (output, context) {
1164
+ const deserializeAws_json1_1CreateClusterResponse = (output, context) => {
1472
1165
  return {
1473
1166
  Cluster: output.Cluster != null ? deserializeAws_json1_1Cluster(output.Cluster, context) : undefined,
1474
1167
  };
1475
1168
  };
1476
- var deserializeAws_json1_1CreateHsmResponse = function (output, context) {
1169
+ const deserializeAws_json1_1CreateHsmResponse = (output, context) => {
1477
1170
  return {
1478
1171
  Hsm: output.Hsm != null ? deserializeAws_json1_1Hsm(output.Hsm, context) : undefined,
1479
1172
  };
1480
1173
  };
1481
- var deserializeAws_json1_1DeleteBackupResponse = function (output, context) {
1174
+ const deserializeAws_json1_1DeleteBackupResponse = (output, context) => {
1482
1175
  return {
1483
1176
  Backup: output.Backup != null ? deserializeAws_json1_1Backup(output.Backup, context) : undefined,
1484
1177
  };
1485
1178
  };
1486
- var deserializeAws_json1_1DeleteClusterResponse = function (output, context) {
1179
+ const deserializeAws_json1_1DeleteClusterResponse = (output, context) => {
1487
1180
  return {
1488
1181
  Cluster: output.Cluster != null ? deserializeAws_json1_1Cluster(output.Cluster, context) : undefined,
1489
1182
  };
1490
1183
  };
1491
- var deserializeAws_json1_1DeleteHsmResponse = function (output, context) {
1184
+ const deserializeAws_json1_1DeleteHsmResponse = (output, context) => {
1492
1185
  return {
1493
1186
  HsmId: __expectString(output.HsmId),
1494
1187
  };
1495
1188
  };
1496
- var deserializeAws_json1_1DescribeBackupsResponse = function (output, context) {
1189
+ const deserializeAws_json1_1DescribeBackupsResponse = (output, context) => {
1497
1190
  return {
1498
1191
  Backups: output.Backups != null ? deserializeAws_json1_1Backups(output.Backups, context) : undefined,
1499
1192
  NextToken: __expectString(output.NextToken),
1500
1193
  };
1501
1194
  };
1502
- var deserializeAws_json1_1DescribeClustersResponse = function (output, context) {
1195
+ const deserializeAws_json1_1DescribeClustersResponse = (output, context) => {
1503
1196
  return {
1504
1197
  Clusters: output.Clusters != null ? deserializeAws_json1_1Clusters(output.Clusters, context) : undefined,
1505
1198
  NextToken: __expectString(output.NextToken),
1506
1199
  };
1507
1200
  };
1508
- var deserializeAws_json1_1DestinationBackup = function (output, context) {
1201
+ const deserializeAws_json1_1DestinationBackup = (output, context) => {
1509
1202
  return {
1510
1203
  CreateTimestamp: output.CreateTimestamp != null
1511
1204
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreateTimestamp)))
@@ -1515,17 +1208,18 @@ var deserializeAws_json1_1DestinationBackup = function (output, context) {
1515
1208
  SourceRegion: __expectString(output.SourceRegion),
1516
1209
  };
1517
1210
  };
1518
- var deserializeAws_json1_1ExternalSubnetMapping = function (output, context) {
1519
- return Object.entries(output).reduce(function (acc, _a) {
1520
- var _b;
1521
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1211
+ const deserializeAws_json1_1ExternalSubnetMapping = (output, context) => {
1212
+ return Object.entries(output).reduce((acc, [key, value]) => {
1522
1213
  if (value === null) {
1523
1214
  return acc;
1524
1215
  }
1525
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1216
+ return {
1217
+ ...acc,
1218
+ [key]: __expectString(value),
1219
+ };
1526
1220
  }, {});
1527
1221
  };
1528
- var deserializeAws_json1_1Hsm = function (output, context) {
1222
+ const deserializeAws_json1_1Hsm = (output, context) => {
1529
1223
  return {
1530
1224
  AvailabilityZone: __expectString(output.AvailabilityZone),
1531
1225
  ClusterId: __expectString(output.ClusterId),
@@ -1537,10 +1231,10 @@ var deserializeAws_json1_1Hsm = function (output, context) {
1537
1231
  SubnetId: __expectString(output.SubnetId),
1538
1232
  };
1539
1233
  };
1540
- var deserializeAws_json1_1Hsms = function (output, context) {
1541
- var retVal = (output || [])
1542
- .filter(function (e) { return e != null; })
1543
- .map(function (entry) {
1234
+ const deserializeAws_json1_1Hsms = (output, context) => {
1235
+ const retVal = (output || [])
1236
+ .filter((e) => e != null)
1237
+ .map((entry) => {
1544
1238
  if (entry === null) {
1545
1239
  return null;
1546
1240
  }
@@ -1548,43 +1242,43 @@ var deserializeAws_json1_1Hsms = function (output, context) {
1548
1242
  });
1549
1243
  return retVal;
1550
1244
  };
1551
- var deserializeAws_json1_1InitializeClusterResponse = function (output, context) {
1245
+ const deserializeAws_json1_1InitializeClusterResponse = (output, context) => {
1552
1246
  return {
1553
1247
  State: __expectString(output.State),
1554
1248
  StateMessage: __expectString(output.StateMessage),
1555
1249
  };
1556
1250
  };
1557
- var deserializeAws_json1_1ListTagsResponse = function (output, context) {
1251
+ const deserializeAws_json1_1ListTagsResponse = (output, context) => {
1558
1252
  return {
1559
1253
  NextToken: __expectString(output.NextToken),
1560
1254
  TagList: output.TagList != null ? deserializeAws_json1_1TagList(output.TagList, context) : undefined,
1561
1255
  };
1562
1256
  };
1563
- var deserializeAws_json1_1ModifyBackupAttributesResponse = function (output, context) {
1257
+ const deserializeAws_json1_1ModifyBackupAttributesResponse = (output, context) => {
1564
1258
  return {
1565
1259
  Backup: output.Backup != null ? deserializeAws_json1_1Backup(output.Backup, context) : undefined,
1566
1260
  };
1567
1261
  };
1568
- var deserializeAws_json1_1ModifyClusterResponse = function (output, context) {
1262
+ const deserializeAws_json1_1ModifyClusterResponse = (output, context) => {
1569
1263
  return {
1570
1264
  Cluster: output.Cluster != null ? deserializeAws_json1_1Cluster(output.Cluster, context) : undefined,
1571
1265
  };
1572
1266
  };
1573
- var deserializeAws_json1_1RestoreBackupResponse = function (output, context) {
1267
+ const deserializeAws_json1_1RestoreBackupResponse = (output, context) => {
1574
1268
  return {
1575
1269
  Backup: output.Backup != null ? deserializeAws_json1_1Backup(output.Backup, context) : undefined,
1576
1270
  };
1577
1271
  };
1578
- var deserializeAws_json1_1Tag = function (output, context) {
1272
+ const deserializeAws_json1_1Tag = (output, context) => {
1579
1273
  return {
1580
1274
  Key: __expectString(output.Key),
1581
1275
  Value: __expectString(output.Value),
1582
1276
  };
1583
1277
  };
1584
- var deserializeAws_json1_1TagList = function (output, context) {
1585
- var retVal = (output || [])
1586
- .filter(function (e) { return e != null; })
1587
- .map(function (entry) {
1278
+ const deserializeAws_json1_1TagList = (output, context) => {
1279
+ const retVal = (output || [])
1280
+ .filter((e) => e != null)
1281
+ .map((entry) => {
1588
1282
  if (entry === null) {
1589
1283
  return null;
1590
1284
  }
@@ -1592,81 +1286,58 @@ var deserializeAws_json1_1TagList = function (output, context) {
1592
1286
  });
1593
1287
  return retVal;
1594
1288
  };
1595
- var deserializeAws_json1_1TagResourceResponse = function (output, context) {
1289
+ const deserializeAws_json1_1TagResourceResponse = (output, context) => {
1596
1290
  return {};
1597
1291
  };
1598
- var deserializeAws_json1_1UntagResourceResponse = function (output, context) {
1292
+ const deserializeAws_json1_1UntagResourceResponse = (output, context) => {
1599
1293
  return {};
1600
1294
  };
1601
- var deserializeMetadata = function (output) {
1602
- var _a, _b;
1603
- return ({
1604
- httpStatusCode: output.statusCode,
1605
- requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
1606
- extendedRequestId: output.headers["x-amz-id-2"],
1607
- cfId: output.headers["x-amz-cf-id"],
1608
- });
1609
- };
1610
- var collectBody = function (streamBody, context) {
1611
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
1295
+ const deserializeMetadata = (output) => ({
1296
+ httpStatusCode: output.statusCode,
1297
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
1298
+ extendedRequestId: output.headers["x-amz-id-2"],
1299
+ cfId: output.headers["x-amz-cf-id"],
1300
+ });
1301
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1612
1302
  if (streamBody instanceof Uint8Array) {
1613
1303
  return Promise.resolve(streamBody);
1614
1304
  }
1615
1305
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1616
1306
  };
1617
- var collectBodyString = function (streamBody, context) {
1618
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1619
- };
1620
- var buildHttpRpcRequest = function (context, headers, path, resolvedHostname, body) { return __awaiter(void 0, void 0, void 0, function () {
1621
- var _a, hostname, _b, protocol, port, basePath, contents;
1622
- return __generator(this, function (_c) {
1623
- switch (_c.label) {
1624
- case 0: return [4, context.endpoint()];
1625
- case 1:
1626
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
1627
- contents = {
1628
- protocol: protocol,
1629
- hostname: hostname,
1630
- port: port,
1631
- method: "POST",
1632
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
1633
- headers: headers,
1634
- };
1635
- if (resolvedHostname !== undefined) {
1636
- contents.hostname = resolvedHostname;
1637
- }
1638
- if (body !== undefined) {
1639
- contents.body = body;
1640
- }
1641
- return [2, new __HttpRequest(contents)];
1642
- }
1643
- });
1644
- }); };
1645
- var parseBody = function (streamBody, context) {
1646
- return collectBodyString(streamBody, context).then(function (encoded) {
1647
- if (encoded.length) {
1648
- return JSON.parse(encoded);
1649
- }
1650
- return {};
1651
- });
1307
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1308
+ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
1309
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1310
+ const contents = {
1311
+ protocol,
1312
+ hostname,
1313
+ port,
1314
+ method: "POST",
1315
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
1316
+ headers,
1317
+ };
1318
+ if (resolvedHostname !== undefined) {
1319
+ contents.hostname = resolvedHostname;
1320
+ }
1321
+ if (body !== undefined) {
1322
+ contents.body = body;
1323
+ }
1324
+ return new __HttpRequest(contents);
1652
1325
  };
1653
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
1654
- var value;
1655
- var _a;
1656
- return __generator(this, function (_b) {
1657
- switch (_b.label) {
1658
- case 0: return [4, parseBody(errorBody, context)];
1659
- case 1:
1660
- value = _b.sent();
1661
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
1662
- return [2, value];
1663
- }
1664
- });
1665
- }); };
1666
- var loadRestJsonErrorCode = function (output, data) {
1667
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
1668
- var sanitizeErrorCode = function (rawValue) {
1669
- var cleanValue = rawValue;
1326
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1327
+ if (encoded.length) {
1328
+ return JSON.parse(encoded);
1329
+ }
1330
+ return {};
1331
+ });
1332
+ const parseErrorBody = async (errorBody, context) => {
1333
+ const value = await parseBody(errorBody, context);
1334
+ value.message = value.message ?? value.Message;
1335
+ return value;
1336
+ };
1337
+ const loadRestJsonErrorCode = (output, data) => {
1338
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1339
+ const sanitizeErrorCode = (rawValue) => {
1340
+ let cleanValue = rawValue;
1670
1341
  if (typeof cleanValue === "number") {
1671
1342
  cleanValue = cleanValue.toString();
1672
1343
  }
@@ -1681,7 +1352,7 @@ var loadRestJsonErrorCode = function (output, data) {
1681
1352
  }
1682
1353
  return cleanValue;
1683
1354
  };
1684
- var headerKey = findKey(output.headers, "x-amzn-errortype");
1355
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1685
1356
  if (headerKey !== undefined) {
1686
1357
  return sanitizeErrorCode(output.headers[headerKey]);
1687
1358
  }