@aws-sdk/client-cloudhsm-v2 3.183.0 → 3.186.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 (31) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist-cjs/protocols/Aws_json1_1.js +2 -2
  3. package/dist-es/CloudHSMV2.js +69 -62
  4. package/dist-es/CloudHSMV2Client.js +28 -22
  5. package/dist-es/commands/CopyBackupToRegionCommand.js +28 -21
  6. package/dist-es/commands/CreateClusterCommand.js +28 -21
  7. package/dist-es/commands/CreateHsmCommand.js +28 -21
  8. package/dist-es/commands/DeleteBackupCommand.js +28 -21
  9. package/dist-es/commands/DeleteClusterCommand.js +28 -21
  10. package/dist-es/commands/DeleteHsmCommand.js +28 -21
  11. package/dist-es/commands/DescribeBackupsCommand.js +28 -21
  12. package/dist-es/commands/DescribeClustersCommand.js +28 -21
  13. package/dist-es/commands/InitializeClusterCommand.js +28 -21
  14. package/dist-es/commands/ListTagsCommand.js +28 -21
  15. package/dist-es/commands/ModifyBackupAttributesCommand.js +28 -21
  16. package/dist-es/commands/ModifyClusterCommand.js +28 -21
  17. package/dist-es/commands/RestoreBackupCommand.js +28 -21
  18. package/dist-es/commands/TagResourceCommand.js +28 -21
  19. package/dist-es/commands/UntagResourceCommand.js +28 -21
  20. package/dist-es/endpoints.js +8 -8
  21. package/dist-es/models/CloudHSMV2ServiceException.js +10 -5
  22. package/dist-es/models/models_0.js +110 -183
  23. package/dist-es/pagination/DescribeBackupsPaginator.js +68 -25
  24. package/dist-es/pagination/DescribeClustersPaginator.js +68 -25
  25. package/dist-es/pagination/ListTagsPaginator.js +68 -25
  26. package/dist-es/protocols/Aws_json1_1.js +1415 -1086
  27. package/dist-es/runtimeConfig.browser.js +12 -26
  28. package/dist-es/runtimeConfig.js +12 -30
  29. package/dist-es/runtimeConfig.native.js +5 -8
  30. package/dist-es/runtimeConfig.shared.js +11 -8
  31. package/package.json +33 -33
@@ -1,1047 +1,1354 @@
1
+ import { __assign, __awaiter, __generator, __read } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  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";
3
4
  import { CloudHSMV2ServiceException as __BaseException } from "../models/CloudHSMV2ServiceException";
4
5
  import { CloudHsmAccessDeniedException, CloudHsmInternalFailureException, CloudHsmInvalidRequestException, CloudHsmResourceNotFoundException, CloudHsmServiceException, CloudHsmTagException, } from "../models/models_0";
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,
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)];
842
15
  });
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,
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)];
851
26
  });
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,
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)];
860
37
  });
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,
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)];
869
48
  });
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,
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)];
878
59
  });
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,
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)];
887
70
  });
888
- return __decorateServiceException(exception, body);
889
- };
890
- const serializeAws_json1_1BackupRetentionPolicy = (input, context) => {
891
- return {
892
- ...(input.Type != null && { Type: input.Type }),
893
- ...(input.Value != null && { Value: input.Value }),
894
- };
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)];
1211
+ });
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)];
1220
+ });
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)];
1229
+ });
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)];
1238
+ });
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)];
1247
+ });
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)];
1256
+ });
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 }));
895
1260
  };
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
- };
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) }));
902
1263
  };
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
- };
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) }));
913
1268
  };
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
- };
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 }));
920
1271
  };
921
- const serializeAws_json1_1DeleteBackupRequest = (input, context) => {
922
- return {
923
- ...(input.BackupId != null && { BackupId: input.BackupId }),
924
- };
1272
+ var serializeAws_json1_1DeleteBackupRequest = function (input, context) {
1273
+ return __assign({}, (input.BackupId != null && { BackupId: input.BackupId }));
925
1274
  };
926
- const serializeAws_json1_1DeleteClusterRequest = (input, context) => {
927
- return {
928
- ...(input.ClusterId != null && { ClusterId: input.ClusterId }),
929
- };
1275
+ var serializeAws_json1_1DeleteClusterRequest = function (input, context) {
1276
+ return __assign({}, (input.ClusterId != null && { ClusterId: input.ClusterId }));
930
1277
  };
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
- };
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 }));
938
1280
  };
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
- };
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 }));
946
1283
  };
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
- };
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 }));
953
1286
  };
954
- const serializeAws_json1_1Filters = (input, context) => {
955
- return Object.entries(input).reduce((acc, [key, value]) => {
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];
956
1291
  if (value === null) {
957
1292
  return acc;
958
1293
  }
959
- return {
960
- ...acc,
961
- [key]: serializeAws_json1_1Strings(value, context),
962
- };
1294
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_json1_1Strings(value, context), _b));
963
1295
  }, {});
964
1296
  };
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
- };
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 }));
971
1299
  };
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
- };
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 }));
978
1302
  };
979
- const serializeAws_json1_1ModifyBackupAttributesRequest = (input, context) => {
980
- return {
981
- ...(input.BackupId != null && { BackupId: input.BackupId }),
982
- ...(input.NeverExpires != null && { NeverExpires: input.NeverExpires }),
983
- };
1303
+ var serializeAws_json1_1ModifyBackupAttributesRequest = function (input, context) {
1304
+ return __assign(__assign({}, (input.BackupId != null && { BackupId: input.BackupId })), (input.NeverExpires != null && { NeverExpires: input.NeverExpires }));
984
1305
  };
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
- };
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 }));
992
1310
  };
993
- const serializeAws_json1_1RestoreBackupRequest = (input, context) => {
994
- return {
995
- ...(input.BackupId != null && { BackupId: input.BackupId }),
996
- };
1311
+ var serializeAws_json1_1RestoreBackupRequest = function (input, context) {
1312
+ return __assign({}, (input.BackupId != null && { BackupId: input.BackupId }));
997
1313
  };
998
- const serializeAws_json1_1Strings = (input, context) => {
1314
+ var serializeAws_json1_1Strings = function (input, context) {
999
1315
  return input
1000
- .filter((e) => e != null)
1001
- .map((entry) => {
1316
+ .filter(function (e) { return e != null; })
1317
+ .map(function (entry) {
1002
1318
  return entry;
1003
1319
  });
1004
1320
  };
1005
- const serializeAws_json1_1SubnetIds = (input, context) => {
1321
+ var serializeAws_json1_1SubnetIds = function (input, context) {
1006
1322
  return input
1007
- .filter((e) => e != null)
1008
- .map((entry) => {
1323
+ .filter(function (e) { return e != null; })
1324
+ .map(function (entry) {
1009
1325
  return entry;
1010
1326
  });
1011
1327
  };
1012
- const serializeAws_json1_1Tag = (input, context) => {
1013
- return {
1014
- ...(input.Key != null && { Key: input.Key }),
1015
- ...(input.Value != null && { Value: input.Value }),
1016
- };
1328
+ var serializeAws_json1_1Tag = function (input, context) {
1329
+ return __assign(__assign({}, (input.Key != null && { Key: input.Key })), (input.Value != null && { Value: input.Value }));
1017
1330
  };
1018
- const serializeAws_json1_1TagKeyList = (input, context) => {
1331
+ var serializeAws_json1_1TagKeyList = function (input, context) {
1019
1332
  return input
1020
- .filter((e) => e != null)
1021
- .map((entry) => {
1333
+ .filter(function (e) { return e != null; })
1334
+ .map(function (entry) {
1022
1335
  return entry;
1023
1336
  });
1024
1337
  };
1025
- const serializeAws_json1_1TagList = (input, context) => {
1338
+ var serializeAws_json1_1TagList = function (input, context) {
1026
1339
  return input
1027
- .filter((e) => e != null)
1028
- .map((entry) => {
1340
+ .filter(function (e) { return e != null; })
1341
+ .map(function (entry) {
1029
1342
  return serializeAws_json1_1Tag(entry, context);
1030
1343
  });
1031
1344
  };
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
- };
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) }));
1037
1347
  };
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
- };
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) }));
1043
1350
  };
1044
- const deserializeAws_json1_1Backup = (output, context) => {
1351
+ var deserializeAws_json1_1Backup = function (output, context) {
1045
1352
  return {
1046
1353
  BackupId: __expectString(output.BackupId),
1047
1354
  BackupState: __expectString(output.BackupState),
@@ -1062,16 +1369,16 @@ const deserializeAws_json1_1Backup = (output, context) => {
1062
1369
  TagList: output.TagList != null ? deserializeAws_json1_1TagList(output.TagList, context) : undefined,
1063
1370
  };
1064
1371
  };
1065
- const deserializeAws_json1_1BackupRetentionPolicy = (output, context) => {
1372
+ var deserializeAws_json1_1BackupRetentionPolicy = function (output, context) {
1066
1373
  return {
1067
1374
  Type: __expectString(output.Type),
1068
1375
  Value: __expectString(output.Value),
1069
1376
  };
1070
1377
  };
1071
- const deserializeAws_json1_1Backups = (output, context) => {
1072
- const retVal = (output || [])
1073
- .filter((e) => e != null)
1074
- .map((entry) => {
1378
+ var deserializeAws_json1_1Backups = function (output, context) {
1379
+ var retVal = (output || [])
1380
+ .filter(function (e) { return e != null; })
1381
+ .map(function (entry) {
1075
1382
  if (entry === null) {
1076
1383
  return null;
1077
1384
  }
@@ -1079,7 +1386,7 @@ const deserializeAws_json1_1Backups = (output, context) => {
1079
1386
  });
1080
1387
  return retVal;
1081
1388
  };
1082
- const deserializeAws_json1_1Certificates = (output, context) => {
1389
+ var deserializeAws_json1_1Certificates = function (output, context) {
1083
1390
  return {
1084
1391
  AwsHardwareCertificate: __expectString(output.AwsHardwareCertificate),
1085
1392
  ClusterCertificate: __expectString(output.ClusterCertificate),
@@ -1088,37 +1395,37 @@ const deserializeAws_json1_1Certificates = (output, context) => {
1088
1395
  ManufacturerHardwareCertificate: __expectString(output.ManufacturerHardwareCertificate),
1089
1396
  };
1090
1397
  };
1091
- const deserializeAws_json1_1CloudHsmAccessDeniedException = (output, context) => {
1398
+ var deserializeAws_json1_1CloudHsmAccessDeniedException = function (output, context) {
1092
1399
  return {
1093
1400
  Message: __expectString(output.Message),
1094
1401
  };
1095
1402
  };
1096
- const deserializeAws_json1_1CloudHsmInternalFailureException = (output, context) => {
1403
+ var deserializeAws_json1_1CloudHsmInternalFailureException = function (output, context) {
1097
1404
  return {
1098
1405
  Message: __expectString(output.Message),
1099
1406
  };
1100
1407
  };
1101
- const deserializeAws_json1_1CloudHsmInvalidRequestException = (output, context) => {
1408
+ var deserializeAws_json1_1CloudHsmInvalidRequestException = function (output, context) {
1102
1409
  return {
1103
1410
  Message: __expectString(output.Message),
1104
1411
  };
1105
1412
  };
1106
- const deserializeAws_json1_1CloudHsmResourceNotFoundException = (output, context) => {
1413
+ var deserializeAws_json1_1CloudHsmResourceNotFoundException = function (output, context) {
1107
1414
  return {
1108
1415
  Message: __expectString(output.Message),
1109
1416
  };
1110
1417
  };
1111
- const deserializeAws_json1_1CloudHsmServiceException = (output, context) => {
1418
+ var deserializeAws_json1_1CloudHsmServiceException = function (output, context) {
1112
1419
  return {
1113
1420
  Message: __expectString(output.Message),
1114
1421
  };
1115
1422
  };
1116
- const deserializeAws_json1_1CloudHsmTagException = (output, context) => {
1423
+ var deserializeAws_json1_1CloudHsmTagException = function (output, context) {
1117
1424
  return {
1118
1425
  Message: __expectString(output.Message),
1119
1426
  };
1120
1427
  };
1121
- const deserializeAws_json1_1Cluster = (output, context) => {
1428
+ var deserializeAws_json1_1Cluster = function (output, context) {
1122
1429
  return {
1123
1430
  BackupPolicy: __expectString(output.BackupPolicy),
1124
1431
  BackupRetentionPolicy: output.BackupRetentionPolicy != null
@@ -1143,10 +1450,10 @@ const deserializeAws_json1_1Cluster = (output, context) => {
1143
1450
  VpcId: __expectString(output.VpcId),
1144
1451
  };
1145
1452
  };
1146
- const deserializeAws_json1_1Clusters = (output, context) => {
1147
- const retVal = (output || [])
1148
- .filter((e) => e != null)
1149
- .map((entry) => {
1453
+ var deserializeAws_json1_1Clusters = function (output, context) {
1454
+ var retVal = (output || [])
1455
+ .filter(function (e) { return e != null; })
1456
+ .map(function (entry) {
1150
1457
  if (entry === null) {
1151
1458
  return null;
1152
1459
  }
@@ -1154,51 +1461,51 @@ const deserializeAws_json1_1Clusters = (output, context) => {
1154
1461
  });
1155
1462
  return retVal;
1156
1463
  };
1157
- const deserializeAws_json1_1CopyBackupToRegionResponse = (output, context) => {
1464
+ var deserializeAws_json1_1CopyBackupToRegionResponse = function (output, context) {
1158
1465
  return {
1159
1466
  DestinationBackup: output.DestinationBackup != null
1160
1467
  ? deserializeAws_json1_1DestinationBackup(output.DestinationBackup, context)
1161
1468
  : undefined,
1162
1469
  };
1163
1470
  };
1164
- const deserializeAws_json1_1CreateClusterResponse = (output, context) => {
1471
+ var deserializeAws_json1_1CreateClusterResponse = function (output, context) {
1165
1472
  return {
1166
1473
  Cluster: output.Cluster != null ? deserializeAws_json1_1Cluster(output.Cluster, context) : undefined,
1167
1474
  };
1168
1475
  };
1169
- const deserializeAws_json1_1CreateHsmResponse = (output, context) => {
1476
+ var deserializeAws_json1_1CreateHsmResponse = function (output, context) {
1170
1477
  return {
1171
1478
  Hsm: output.Hsm != null ? deserializeAws_json1_1Hsm(output.Hsm, context) : undefined,
1172
1479
  };
1173
1480
  };
1174
- const deserializeAws_json1_1DeleteBackupResponse = (output, context) => {
1481
+ var deserializeAws_json1_1DeleteBackupResponse = function (output, context) {
1175
1482
  return {
1176
1483
  Backup: output.Backup != null ? deserializeAws_json1_1Backup(output.Backup, context) : undefined,
1177
1484
  };
1178
1485
  };
1179
- const deserializeAws_json1_1DeleteClusterResponse = (output, context) => {
1486
+ var deserializeAws_json1_1DeleteClusterResponse = function (output, context) {
1180
1487
  return {
1181
1488
  Cluster: output.Cluster != null ? deserializeAws_json1_1Cluster(output.Cluster, context) : undefined,
1182
1489
  };
1183
1490
  };
1184
- const deserializeAws_json1_1DeleteHsmResponse = (output, context) => {
1491
+ var deserializeAws_json1_1DeleteHsmResponse = function (output, context) {
1185
1492
  return {
1186
1493
  HsmId: __expectString(output.HsmId),
1187
1494
  };
1188
1495
  };
1189
- const deserializeAws_json1_1DescribeBackupsResponse = (output, context) => {
1496
+ var deserializeAws_json1_1DescribeBackupsResponse = function (output, context) {
1190
1497
  return {
1191
1498
  Backups: output.Backups != null ? deserializeAws_json1_1Backups(output.Backups, context) : undefined,
1192
1499
  NextToken: __expectString(output.NextToken),
1193
1500
  };
1194
1501
  };
1195
- const deserializeAws_json1_1DescribeClustersResponse = (output, context) => {
1502
+ var deserializeAws_json1_1DescribeClustersResponse = function (output, context) {
1196
1503
  return {
1197
1504
  Clusters: output.Clusters != null ? deserializeAws_json1_1Clusters(output.Clusters, context) : undefined,
1198
1505
  NextToken: __expectString(output.NextToken),
1199
1506
  };
1200
1507
  };
1201
- const deserializeAws_json1_1DestinationBackup = (output, context) => {
1508
+ var deserializeAws_json1_1DestinationBackup = function (output, context) {
1202
1509
  return {
1203
1510
  CreateTimestamp: output.CreateTimestamp != null
1204
1511
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreateTimestamp)))
@@ -1208,18 +1515,17 @@ const deserializeAws_json1_1DestinationBackup = (output, context) => {
1208
1515
  SourceRegion: __expectString(output.SourceRegion),
1209
1516
  };
1210
1517
  };
1211
- const deserializeAws_json1_1ExternalSubnetMapping = (output, context) => {
1212
- return Object.entries(output).reduce((acc, [key, value]) => {
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];
1213
1522
  if (value === null) {
1214
1523
  return acc;
1215
1524
  }
1216
- return {
1217
- ...acc,
1218
- [key]: __expectString(value),
1219
- };
1525
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1220
1526
  }, {});
1221
1527
  };
1222
- const deserializeAws_json1_1Hsm = (output, context) => {
1528
+ var deserializeAws_json1_1Hsm = function (output, context) {
1223
1529
  return {
1224
1530
  AvailabilityZone: __expectString(output.AvailabilityZone),
1225
1531
  ClusterId: __expectString(output.ClusterId),
@@ -1231,10 +1537,10 @@ const deserializeAws_json1_1Hsm = (output, context) => {
1231
1537
  SubnetId: __expectString(output.SubnetId),
1232
1538
  };
1233
1539
  };
1234
- const deserializeAws_json1_1Hsms = (output, context) => {
1235
- const retVal = (output || [])
1236
- .filter((e) => e != null)
1237
- .map((entry) => {
1540
+ var deserializeAws_json1_1Hsms = function (output, context) {
1541
+ var retVal = (output || [])
1542
+ .filter(function (e) { return e != null; })
1543
+ .map(function (entry) {
1238
1544
  if (entry === null) {
1239
1545
  return null;
1240
1546
  }
@@ -1242,43 +1548,43 @@ const deserializeAws_json1_1Hsms = (output, context) => {
1242
1548
  });
1243
1549
  return retVal;
1244
1550
  };
1245
- const deserializeAws_json1_1InitializeClusterResponse = (output, context) => {
1551
+ var deserializeAws_json1_1InitializeClusterResponse = function (output, context) {
1246
1552
  return {
1247
1553
  State: __expectString(output.State),
1248
1554
  StateMessage: __expectString(output.StateMessage),
1249
1555
  };
1250
1556
  };
1251
- const deserializeAws_json1_1ListTagsResponse = (output, context) => {
1557
+ var deserializeAws_json1_1ListTagsResponse = function (output, context) {
1252
1558
  return {
1253
1559
  NextToken: __expectString(output.NextToken),
1254
1560
  TagList: output.TagList != null ? deserializeAws_json1_1TagList(output.TagList, context) : undefined,
1255
1561
  };
1256
1562
  };
1257
- const deserializeAws_json1_1ModifyBackupAttributesResponse = (output, context) => {
1563
+ var deserializeAws_json1_1ModifyBackupAttributesResponse = function (output, context) {
1258
1564
  return {
1259
1565
  Backup: output.Backup != null ? deserializeAws_json1_1Backup(output.Backup, context) : undefined,
1260
1566
  };
1261
1567
  };
1262
- const deserializeAws_json1_1ModifyClusterResponse = (output, context) => {
1568
+ var deserializeAws_json1_1ModifyClusterResponse = function (output, context) {
1263
1569
  return {
1264
1570
  Cluster: output.Cluster != null ? deserializeAws_json1_1Cluster(output.Cluster, context) : undefined,
1265
1571
  };
1266
1572
  };
1267
- const deserializeAws_json1_1RestoreBackupResponse = (output, context) => {
1573
+ var deserializeAws_json1_1RestoreBackupResponse = function (output, context) {
1268
1574
  return {
1269
1575
  Backup: output.Backup != null ? deserializeAws_json1_1Backup(output.Backup, context) : undefined,
1270
1576
  };
1271
1577
  };
1272
- const deserializeAws_json1_1Tag = (output, context) => {
1578
+ var deserializeAws_json1_1Tag = function (output, context) {
1273
1579
  return {
1274
1580
  Key: __expectString(output.Key),
1275
1581
  Value: __expectString(output.Value),
1276
1582
  };
1277
1583
  };
1278
- const deserializeAws_json1_1TagList = (output, context) => {
1279
- const retVal = (output || [])
1280
- .filter((e) => e != null)
1281
- .map((entry) => {
1584
+ var deserializeAws_json1_1TagList = function (output, context) {
1585
+ var retVal = (output || [])
1586
+ .filter(function (e) { return e != null; })
1587
+ .map(function (entry) {
1282
1588
  if (entry === null) {
1283
1589
  return null;
1284
1590
  }
@@ -1286,58 +1592,81 @@ const deserializeAws_json1_1TagList = (output, context) => {
1286
1592
  });
1287
1593
  return retVal;
1288
1594
  };
1289
- const deserializeAws_json1_1TagResourceResponse = (output, context) => {
1595
+ var deserializeAws_json1_1TagResourceResponse = function (output, context) {
1290
1596
  return {};
1291
1597
  };
1292
- const deserializeAws_json1_1UntagResourceResponse = (output, context) => {
1598
+ var deserializeAws_json1_1UntagResourceResponse = function (output, context) {
1293
1599
  return {};
1294
1600
  };
1295
- const deserializeMetadata = (output) => ({
1296
- httpStatusCode: output.statusCode,
1297
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-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) => {
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(); }
1302
1612
  if (streamBody instanceof Uint8Array) {
1303
1613
  return Promise.resolve(streamBody);
1304
1614
  }
1305
1615
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1306
1616
  };
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);
1325
- };
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;
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
+ });
1336
1652
  };
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;
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;
1341
1670
  if (typeof cleanValue === "number") {
1342
1671
  cleanValue = cleanValue.toString();
1343
1672
  }
@@ -1352,7 +1681,7 @@ const loadRestJsonErrorCode = (output, data) => {
1352
1681
  }
1353
1682
  return cleanValue;
1354
1683
  };
1355
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1684
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
1356
1685
  if (headerKey !== undefined) {
1357
1686
  return sanitizeErrorCode(output.headers[headerKey]);
1358
1687
  }