@aws-sdk/client-acm-pca 3.51.0 → 3.54.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.
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeAws_json1_1UpdateCertificateAuthorityCommand = exports.deserializeAws_json1_1UntagCertificateAuthorityCommand = exports.deserializeAws_json1_1TagCertificateAuthorityCommand = exports.deserializeAws_json1_1RevokeCertificateCommand = exports.deserializeAws_json1_1RestoreCertificateAuthorityCommand = exports.deserializeAws_json1_1PutPolicyCommand = exports.deserializeAws_json1_1ListTagsCommand = exports.deserializeAws_json1_1ListPermissionsCommand = exports.deserializeAws_json1_1ListCertificateAuthoritiesCommand = exports.deserializeAws_json1_1IssueCertificateCommand = exports.deserializeAws_json1_1ImportCertificateAuthorityCertificateCommand = exports.deserializeAws_json1_1GetPolicyCommand = exports.deserializeAws_json1_1GetCertificateAuthorityCsrCommand = exports.deserializeAws_json1_1GetCertificateAuthorityCertificateCommand = exports.deserializeAws_json1_1GetCertificateCommand = exports.deserializeAws_json1_1DescribeCertificateAuthorityAuditReportCommand = exports.deserializeAws_json1_1DescribeCertificateAuthorityCommand = exports.deserializeAws_json1_1DeletePolicyCommand = exports.deserializeAws_json1_1DeletePermissionCommand = exports.deserializeAws_json1_1DeleteCertificateAuthorityCommand = exports.deserializeAws_json1_1CreatePermissionCommand = exports.deserializeAws_json1_1CreateCertificateAuthorityAuditReportCommand = exports.deserializeAws_json1_1CreateCertificateAuthorityCommand = exports.serializeAws_json1_1UpdateCertificateAuthorityCommand = exports.serializeAws_json1_1UntagCertificateAuthorityCommand = exports.serializeAws_json1_1TagCertificateAuthorityCommand = exports.serializeAws_json1_1RevokeCertificateCommand = exports.serializeAws_json1_1RestoreCertificateAuthorityCommand = exports.serializeAws_json1_1PutPolicyCommand = exports.serializeAws_json1_1ListTagsCommand = exports.serializeAws_json1_1ListPermissionsCommand = exports.serializeAws_json1_1ListCertificateAuthoritiesCommand = exports.serializeAws_json1_1IssueCertificateCommand = exports.serializeAws_json1_1ImportCertificateAuthorityCertificateCommand = exports.serializeAws_json1_1GetPolicyCommand = exports.serializeAws_json1_1GetCertificateAuthorityCsrCommand = exports.serializeAws_json1_1GetCertificateAuthorityCertificateCommand = exports.serializeAws_json1_1GetCertificateCommand = exports.serializeAws_json1_1DescribeCertificateAuthorityAuditReportCommand = exports.serializeAws_json1_1DescribeCertificateAuthorityCommand = exports.serializeAws_json1_1DeletePolicyCommand = exports.serializeAws_json1_1DeletePermissionCommand = exports.serializeAws_json1_1DeleteCertificateAuthorityCommand = exports.serializeAws_json1_1CreatePermissionCommand = exports.serializeAws_json1_1CreateCertificateAuthorityAuditReportCommand = exports.serializeAws_json1_1CreateCertificateAuthorityCommand = void 0;
4
4
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const ACMPCAServiceException_1 = require("../models/ACMPCAServiceException");
7
+ const models_0_1 = require("../models/models_0");
6
8
  const serializeAws_json1_1CreateCertificateAuthorityCommand = async (input, context) => {
7
9
  const headers = {
8
10
  "content-type": "application/x-amz-json-1.1",
@@ -258,51 +260,25 @@ const deserializeAws_json1_1CreateCertificateAuthorityCommandError = async (outp
258
260
  switch (errorCode) {
259
261
  case "InvalidArgsException":
260
262
  case "com.amazonaws.acmpca#InvalidArgsException":
261
- response = {
262
- ...(await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context)),
263
- name: errorCode,
264
- $metadata: deserializeMetadata(output),
265
- };
266
- break;
263
+ throw await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context);
267
264
  case "InvalidPolicyException":
268
265
  case "com.amazonaws.acmpca#InvalidPolicyException":
269
- response = {
270
- ...(await deserializeAws_json1_1InvalidPolicyExceptionResponse(parsedOutput, context)),
271
- name: errorCode,
272
- $metadata: deserializeMetadata(output),
273
- };
274
- break;
266
+ throw await deserializeAws_json1_1InvalidPolicyExceptionResponse(parsedOutput, context);
275
267
  case "InvalidTagException":
276
268
  case "com.amazonaws.acmpca#InvalidTagException":
277
- response = {
278
- ...(await deserializeAws_json1_1InvalidTagExceptionResponse(parsedOutput, context)),
279
- name: errorCode,
280
- $metadata: deserializeMetadata(output),
281
- };
282
- break;
269
+ throw await deserializeAws_json1_1InvalidTagExceptionResponse(parsedOutput, context);
283
270
  case "LimitExceededException":
284
271
  case "com.amazonaws.acmpca#LimitExceededException":
285
- response = {
286
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
287
- name: errorCode,
288
- $metadata: deserializeMetadata(output),
289
- };
290
- break;
272
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
291
273
  default:
292
274
  const parsedBody = parsedOutput.body;
293
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
294
- response = {
295
- ...parsedBody,
296
- name: `${errorCode}`,
297
- message: parsedBody.message || parsedBody.Message || errorCode,
275
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
276
+ name: parsedBody.code || parsedBody.Code || errorCode,
298
277
  $fault: "client",
299
278
  $metadata: deserializeMetadata(output),
300
- };
279
+ });
280
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
301
281
  }
302
- const message = response.message || response.Message || errorCode;
303
- response.message = message;
304
- delete response.Message;
305
- return Promise.reject(Object.assign(new Error(message), response));
306
282
  };
307
283
  const deserializeAws_json1_1CreateCertificateAuthorityAuditReportCommand = async (output, context) => {
308
284
  if (output.statusCode >= 300) {
@@ -329,67 +305,31 @@ const deserializeAws_json1_1CreateCertificateAuthorityAuditReportCommandError =
329
305
  switch (errorCode) {
330
306
  case "InvalidArgsException":
331
307
  case "com.amazonaws.acmpca#InvalidArgsException":
332
- response = {
333
- ...(await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context)),
334
- name: errorCode,
335
- $metadata: deserializeMetadata(output),
336
- };
337
- break;
308
+ throw await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context);
338
309
  case "InvalidArnException":
339
310
  case "com.amazonaws.acmpca#InvalidArnException":
340
- response = {
341
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
342
- name: errorCode,
343
- $metadata: deserializeMetadata(output),
344
- };
345
- break;
311
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
346
312
  case "InvalidStateException":
347
313
  case "com.amazonaws.acmpca#InvalidStateException":
348
- response = {
349
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
350
- name: errorCode,
351
- $metadata: deserializeMetadata(output),
352
- };
353
- break;
314
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
354
315
  case "RequestFailedException":
355
316
  case "com.amazonaws.acmpca#RequestFailedException":
356
- response = {
357
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
358
- name: errorCode,
359
- $metadata: deserializeMetadata(output),
360
- };
361
- break;
317
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
362
318
  case "RequestInProgressException":
363
319
  case "com.amazonaws.acmpca#RequestInProgressException":
364
- response = {
365
- ...(await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context)),
366
- name: errorCode,
367
- $metadata: deserializeMetadata(output),
368
- };
369
- break;
320
+ throw await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context);
370
321
  case "ResourceNotFoundException":
371
322
  case "com.amazonaws.acmpca#ResourceNotFoundException":
372
- response = {
373
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
374
- name: errorCode,
375
- $metadata: deserializeMetadata(output),
376
- };
377
- break;
323
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
378
324
  default:
379
325
  const parsedBody = parsedOutput.body;
380
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
381
- response = {
382
- ...parsedBody,
383
- name: `${errorCode}`,
384
- message: parsedBody.message || parsedBody.Message || errorCode,
326
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
327
+ name: parsedBody.code || parsedBody.Code || errorCode,
385
328
  $fault: "client",
386
329
  $metadata: deserializeMetadata(output),
387
- };
330
+ });
331
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
388
332
  }
389
- const message = response.message || response.Message || errorCode;
390
- response.message = message;
391
- delete response.Message;
392
- return Promise.reject(Object.assign(new Error(message), response));
393
333
  };
394
334
  const deserializeAws_json1_1CreatePermissionCommand = async (output, context) => {
395
335
  if (output.statusCode >= 300) {
@@ -413,67 +353,31 @@ const deserializeAws_json1_1CreatePermissionCommandError = async (output, contex
413
353
  switch (errorCode) {
414
354
  case "InvalidArnException":
415
355
  case "com.amazonaws.acmpca#InvalidArnException":
416
- response = {
417
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
418
- name: errorCode,
419
- $metadata: deserializeMetadata(output),
420
- };
421
- break;
356
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
422
357
  case "InvalidStateException":
423
358
  case "com.amazonaws.acmpca#InvalidStateException":
424
- response = {
425
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
426
- name: errorCode,
427
- $metadata: deserializeMetadata(output),
428
- };
429
- break;
359
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
430
360
  case "LimitExceededException":
431
361
  case "com.amazonaws.acmpca#LimitExceededException":
432
- response = {
433
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
434
- name: errorCode,
435
- $metadata: deserializeMetadata(output),
436
- };
437
- break;
362
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
438
363
  case "PermissionAlreadyExistsException":
439
364
  case "com.amazonaws.acmpca#PermissionAlreadyExistsException":
440
- response = {
441
- ...(await deserializeAws_json1_1PermissionAlreadyExistsExceptionResponse(parsedOutput, context)),
442
- name: errorCode,
443
- $metadata: deserializeMetadata(output),
444
- };
445
- break;
365
+ throw await deserializeAws_json1_1PermissionAlreadyExistsExceptionResponse(parsedOutput, context);
446
366
  case "RequestFailedException":
447
367
  case "com.amazonaws.acmpca#RequestFailedException":
448
- response = {
449
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
450
- name: errorCode,
451
- $metadata: deserializeMetadata(output),
452
- };
453
- break;
368
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
454
369
  case "ResourceNotFoundException":
455
370
  case "com.amazonaws.acmpca#ResourceNotFoundException":
456
- response = {
457
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
458
- name: errorCode,
459
- $metadata: deserializeMetadata(output),
460
- };
461
- break;
371
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
462
372
  default:
463
373
  const parsedBody = parsedOutput.body;
464
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
465
- response = {
466
- ...parsedBody,
467
- name: `${errorCode}`,
468
- message: parsedBody.message || parsedBody.Message || errorCode,
374
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
375
+ name: parsedBody.code || parsedBody.Code || errorCode,
469
376
  $fault: "client",
470
377
  $metadata: deserializeMetadata(output),
471
- };
378
+ });
379
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
472
380
  }
473
- const message = response.message || response.Message || errorCode;
474
- response.message = message;
475
- delete response.Message;
476
- return Promise.reject(Object.assign(new Error(message), response));
477
381
  };
478
382
  const deserializeAws_json1_1DeleteCertificateAuthorityCommand = async (output, context) => {
479
383
  if (output.statusCode >= 300) {
@@ -497,51 +401,25 @@ const deserializeAws_json1_1DeleteCertificateAuthorityCommandError = async (outp
497
401
  switch (errorCode) {
498
402
  case "ConcurrentModificationException":
499
403
  case "com.amazonaws.acmpca#ConcurrentModificationException":
500
- response = {
501
- ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),
502
- name: errorCode,
503
- $metadata: deserializeMetadata(output),
504
- };
505
- break;
404
+ throw await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context);
506
405
  case "InvalidArnException":
507
406
  case "com.amazonaws.acmpca#InvalidArnException":
508
- response = {
509
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
510
- name: errorCode,
511
- $metadata: deserializeMetadata(output),
512
- };
513
- break;
407
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
514
408
  case "InvalidStateException":
515
409
  case "com.amazonaws.acmpca#InvalidStateException":
516
- response = {
517
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
518
- name: errorCode,
519
- $metadata: deserializeMetadata(output),
520
- };
521
- break;
410
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
522
411
  case "ResourceNotFoundException":
523
412
  case "com.amazonaws.acmpca#ResourceNotFoundException":
524
- response = {
525
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
526
- name: errorCode,
527
- $metadata: deserializeMetadata(output),
528
- };
529
- break;
413
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
530
414
  default:
531
415
  const parsedBody = parsedOutput.body;
532
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
533
- response = {
534
- ...parsedBody,
535
- name: `${errorCode}`,
536
- message: parsedBody.message || parsedBody.Message || errorCode,
416
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
417
+ name: parsedBody.code || parsedBody.Code || errorCode,
537
418
  $fault: "client",
538
419
  $metadata: deserializeMetadata(output),
539
- };
420
+ });
421
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
540
422
  }
541
- const message = response.message || response.Message || errorCode;
542
- response.message = message;
543
- delete response.Message;
544
- return Promise.reject(Object.assign(new Error(message), response));
545
423
  };
546
424
  const deserializeAws_json1_1DeletePermissionCommand = async (output, context) => {
547
425
  if (output.statusCode >= 300) {
@@ -565,51 +443,25 @@ const deserializeAws_json1_1DeletePermissionCommandError = async (output, contex
565
443
  switch (errorCode) {
566
444
  case "InvalidArnException":
567
445
  case "com.amazonaws.acmpca#InvalidArnException":
568
- response = {
569
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
570
- name: errorCode,
571
- $metadata: deserializeMetadata(output),
572
- };
573
- break;
446
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
574
447
  case "InvalidStateException":
575
448
  case "com.amazonaws.acmpca#InvalidStateException":
576
- response = {
577
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
578
- name: errorCode,
579
- $metadata: deserializeMetadata(output),
580
- };
581
- break;
449
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
582
450
  case "RequestFailedException":
583
451
  case "com.amazonaws.acmpca#RequestFailedException":
584
- response = {
585
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
586
- name: errorCode,
587
- $metadata: deserializeMetadata(output),
588
- };
589
- break;
452
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
590
453
  case "ResourceNotFoundException":
591
454
  case "com.amazonaws.acmpca#ResourceNotFoundException":
592
- response = {
593
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
594
- name: errorCode,
595
- $metadata: deserializeMetadata(output),
596
- };
597
- break;
455
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
598
456
  default:
599
457
  const parsedBody = parsedOutput.body;
600
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
601
- response = {
602
- ...parsedBody,
603
- name: `${errorCode}`,
604
- message: parsedBody.message || parsedBody.Message || errorCode,
458
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
459
+ name: parsedBody.code || parsedBody.Code || errorCode,
605
460
  $fault: "client",
606
461
  $metadata: deserializeMetadata(output),
607
- };
462
+ });
463
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
608
464
  }
609
- const message = response.message || response.Message || errorCode;
610
- response.message = message;
611
- delete response.Message;
612
- return Promise.reject(Object.assign(new Error(message), response));
613
465
  };
614
466
  const deserializeAws_json1_1DeletePolicyCommand = async (output, context) => {
615
467
  if (output.statusCode >= 300) {
@@ -633,67 +485,31 @@ const deserializeAws_json1_1DeletePolicyCommandError = async (output, context) =
633
485
  switch (errorCode) {
634
486
  case "ConcurrentModificationException":
635
487
  case "com.amazonaws.acmpca#ConcurrentModificationException":
636
- response = {
637
- ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),
638
- name: errorCode,
639
- $metadata: deserializeMetadata(output),
640
- };
641
- break;
488
+ throw await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context);
642
489
  case "InvalidArnException":
643
490
  case "com.amazonaws.acmpca#InvalidArnException":
644
- response = {
645
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
646
- name: errorCode,
647
- $metadata: deserializeMetadata(output),
648
- };
649
- break;
491
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
650
492
  case "InvalidStateException":
651
493
  case "com.amazonaws.acmpca#InvalidStateException":
652
- response = {
653
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
654
- name: errorCode,
655
- $metadata: deserializeMetadata(output),
656
- };
657
- break;
494
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
658
495
  case "LockoutPreventedException":
659
496
  case "com.amazonaws.acmpca#LockoutPreventedException":
660
- response = {
661
- ...(await deserializeAws_json1_1LockoutPreventedExceptionResponse(parsedOutput, context)),
662
- name: errorCode,
663
- $metadata: deserializeMetadata(output),
664
- };
665
- break;
497
+ throw await deserializeAws_json1_1LockoutPreventedExceptionResponse(parsedOutput, context);
666
498
  case "RequestFailedException":
667
499
  case "com.amazonaws.acmpca#RequestFailedException":
668
- response = {
669
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
670
- name: errorCode,
671
- $metadata: deserializeMetadata(output),
672
- };
673
- break;
500
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
674
501
  case "ResourceNotFoundException":
675
502
  case "com.amazonaws.acmpca#ResourceNotFoundException":
676
- response = {
677
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
678
- name: errorCode,
679
- $metadata: deserializeMetadata(output),
680
- };
681
- break;
503
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
682
504
  default:
683
505
  const parsedBody = parsedOutput.body;
684
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
685
- response = {
686
- ...parsedBody,
687
- name: `${errorCode}`,
688
- message: parsedBody.message || parsedBody.Message || errorCode,
506
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
507
+ name: parsedBody.code || parsedBody.Code || errorCode,
689
508
  $fault: "client",
690
509
  $metadata: deserializeMetadata(output),
691
- };
510
+ });
511
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
692
512
  }
693
- const message = response.message || response.Message || errorCode;
694
- response.message = message;
695
- delete response.Message;
696
- return Promise.reject(Object.assign(new Error(message), response));
697
513
  };
698
514
  const deserializeAws_json1_1DescribeCertificateAuthorityCommand = async (output, context) => {
699
515
  if (output.statusCode >= 300) {
@@ -720,35 +536,19 @@ const deserializeAws_json1_1DescribeCertificateAuthorityCommandError = async (ou
720
536
  switch (errorCode) {
721
537
  case "InvalidArnException":
722
538
  case "com.amazonaws.acmpca#InvalidArnException":
723
- response = {
724
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
725
- name: errorCode,
726
- $metadata: deserializeMetadata(output),
727
- };
728
- break;
539
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
729
540
  case "ResourceNotFoundException":
730
541
  case "com.amazonaws.acmpca#ResourceNotFoundException":
731
- response = {
732
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
733
- name: errorCode,
734
- $metadata: deserializeMetadata(output),
735
- };
736
- break;
542
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
737
543
  default:
738
544
  const parsedBody = parsedOutput.body;
739
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
740
- response = {
741
- ...parsedBody,
742
- name: `${errorCode}`,
743
- message: parsedBody.message || parsedBody.Message || errorCode,
545
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
546
+ name: parsedBody.code || parsedBody.Code || errorCode,
744
547
  $fault: "client",
745
548
  $metadata: deserializeMetadata(output),
746
- };
549
+ });
550
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
747
551
  }
748
- const message = response.message || response.Message || errorCode;
749
- response.message = message;
750
- delete response.Message;
751
- return Promise.reject(Object.assign(new Error(message), response));
752
552
  };
753
553
  const deserializeAws_json1_1DescribeCertificateAuthorityAuditReportCommand = async (output, context) => {
754
554
  if (output.statusCode >= 300) {
@@ -775,43 +575,22 @@ const deserializeAws_json1_1DescribeCertificateAuthorityAuditReportCommandError
775
575
  switch (errorCode) {
776
576
  case "InvalidArgsException":
777
577
  case "com.amazonaws.acmpca#InvalidArgsException":
778
- response = {
779
- ...(await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context)),
780
- name: errorCode,
781
- $metadata: deserializeMetadata(output),
782
- };
783
- break;
578
+ throw await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context);
784
579
  case "InvalidArnException":
785
580
  case "com.amazonaws.acmpca#InvalidArnException":
786
- response = {
787
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
788
- name: errorCode,
789
- $metadata: deserializeMetadata(output),
790
- };
791
- break;
581
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
792
582
  case "ResourceNotFoundException":
793
583
  case "com.amazonaws.acmpca#ResourceNotFoundException":
794
- response = {
795
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
796
- name: errorCode,
797
- $metadata: deserializeMetadata(output),
798
- };
799
- break;
584
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
800
585
  default:
801
586
  const parsedBody = parsedOutput.body;
802
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
803
- response = {
804
- ...parsedBody,
805
- name: `${errorCode}`,
806
- message: parsedBody.message || parsedBody.Message || errorCode,
587
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
588
+ name: parsedBody.code || parsedBody.Code || errorCode,
807
589
  $fault: "client",
808
590
  $metadata: deserializeMetadata(output),
809
- };
591
+ });
592
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
810
593
  }
811
- const message = response.message || response.Message || errorCode;
812
- response.message = message;
813
- delete response.Message;
814
- return Promise.reject(Object.assign(new Error(message), response));
815
594
  };
816
595
  const deserializeAws_json1_1GetCertificateCommand = async (output, context) => {
817
596
  if (output.statusCode >= 300) {
@@ -838,59 +617,28 @@ const deserializeAws_json1_1GetCertificateCommandError = async (output, context)
838
617
  switch (errorCode) {
839
618
  case "InvalidArnException":
840
619
  case "com.amazonaws.acmpca#InvalidArnException":
841
- response = {
842
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
843
- name: errorCode,
844
- $metadata: deserializeMetadata(output),
845
- };
846
- break;
620
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
847
621
  case "InvalidStateException":
848
622
  case "com.amazonaws.acmpca#InvalidStateException":
849
- response = {
850
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
851
- name: errorCode,
852
- $metadata: deserializeMetadata(output),
853
- };
854
- break;
623
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
855
624
  case "RequestFailedException":
856
625
  case "com.amazonaws.acmpca#RequestFailedException":
857
- response = {
858
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
859
- name: errorCode,
860
- $metadata: deserializeMetadata(output),
861
- };
862
- break;
626
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
863
627
  case "RequestInProgressException":
864
628
  case "com.amazonaws.acmpca#RequestInProgressException":
865
- response = {
866
- ...(await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context)),
867
- name: errorCode,
868
- $metadata: deserializeMetadata(output),
869
- };
870
- break;
629
+ throw await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context);
871
630
  case "ResourceNotFoundException":
872
631
  case "com.amazonaws.acmpca#ResourceNotFoundException":
873
- response = {
874
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
875
- name: errorCode,
876
- $metadata: deserializeMetadata(output),
877
- };
878
- break;
632
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
879
633
  default:
880
634
  const parsedBody = parsedOutput.body;
881
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
882
- response = {
883
- ...parsedBody,
884
- name: `${errorCode}`,
885
- message: parsedBody.message || parsedBody.Message || errorCode,
635
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
636
+ name: parsedBody.code || parsedBody.Code || errorCode,
886
637
  $fault: "client",
887
638
  $metadata: deserializeMetadata(output),
888
- };
639
+ });
640
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
889
641
  }
890
- const message = response.message || response.Message || errorCode;
891
- response.message = message;
892
- delete response.Message;
893
- return Promise.reject(Object.assign(new Error(message), response));
894
642
  };
895
643
  const deserializeAws_json1_1GetCertificateAuthorityCertificateCommand = async (output, context) => {
896
644
  if (output.statusCode >= 300) {
@@ -917,43 +665,22 @@ const deserializeAws_json1_1GetCertificateAuthorityCertificateCommandError = asy
917
665
  switch (errorCode) {
918
666
  case "InvalidArnException":
919
667
  case "com.amazonaws.acmpca#InvalidArnException":
920
- response = {
921
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
922
- name: errorCode,
923
- $metadata: deserializeMetadata(output),
924
- };
925
- break;
668
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
926
669
  case "InvalidStateException":
927
670
  case "com.amazonaws.acmpca#InvalidStateException":
928
- response = {
929
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
930
- name: errorCode,
931
- $metadata: deserializeMetadata(output),
932
- };
933
- break;
671
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
934
672
  case "ResourceNotFoundException":
935
673
  case "com.amazonaws.acmpca#ResourceNotFoundException":
936
- response = {
937
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
938
- name: errorCode,
939
- $metadata: deserializeMetadata(output),
940
- };
941
- break;
674
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
942
675
  default:
943
676
  const parsedBody = parsedOutput.body;
944
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
945
- response = {
946
- ...parsedBody,
947
- name: `${errorCode}`,
948
- message: parsedBody.message || parsedBody.Message || errorCode,
677
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
678
+ name: parsedBody.code || parsedBody.Code || errorCode,
949
679
  $fault: "client",
950
680
  $metadata: deserializeMetadata(output),
951
- };
681
+ });
682
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
952
683
  }
953
- const message = response.message || response.Message || errorCode;
954
- response.message = message;
955
- delete response.Message;
956
- return Promise.reject(Object.assign(new Error(message), response));
957
684
  };
958
685
  const deserializeAws_json1_1GetCertificateAuthorityCsrCommand = async (output, context) => {
959
686
  if (output.statusCode >= 300) {
@@ -980,59 +707,28 @@ const deserializeAws_json1_1GetCertificateAuthorityCsrCommandError = async (outp
980
707
  switch (errorCode) {
981
708
  case "InvalidArnException":
982
709
  case "com.amazonaws.acmpca#InvalidArnException":
983
- response = {
984
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
985
- name: errorCode,
986
- $metadata: deserializeMetadata(output),
987
- };
988
- break;
710
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
989
711
  case "InvalidStateException":
990
712
  case "com.amazonaws.acmpca#InvalidStateException":
991
- response = {
992
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
993
- name: errorCode,
994
- $metadata: deserializeMetadata(output),
995
- };
996
- break;
713
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
997
714
  case "RequestFailedException":
998
715
  case "com.amazonaws.acmpca#RequestFailedException":
999
- response = {
1000
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
1001
- name: errorCode,
1002
- $metadata: deserializeMetadata(output),
1003
- };
1004
- break;
716
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
1005
717
  case "RequestInProgressException":
1006
718
  case "com.amazonaws.acmpca#RequestInProgressException":
1007
- response = {
1008
- ...(await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context)),
1009
- name: errorCode,
1010
- $metadata: deserializeMetadata(output),
1011
- };
1012
- break;
719
+ throw await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context);
1013
720
  case "ResourceNotFoundException":
1014
721
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1015
- response = {
1016
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1017
- name: errorCode,
1018
- $metadata: deserializeMetadata(output),
1019
- };
1020
- break;
722
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1021
723
  default:
1022
724
  const parsedBody = parsedOutput.body;
1023
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1024
- response = {
1025
- ...parsedBody,
1026
- name: `${errorCode}`,
1027
- message: parsedBody.message || parsedBody.Message || errorCode,
725
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
726
+ name: parsedBody.code || parsedBody.Code || errorCode,
1028
727
  $fault: "client",
1029
728
  $metadata: deserializeMetadata(output),
1030
- };
729
+ });
730
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1031
731
  }
1032
- const message = response.message || response.Message || errorCode;
1033
- response.message = message;
1034
- delete response.Message;
1035
- return Promise.reject(Object.assign(new Error(message), response));
1036
732
  };
1037
733
  const deserializeAws_json1_1GetPolicyCommand = async (output, context) => {
1038
734
  if (output.statusCode >= 300) {
@@ -1059,51 +755,25 @@ const deserializeAws_json1_1GetPolicyCommandError = async (output, context) => {
1059
755
  switch (errorCode) {
1060
756
  case "InvalidArnException":
1061
757
  case "com.amazonaws.acmpca#InvalidArnException":
1062
- response = {
1063
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1064
- name: errorCode,
1065
- $metadata: deserializeMetadata(output),
1066
- };
1067
- break;
758
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1068
759
  case "InvalidStateException":
1069
760
  case "com.amazonaws.acmpca#InvalidStateException":
1070
- response = {
1071
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1072
- name: errorCode,
1073
- $metadata: deserializeMetadata(output),
1074
- };
1075
- break;
761
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1076
762
  case "RequestFailedException":
1077
763
  case "com.amazonaws.acmpca#RequestFailedException":
1078
- response = {
1079
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
1080
- name: errorCode,
1081
- $metadata: deserializeMetadata(output),
1082
- };
1083
- break;
764
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
1084
765
  case "ResourceNotFoundException":
1085
766
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1086
- response = {
1087
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1088
- name: errorCode,
1089
- $metadata: deserializeMetadata(output),
1090
- };
1091
- break;
767
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1092
768
  default:
1093
769
  const parsedBody = parsedOutput.body;
1094
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1095
- response = {
1096
- ...parsedBody,
1097
- name: `${errorCode}`,
1098
- message: parsedBody.message || parsedBody.Message || errorCode,
770
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
771
+ name: parsedBody.code || parsedBody.Code || errorCode,
1099
772
  $fault: "client",
1100
773
  $metadata: deserializeMetadata(output),
1101
- };
774
+ });
775
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1102
776
  }
1103
- const message = response.message || response.Message || errorCode;
1104
- response.message = message;
1105
- delete response.Message;
1106
- return Promise.reject(Object.assign(new Error(message), response));
1107
777
  };
1108
778
  const deserializeAws_json1_1ImportCertificateAuthorityCertificateCommand = async (output, context) => {
1109
779
  if (output.statusCode >= 300) {
@@ -1127,91 +797,40 @@ const deserializeAws_json1_1ImportCertificateAuthorityCertificateCommandError =
1127
797
  switch (errorCode) {
1128
798
  case "CertificateMismatchException":
1129
799
  case "com.amazonaws.acmpca#CertificateMismatchException":
1130
- response = {
1131
- ...(await deserializeAws_json1_1CertificateMismatchExceptionResponse(parsedOutput, context)),
1132
- name: errorCode,
1133
- $metadata: deserializeMetadata(output),
1134
- };
1135
- break;
800
+ throw await deserializeAws_json1_1CertificateMismatchExceptionResponse(parsedOutput, context);
1136
801
  case "ConcurrentModificationException":
1137
802
  case "com.amazonaws.acmpca#ConcurrentModificationException":
1138
- response = {
1139
- ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),
1140
- name: errorCode,
1141
- $metadata: deserializeMetadata(output),
1142
- };
1143
- break;
803
+ throw await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context);
1144
804
  case "InvalidArnException":
1145
805
  case "com.amazonaws.acmpca#InvalidArnException":
1146
- response = {
1147
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1148
- name: errorCode,
1149
- $metadata: deserializeMetadata(output),
1150
- };
1151
- break;
806
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1152
807
  case "InvalidRequestException":
1153
808
  case "com.amazonaws.acmpca#InvalidRequestException":
1154
- response = {
1155
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1156
- name: errorCode,
1157
- $metadata: deserializeMetadata(output),
1158
- };
1159
- break;
809
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1160
810
  case "InvalidStateException":
1161
811
  case "com.amazonaws.acmpca#InvalidStateException":
1162
- response = {
1163
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1164
- name: errorCode,
1165
- $metadata: deserializeMetadata(output),
1166
- };
1167
- break;
812
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1168
813
  case "MalformedCertificateException":
1169
814
  case "com.amazonaws.acmpca#MalformedCertificateException":
1170
- response = {
1171
- ...(await deserializeAws_json1_1MalformedCertificateExceptionResponse(parsedOutput, context)),
1172
- name: errorCode,
1173
- $metadata: deserializeMetadata(output),
1174
- };
1175
- break;
815
+ throw await deserializeAws_json1_1MalformedCertificateExceptionResponse(parsedOutput, context);
1176
816
  case "RequestFailedException":
1177
817
  case "com.amazonaws.acmpca#RequestFailedException":
1178
- response = {
1179
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
1180
- name: errorCode,
1181
- $metadata: deserializeMetadata(output),
1182
- };
1183
- break;
818
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
1184
819
  case "RequestInProgressException":
1185
820
  case "com.amazonaws.acmpca#RequestInProgressException":
1186
- response = {
1187
- ...(await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context)),
1188
- name: errorCode,
1189
- $metadata: deserializeMetadata(output),
1190
- };
1191
- break;
821
+ throw await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context);
1192
822
  case "ResourceNotFoundException":
1193
823
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1194
- response = {
1195
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1196
- name: errorCode,
1197
- $metadata: deserializeMetadata(output),
1198
- };
1199
- break;
824
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1200
825
  default:
1201
826
  const parsedBody = parsedOutput.body;
1202
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1203
- response = {
1204
- ...parsedBody,
1205
- name: `${errorCode}`,
1206
- message: parsedBody.message || parsedBody.Message || errorCode,
827
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
828
+ name: parsedBody.code || parsedBody.Code || errorCode,
1207
829
  $fault: "client",
1208
830
  $metadata: deserializeMetadata(output),
1209
- };
831
+ });
832
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1210
833
  }
1211
- const message = response.message || response.Message || errorCode;
1212
- response.message = message;
1213
- delete response.Message;
1214
- return Promise.reject(Object.assign(new Error(message), response));
1215
834
  };
1216
835
  const deserializeAws_json1_1IssueCertificateCommand = async (output, context) => {
1217
836
  if (output.statusCode >= 300) {
@@ -1238,67 +857,31 @@ const deserializeAws_json1_1IssueCertificateCommandError = async (output, contex
1238
857
  switch (errorCode) {
1239
858
  case "InvalidArgsException":
1240
859
  case "com.amazonaws.acmpca#InvalidArgsException":
1241
- response = {
1242
- ...(await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context)),
1243
- name: errorCode,
1244
- $metadata: deserializeMetadata(output),
1245
- };
1246
- break;
860
+ throw await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context);
1247
861
  case "InvalidArnException":
1248
862
  case "com.amazonaws.acmpca#InvalidArnException":
1249
- response = {
1250
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1251
- name: errorCode,
1252
- $metadata: deserializeMetadata(output),
1253
- };
1254
- break;
863
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1255
864
  case "InvalidStateException":
1256
865
  case "com.amazonaws.acmpca#InvalidStateException":
1257
- response = {
1258
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1259
- name: errorCode,
1260
- $metadata: deserializeMetadata(output),
1261
- };
1262
- break;
866
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1263
867
  case "LimitExceededException":
1264
868
  case "com.amazonaws.acmpca#LimitExceededException":
1265
- response = {
1266
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
1267
- name: errorCode,
1268
- $metadata: deserializeMetadata(output),
1269
- };
1270
- break;
869
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
1271
870
  case "MalformedCSRException":
1272
871
  case "com.amazonaws.acmpca#MalformedCSRException":
1273
- response = {
1274
- ...(await deserializeAws_json1_1MalformedCSRExceptionResponse(parsedOutput, context)),
1275
- name: errorCode,
1276
- $metadata: deserializeMetadata(output),
1277
- };
1278
- break;
872
+ throw await deserializeAws_json1_1MalformedCSRExceptionResponse(parsedOutput, context);
1279
873
  case "ResourceNotFoundException":
1280
874
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1281
- response = {
1282
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1283
- name: errorCode,
1284
- $metadata: deserializeMetadata(output),
1285
- };
1286
- break;
875
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1287
876
  default:
1288
877
  const parsedBody = parsedOutput.body;
1289
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1290
- response = {
1291
- ...parsedBody,
1292
- name: `${errorCode}`,
1293
- message: parsedBody.message || parsedBody.Message || errorCode,
878
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
879
+ name: parsedBody.code || parsedBody.Code || errorCode,
1294
880
  $fault: "client",
1295
881
  $metadata: deserializeMetadata(output),
1296
- };
882
+ });
883
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1297
884
  }
1298
- const message = response.message || response.Message || errorCode;
1299
- response.message = message;
1300
- delete response.Message;
1301
- return Promise.reject(Object.assign(new Error(message), response));
1302
885
  };
1303
886
  const deserializeAws_json1_1ListCertificateAuthoritiesCommand = async (output, context) => {
1304
887
  if (output.statusCode >= 300) {
@@ -1325,27 +908,16 @@ const deserializeAws_json1_1ListCertificateAuthoritiesCommandError = async (outp
1325
908
  switch (errorCode) {
1326
909
  case "InvalidNextTokenException":
1327
910
  case "com.amazonaws.acmpca#InvalidNextTokenException":
1328
- response = {
1329
- ...(await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context)),
1330
- name: errorCode,
1331
- $metadata: deserializeMetadata(output),
1332
- };
1333
- break;
911
+ throw await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context);
1334
912
  default:
1335
913
  const parsedBody = parsedOutput.body;
1336
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1337
- response = {
1338
- ...parsedBody,
1339
- name: `${errorCode}`,
1340
- message: parsedBody.message || parsedBody.Message || errorCode,
914
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
915
+ name: parsedBody.code || parsedBody.Code || errorCode,
1341
916
  $fault: "client",
1342
917
  $metadata: deserializeMetadata(output),
1343
- };
918
+ });
919
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1344
920
  }
1345
- const message = response.message || response.Message || errorCode;
1346
- response.message = message;
1347
- delete response.Message;
1348
- return Promise.reject(Object.assign(new Error(message), response));
1349
921
  };
1350
922
  const deserializeAws_json1_1ListPermissionsCommand = async (output, context) => {
1351
923
  if (output.statusCode >= 300) {
@@ -1372,59 +944,28 @@ const deserializeAws_json1_1ListPermissionsCommandError = async (output, context
1372
944
  switch (errorCode) {
1373
945
  case "InvalidArnException":
1374
946
  case "com.amazonaws.acmpca#InvalidArnException":
1375
- response = {
1376
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1377
- name: errorCode,
1378
- $metadata: deserializeMetadata(output),
1379
- };
1380
- break;
947
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1381
948
  case "InvalidNextTokenException":
1382
949
  case "com.amazonaws.acmpca#InvalidNextTokenException":
1383
- response = {
1384
- ...(await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context)),
1385
- name: errorCode,
1386
- $metadata: deserializeMetadata(output),
1387
- };
1388
- break;
950
+ throw await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context);
1389
951
  case "InvalidStateException":
1390
952
  case "com.amazonaws.acmpca#InvalidStateException":
1391
- response = {
1392
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1393
- name: errorCode,
1394
- $metadata: deserializeMetadata(output),
1395
- };
1396
- break;
953
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1397
954
  case "RequestFailedException":
1398
955
  case "com.amazonaws.acmpca#RequestFailedException":
1399
- response = {
1400
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
1401
- name: errorCode,
1402
- $metadata: deserializeMetadata(output),
1403
- };
1404
- break;
956
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
1405
957
  case "ResourceNotFoundException":
1406
958
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1407
- response = {
1408
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1409
- name: errorCode,
1410
- $metadata: deserializeMetadata(output),
1411
- };
1412
- break;
959
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1413
960
  default:
1414
961
  const parsedBody = parsedOutput.body;
1415
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1416
- response = {
1417
- ...parsedBody,
1418
- name: `${errorCode}`,
1419
- message: parsedBody.message || parsedBody.Message || errorCode,
962
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
963
+ name: parsedBody.code || parsedBody.Code || errorCode,
1420
964
  $fault: "client",
1421
965
  $metadata: deserializeMetadata(output),
1422
- };
966
+ });
967
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1423
968
  }
1424
- const message = response.message || response.Message || errorCode;
1425
- response.message = message;
1426
- delete response.Message;
1427
- return Promise.reject(Object.assign(new Error(message), response));
1428
969
  };
1429
970
  const deserializeAws_json1_1ListTagsCommand = async (output, context) => {
1430
971
  if (output.statusCode >= 300) {
@@ -1451,43 +992,22 @@ const deserializeAws_json1_1ListTagsCommandError = async (output, context) => {
1451
992
  switch (errorCode) {
1452
993
  case "InvalidArnException":
1453
994
  case "com.amazonaws.acmpca#InvalidArnException":
1454
- response = {
1455
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1456
- name: errorCode,
1457
- $metadata: deserializeMetadata(output),
1458
- };
1459
- break;
995
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1460
996
  case "InvalidStateException":
1461
997
  case "com.amazonaws.acmpca#InvalidStateException":
1462
- response = {
1463
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1464
- name: errorCode,
1465
- $metadata: deserializeMetadata(output),
1466
- };
1467
- break;
998
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1468
999
  case "ResourceNotFoundException":
1469
1000
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1470
- response = {
1471
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1472
- name: errorCode,
1473
- $metadata: deserializeMetadata(output),
1474
- };
1475
- break;
1001
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1476
1002
  default:
1477
1003
  const parsedBody = parsedOutput.body;
1478
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1479
- response = {
1480
- ...parsedBody,
1481
- name: `${errorCode}`,
1482
- message: parsedBody.message || parsedBody.Message || errorCode,
1004
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
1005
+ name: parsedBody.code || parsedBody.Code || errorCode,
1483
1006
  $fault: "client",
1484
1007
  $metadata: deserializeMetadata(output),
1485
- };
1008
+ });
1009
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1486
1010
  }
1487
- const message = response.message || response.Message || errorCode;
1488
- response.message = message;
1489
- delete response.Message;
1490
- return Promise.reject(Object.assign(new Error(message), response));
1491
1011
  };
1492
1012
  const deserializeAws_json1_1PutPolicyCommand = async (output, context) => {
1493
1013
  if (output.statusCode >= 300) {
@@ -1511,75 +1031,34 @@ const deserializeAws_json1_1PutPolicyCommandError = async (output, context) => {
1511
1031
  switch (errorCode) {
1512
1032
  case "ConcurrentModificationException":
1513
1033
  case "com.amazonaws.acmpca#ConcurrentModificationException":
1514
- response = {
1515
- ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),
1516
- name: errorCode,
1517
- $metadata: deserializeMetadata(output),
1518
- };
1519
- break;
1034
+ throw await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context);
1520
1035
  case "InvalidArnException":
1521
1036
  case "com.amazonaws.acmpca#InvalidArnException":
1522
- response = {
1523
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1524
- name: errorCode,
1525
- $metadata: deserializeMetadata(output),
1526
- };
1527
- break;
1037
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1528
1038
  case "InvalidPolicyException":
1529
1039
  case "com.amazonaws.acmpca#InvalidPolicyException":
1530
- response = {
1531
- ...(await deserializeAws_json1_1InvalidPolicyExceptionResponse(parsedOutput, context)),
1532
- name: errorCode,
1533
- $metadata: deserializeMetadata(output),
1534
- };
1535
- break;
1040
+ throw await deserializeAws_json1_1InvalidPolicyExceptionResponse(parsedOutput, context);
1536
1041
  case "InvalidStateException":
1537
1042
  case "com.amazonaws.acmpca#InvalidStateException":
1538
- response = {
1539
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1540
- name: errorCode,
1541
- $metadata: deserializeMetadata(output),
1542
- };
1543
- break;
1043
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1544
1044
  case "LockoutPreventedException":
1545
1045
  case "com.amazonaws.acmpca#LockoutPreventedException":
1546
- response = {
1547
- ...(await deserializeAws_json1_1LockoutPreventedExceptionResponse(parsedOutput, context)),
1548
- name: errorCode,
1549
- $metadata: deserializeMetadata(output),
1550
- };
1551
- break;
1046
+ throw await deserializeAws_json1_1LockoutPreventedExceptionResponse(parsedOutput, context);
1552
1047
  case "RequestFailedException":
1553
1048
  case "com.amazonaws.acmpca#RequestFailedException":
1554
- response = {
1555
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
1556
- name: errorCode,
1557
- $metadata: deserializeMetadata(output),
1558
- };
1559
- break;
1049
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
1560
1050
  case "ResourceNotFoundException":
1561
1051
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1562
- response = {
1563
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1564
- name: errorCode,
1565
- $metadata: deserializeMetadata(output),
1566
- };
1567
- break;
1052
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1568
1053
  default:
1569
1054
  const parsedBody = parsedOutput.body;
1570
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1571
- response = {
1572
- ...parsedBody,
1573
- name: `${errorCode}`,
1574
- message: parsedBody.message || parsedBody.Message || errorCode,
1055
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
1056
+ name: parsedBody.code || parsedBody.Code || errorCode,
1575
1057
  $fault: "client",
1576
1058
  $metadata: deserializeMetadata(output),
1577
- };
1059
+ });
1060
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1578
1061
  }
1579
- const message = response.message || response.Message || errorCode;
1580
- response.message = message;
1581
- delete response.Message;
1582
- return Promise.reject(Object.assign(new Error(message), response));
1583
1062
  };
1584
1063
  const deserializeAws_json1_1RestoreCertificateAuthorityCommand = async (output, context) => {
1585
1064
  if (output.statusCode >= 300) {
@@ -1603,43 +1082,22 @@ const deserializeAws_json1_1RestoreCertificateAuthorityCommandError = async (out
1603
1082
  switch (errorCode) {
1604
1083
  case "InvalidArnException":
1605
1084
  case "com.amazonaws.acmpca#InvalidArnException":
1606
- response = {
1607
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1608
- name: errorCode,
1609
- $metadata: deserializeMetadata(output),
1610
- };
1611
- break;
1085
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1612
1086
  case "InvalidStateException":
1613
1087
  case "com.amazonaws.acmpca#InvalidStateException":
1614
- response = {
1615
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1616
- name: errorCode,
1617
- $metadata: deserializeMetadata(output),
1618
- };
1619
- break;
1088
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1620
1089
  case "ResourceNotFoundException":
1621
1090
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1622
- response = {
1623
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1624
- name: errorCode,
1625
- $metadata: deserializeMetadata(output),
1626
- };
1627
- break;
1091
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1628
1092
  default:
1629
1093
  const parsedBody = parsedOutput.body;
1630
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1631
- response = {
1632
- ...parsedBody,
1633
- name: `${errorCode}`,
1634
- message: parsedBody.message || parsedBody.Message || errorCode,
1094
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
1095
+ name: parsedBody.code || parsedBody.Code || errorCode,
1635
1096
  $fault: "client",
1636
1097
  $metadata: deserializeMetadata(output),
1637
- };
1098
+ });
1099
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1638
1100
  }
1639
- const message = response.message || response.Message || errorCode;
1640
- response.message = message;
1641
- delete response.Message;
1642
- return Promise.reject(Object.assign(new Error(message), response));
1643
1101
  };
1644
1102
  const deserializeAws_json1_1RevokeCertificateCommand = async (output, context) => {
1645
1103
  if (output.statusCode >= 300) {
@@ -1663,91 +1121,40 @@ const deserializeAws_json1_1RevokeCertificateCommandError = async (output, conte
1663
1121
  switch (errorCode) {
1664
1122
  case "ConcurrentModificationException":
1665
1123
  case "com.amazonaws.acmpca#ConcurrentModificationException":
1666
- response = {
1667
- ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),
1668
- name: errorCode,
1669
- $metadata: deserializeMetadata(output),
1670
- };
1671
- break;
1124
+ throw await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context);
1672
1125
  case "InvalidArnException":
1673
1126
  case "com.amazonaws.acmpca#InvalidArnException":
1674
- response = {
1675
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1676
- name: errorCode,
1677
- $metadata: deserializeMetadata(output),
1678
- };
1679
- break;
1127
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1680
1128
  case "InvalidRequestException":
1681
1129
  case "com.amazonaws.acmpca#InvalidRequestException":
1682
- response = {
1683
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1684
- name: errorCode,
1685
- $metadata: deserializeMetadata(output),
1686
- };
1687
- break;
1130
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1688
1131
  case "InvalidStateException":
1689
1132
  case "com.amazonaws.acmpca#InvalidStateException":
1690
- response = {
1691
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1692
- name: errorCode,
1693
- $metadata: deserializeMetadata(output),
1694
- };
1695
- break;
1133
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1696
1134
  case "LimitExceededException":
1697
1135
  case "com.amazonaws.acmpca#LimitExceededException":
1698
- response = {
1699
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
1700
- name: errorCode,
1701
- $metadata: deserializeMetadata(output),
1702
- };
1703
- break;
1136
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
1704
1137
  case "RequestAlreadyProcessedException":
1705
1138
  case "com.amazonaws.acmpca#RequestAlreadyProcessedException":
1706
- response = {
1707
- ...(await deserializeAws_json1_1RequestAlreadyProcessedExceptionResponse(parsedOutput, context)),
1708
- name: errorCode,
1709
- $metadata: deserializeMetadata(output),
1710
- };
1711
- break;
1139
+ throw await deserializeAws_json1_1RequestAlreadyProcessedExceptionResponse(parsedOutput, context);
1712
1140
  case "RequestFailedException":
1713
1141
  case "com.amazonaws.acmpca#RequestFailedException":
1714
- response = {
1715
- ...(await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context)),
1716
- name: errorCode,
1717
- $metadata: deserializeMetadata(output),
1718
- };
1719
- break;
1142
+ throw await deserializeAws_json1_1RequestFailedExceptionResponse(parsedOutput, context);
1720
1143
  case "RequestInProgressException":
1721
1144
  case "com.amazonaws.acmpca#RequestInProgressException":
1722
- response = {
1723
- ...(await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context)),
1724
- name: errorCode,
1725
- $metadata: deserializeMetadata(output),
1726
- };
1727
- break;
1145
+ throw await deserializeAws_json1_1RequestInProgressExceptionResponse(parsedOutput, context);
1728
1146
  case "ResourceNotFoundException":
1729
1147
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1730
- response = {
1731
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1732
- name: errorCode,
1733
- $metadata: deserializeMetadata(output),
1734
- };
1735
- break;
1148
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1736
1149
  default:
1737
1150
  const parsedBody = parsedOutput.body;
1738
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1739
- response = {
1740
- ...parsedBody,
1741
- name: `${errorCode}`,
1742
- message: parsedBody.message || parsedBody.Message || errorCode,
1151
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
1152
+ name: parsedBody.code || parsedBody.Code || errorCode,
1743
1153
  $fault: "client",
1744
1154
  $metadata: deserializeMetadata(output),
1745
- };
1155
+ });
1156
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1746
1157
  }
1747
- const message = response.message || response.Message || errorCode;
1748
- response.message = message;
1749
- delete response.Message;
1750
- return Promise.reject(Object.assign(new Error(message), response));
1751
1158
  };
1752
1159
  const deserializeAws_json1_1TagCertificateAuthorityCommand = async (output, context) => {
1753
1160
  if (output.statusCode >= 300) {
@@ -1771,59 +1178,28 @@ const deserializeAws_json1_1TagCertificateAuthorityCommandError = async (output,
1771
1178
  switch (errorCode) {
1772
1179
  case "InvalidArnException":
1773
1180
  case "com.amazonaws.acmpca#InvalidArnException":
1774
- response = {
1775
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1776
- name: errorCode,
1777
- $metadata: deserializeMetadata(output),
1778
- };
1779
- break;
1181
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1780
1182
  case "InvalidStateException":
1781
1183
  case "com.amazonaws.acmpca#InvalidStateException":
1782
- response = {
1783
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1784
- name: errorCode,
1785
- $metadata: deserializeMetadata(output),
1786
- };
1787
- break;
1184
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1788
1185
  case "InvalidTagException":
1789
1186
  case "com.amazonaws.acmpca#InvalidTagException":
1790
- response = {
1791
- ...(await deserializeAws_json1_1InvalidTagExceptionResponse(parsedOutput, context)),
1792
- name: errorCode,
1793
- $metadata: deserializeMetadata(output),
1794
- };
1795
- break;
1187
+ throw await deserializeAws_json1_1InvalidTagExceptionResponse(parsedOutput, context);
1796
1188
  case "ResourceNotFoundException":
1797
1189
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1798
- response = {
1799
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1800
- name: errorCode,
1801
- $metadata: deserializeMetadata(output),
1802
- };
1803
- break;
1190
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1804
1191
  case "TooManyTagsException":
1805
1192
  case "com.amazonaws.acmpca#TooManyTagsException":
1806
- response = {
1807
- ...(await deserializeAws_json1_1TooManyTagsExceptionResponse(parsedOutput, context)),
1808
- name: errorCode,
1809
- $metadata: deserializeMetadata(output),
1810
- };
1811
- break;
1193
+ throw await deserializeAws_json1_1TooManyTagsExceptionResponse(parsedOutput, context);
1812
1194
  default:
1813
1195
  const parsedBody = parsedOutput.body;
1814
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1815
- response = {
1816
- ...parsedBody,
1817
- name: `${errorCode}`,
1818
- message: parsedBody.message || parsedBody.Message || errorCode,
1196
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
1197
+ name: parsedBody.code || parsedBody.Code || errorCode,
1819
1198
  $fault: "client",
1820
1199
  $metadata: deserializeMetadata(output),
1821
- };
1200
+ });
1201
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1822
1202
  }
1823
- const message = response.message || response.Message || errorCode;
1824
- response.message = message;
1825
- delete response.Message;
1826
- return Promise.reject(Object.assign(new Error(message), response));
1827
1203
  };
1828
1204
  const deserializeAws_json1_1UntagCertificateAuthorityCommand = async (output, context) => {
1829
1205
  if (output.statusCode >= 300) {
@@ -1847,51 +1223,25 @@ const deserializeAws_json1_1UntagCertificateAuthorityCommandError = async (outpu
1847
1223
  switch (errorCode) {
1848
1224
  case "InvalidArnException":
1849
1225
  case "com.amazonaws.acmpca#InvalidArnException":
1850
- response = {
1851
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1852
- name: errorCode,
1853
- $metadata: deserializeMetadata(output),
1854
- };
1855
- break;
1226
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1856
1227
  case "InvalidStateException":
1857
1228
  case "com.amazonaws.acmpca#InvalidStateException":
1858
- response = {
1859
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1860
- name: errorCode,
1861
- $metadata: deserializeMetadata(output),
1862
- };
1863
- break;
1229
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1864
1230
  case "InvalidTagException":
1865
1231
  case "com.amazonaws.acmpca#InvalidTagException":
1866
- response = {
1867
- ...(await deserializeAws_json1_1InvalidTagExceptionResponse(parsedOutput, context)),
1868
- name: errorCode,
1869
- $metadata: deserializeMetadata(output),
1870
- };
1871
- break;
1232
+ throw await deserializeAws_json1_1InvalidTagExceptionResponse(parsedOutput, context);
1872
1233
  case "ResourceNotFoundException":
1873
1234
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1874
- response = {
1875
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1876
- name: errorCode,
1877
- $metadata: deserializeMetadata(output),
1878
- };
1879
- break;
1235
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1880
1236
  default:
1881
1237
  const parsedBody = parsedOutput.body;
1882
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1883
- response = {
1884
- ...parsedBody,
1885
- name: `${errorCode}`,
1886
- message: parsedBody.message || parsedBody.Message || errorCode,
1238
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
1239
+ name: parsedBody.code || parsedBody.Code || errorCode,
1887
1240
  $fault: "client",
1888
1241
  $metadata: deserializeMetadata(output),
1889
- };
1242
+ });
1243
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1890
1244
  }
1891
- const message = response.message || response.Message || errorCode;
1892
- response.message = message;
1893
- delete response.Message;
1894
- return Promise.reject(Object.assign(new Error(message), response));
1895
1245
  };
1896
1246
  const deserializeAws_json1_1UpdateCertificateAuthorityCommand = async (output, context) => {
1897
1247
  if (output.statusCode >= 300) {
@@ -1915,276 +1265,202 @@ const deserializeAws_json1_1UpdateCertificateAuthorityCommandError = async (outp
1915
1265
  switch (errorCode) {
1916
1266
  case "ConcurrentModificationException":
1917
1267
  case "com.amazonaws.acmpca#ConcurrentModificationException":
1918
- response = {
1919
- ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),
1920
- name: errorCode,
1921
- $metadata: deserializeMetadata(output),
1922
- };
1923
- break;
1268
+ throw await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context);
1924
1269
  case "InvalidArgsException":
1925
1270
  case "com.amazonaws.acmpca#InvalidArgsException":
1926
- response = {
1927
- ...(await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context)),
1928
- name: errorCode,
1929
- $metadata: deserializeMetadata(output),
1930
- };
1931
- break;
1271
+ throw await deserializeAws_json1_1InvalidArgsExceptionResponse(parsedOutput, context);
1932
1272
  case "InvalidArnException":
1933
1273
  case "com.amazonaws.acmpca#InvalidArnException":
1934
- response = {
1935
- ...(await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context)),
1936
- name: errorCode,
1937
- $metadata: deserializeMetadata(output),
1938
- };
1939
- break;
1274
+ throw await deserializeAws_json1_1InvalidArnExceptionResponse(parsedOutput, context);
1940
1275
  case "InvalidPolicyException":
1941
1276
  case "com.amazonaws.acmpca#InvalidPolicyException":
1942
- response = {
1943
- ...(await deserializeAws_json1_1InvalidPolicyExceptionResponse(parsedOutput, context)),
1944
- name: errorCode,
1945
- $metadata: deserializeMetadata(output),
1946
- };
1947
- break;
1277
+ throw await deserializeAws_json1_1InvalidPolicyExceptionResponse(parsedOutput, context);
1948
1278
  case "InvalidStateException":
1949
1279
  case "com.amazonaws.acmpca#InvalidStateException":
1950
- response = {
1951
- ...(await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context)),
1952
- name: errorCode,
1953
- $metadata: deserializeMetadata(output),
1954
- };
1955
- break;
1280
+ throw await deserializeAws_json1_1InvalidStateExceptionResponse(parsedOutput, context);
1956
1281
  case "ResourceNotFoundException":
1957
1282
  case "com.amazonaws.acmpca#ResourceNotFoundException":
1958
- response = {
1959
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1960
- name: errorCode,
1961
- $metadata: deserializeMetadata(output),
1962
- };
1963
- break;
1283
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1964
1284
  default:
1965
1285
  const parsedBody = parsedOutput.body;
1966
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1967
- response = {
1968
- ...parsedBody,
1969
- name: `${errorCode}`,
1970
- message: parsedBody.message || parsedBody.Message || errorCode,
1286
+ response = new ACMPCAServiceException_1.ACMPCAServiceException({
1287
+ name: parsedBody.code || parsedBody.Code || errorCode,
1971
1288
  $fault: "client",
1972
1289
  $metadata: deserializeMetadata(output),
1973
- };
1290
+ });
1291
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1974
1292
  }
1975
- const message = response.message || response.Message || errorCode;
1976
- response.message = message;
1977
- delete response.Message;
1978
- return Promise.reject(Object.assign(new Error(message), response));
1979
1293
  };
1980
1294
  const deserializeAws_json1_1CertificateMismatchExceptionResponse = async (parsedOutput, context) => {
1981
1295
  const body = parsedOutput.body;
1982
1296
  const deserialized = deserializeAws_json1_1CertificateMismatchException(body, context);
1983
- const contents = {
1984
- name: "CertificateMismatchException",
1985
- $fault: "client",
1297
+ const exception = new models_0_1.CertificateMismatchException({
1986
1298
  $metadata: deserializeMetadata(parsedOutput),
1987
1299
  ...deserialized,
1988
- };
1989
- return contents;
1300
+ });
1301
+ return smithy_client_1.decorateServiceException(exception, body);
1990
1302
  };
1991
1303
  const deserializeAws_json1_1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
1992
1304
  const body = parsedOutput.body;
1993
1305
  const deserialized = deserializeAws_json1_1ConcurrentModificationException(body, context);
1994
- const contents = {
1995
- name: "ConcurrentModificationException",
1996
- $fault: "client",
1306
+ const exception = new models_0_1.ConcurrentModificationException({
1997
1307
  $metadata: deserializeMetadata(parsedOutput),
1998
1308
  ...deserialized,
1999
- };
2000
- return contents;
1309
+ });
1310
+ return smithy_client_1.decorateServiceException(exception, body);
2001
1311
  };
2002
1312
  const deserializeAws_json1_1InvalidArgsExceptionResponse = async (parsedOutput, context) => {
2003
1313
  const body = parsedOutput.body;
2004
1314
  const deserialized = deserializeAws_json1_1InvalidArgsException(body, context);
2005
- const contents = {
2006
- name: "InvalidArgsException",
2007
- $fault: "client",
1315
+ const exception = new models_0_1.InvalidArgsException({
2008
1316
  $metadata: deserializeMetadata(parsedOutput),
2009
1317
  ...deserialized,
2010
- };
2011
- return contents;
1318
+ });
1319
+ return smithy_client_1.decorateServiceException(exception, body);
2012
1320
  };
2013
1321
  const deserializeAws_json1_1InvalidArnExceptionResponse = async (parsedOutput, context) => {
2014
1322
  const body = parsedOutput.body;
2015
1323
  const deserialized = deserializeAws_json1_1InvalidArnException(body, context);
2016
- const contents = {
2017
- name: "InvalidArnException",
2018
- $fault: "client",
1324
+ const exception = new models_0_1.InvalidArnException({
2019
1325
  $metadata: deserializeMetadata(parsedOutput),
2020
1326
  ...deserialized,
2021
- };
2022
- return contents;
1327
+ });
1328
+ return smithy_client_1.decorateServiceException(exception, body);
2023
1329
  };
2024
1330
  const deserializeAws_json1_1InvalidNextTokenExceptionResponse = async (parsedOutput, context) => {
2025
1331
  const body = parsedOutput.body;
2026
1332
  const deserialized = deserializeAws_json1_1InvalidNextTokenException(body, context);
2027
- const contents = {
2028
- name: "InvalidNextTokenException",
2029
- $fault: "client",
1333
+ const exception = new models_0_1.InvalidNextTokenException({
2030
1334
  $metadata: deserializeMetadata(parsedOutput),
2031
1335
  ...deserialized,
2032
- };
2033
- return contents;
1336
+ });
1337
+ return smithy_client_1.decorateServiceException(exception, body);
2034
1338
  };
2035
1339
  const deserializeAws_json1_1InvalidPolicyExceptionResponse = async (parsedOutput, context) => {
2036
1340
  const body = parsedOutput.body;
2037
1341
  const deserialized = deserializeAws_json1_1InvalidPolicyException(body, context);
2038
- const contents = {
2039
- name: "InvalidPolicyException",
2040
- $fault: "client",
1342
+ const exception = new models_0_1.InvalidPolicyException({
2041
1343
  $metadata: deserializeMetadata(parsedOutput),
2042
1344
  ...deserialized,
2043
- };
2044
- return contents;
1345
+ });
1346
+ return smithy_client_1.decorateServiceException(exception, body);
2045
1347
  };
2046
1348
  const deserializeAws_json1_1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
2047
1349
  const body = parsedOutput.body;
2048
1350
  const deserialized = deserializeAws_json1_1InvalidRequestException(body, context);
2049
- const contents = {
2050
- name: "InvalidRequestException",
2051
- $fault: "client",
1351
+ const exception = new models_0_1.InvalidRequestException({
2052
1352
  $metadata: deserializeMetadata(parsedOutput),
2053
1353
  ...deserialized,
2054
- };
2055
- return contents;
1354
+ });
1355
+ return smithy_client_1.decorateServiceException(exception, body);
2056
1356
  };
2057
1357
  const deserializeAws_json1_1InvalidStateExceptionResponse = async (parsedOutput, context) => {
2058
1358
  const body = parsedOutput.body;
2059
1359
  const deserialized = deserializeAws_json1_1InvalidStateException(body, context);
2060
- const contents = {
2061
- name: "InvalidStateException",
2062
- $fault: "client",
1360
+ const exception = new models_0_1.InvalidStateException({
2063
1361
  $metadata: deserializeMetadata(parsedOutput),
2064
1362
  ...deserialized,
2065
- };
2066
- return contents;
1363
+ });
1364
+ return smithy_client_1.decorateServiceException(exception, body);
2067
1365
  };
2068
1366
  const deserializeAws_json1_1InvalidTagExceptionResponse = async (parsedOutput, context) => {
2069
1367
  const body = parsedOutput.body;
2070
1368
  const deserialized = deserializeAws_json1_1InvalidTagException(body, context);
2071
- const contents = {
2072
- name: "InvalidTagException",
2073
- $fault: "client",
1369
+ const exception = new models_0_1.InvalidTagException({
2074
1370
  $metadata: deserializeMetadata(parsedOutput),
2075
1371
  ...deserialized,
2076
- };
2077
- return contents;
1372
+ });
1373
+ return smithy_client_1.decorateServiceException(exception, body);
2078
1374
  };
2079
1375
  const deserializeAws_json1_1LimitExceededExceptionResponse = async (parsedOutput, context) => {
2080
1376
  const body = parsedOutput.body;
2081
1377
  const deserialized = deserializeAws_json1_1LimitExceededException(body, context);
2082
- const contents = {
2083
- name: "LimitExceededException",
2084
- $fault: "client",
1378
+ const exception = new models_0_1.LimitExceededException({
2085
1379
  $metadata: deserializeMetadata(parsedOutput),
2086
1380
  ...deserialized,
2087
- };
2088
- return contents;
1381
+ });
1382
+ return smithy_client_1.decorateServiceException(exception, body);
2089
1383
  };
2090
1384
  const deserializeAws_json1_1LockoutPreventedExceptionResponse = async (parsedOutput, context) => {
2091
1385
  const body = parsedOutput.body;
2092
1386
  const deserialized = deserializeAws_json1_1LockoutPreventedException(body, context);
2093
- const contents = {
2094
- name: "LockoutPreventedException",
2095
- $fault: "client",
1387
+ const exception = new models_0_1.LockoutPreventedException({
2096
1388
  $metadata: deserializeMetadata(parsedOutput),
2097
1389
  ...deserialized,
2098
- };
2099
- return contents;
1390
+ });
1391
+ return smithy_client_1.decorateServiceException(exception, body);
2100
1392
  };
2101
1393
  const deserializeAws_json1_1MalformedCertificateExceptionResponse = async (parsedOutput, context) => {
2102
1394
  const body = parsedOutput.body;
2103
1395
  const deserialized = deserializeAws_json1_1MalformedCertificateException(body, context);
2104
- const contents = {
2105
- name: "MalformedCertificateException",
2106
- $fault: "client",
1396
+ const exception = new models_0_1.MalformedCertificateException({
2107
1397
  $metadata: deserializeMetadata(parsedOutput),
2108
1398
  ...deserialized,
2109
- };
2110
- return contents;
1399
+ });
1400
+ return smithy_client_1.decorateServiceException(exception, body);
2111
1401
  };
2112
1402
  const deserializeAws_json1_1MalformedCSRExceptionResponse = async (parsedOutput, context) => {
2113
1403
  const body = parsedOutput.body;
2114
1404
  const deserialized = deserializeAws_json1_1MalformedCSRException(body, context);
2115
- const contents = {
2116
- name: "MalformedCSRException",
2117
- $fault: "client",
1405
+ const exception = new models_0_1.MalformedCSRException({
2118
1406
  $metadata: deserializeMetadata(parsedOutput),
2119
1407
  ...deserialized,
2120
- };
2121
- return contents;
1408
+ });
1409
+ return smithy_client_1.decorateServiceException(exception, body);
2122
1410
  };
2123
1411
  const deserializeAws_json1_1PermissionAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
2124
1412
  const body = parsedOutput.body;
2125
1413
  const deserialized = deserializeAws_json1_1PermissionAlreadyExistsException(body, context);
2126
- const contents = {
2127
- name: "PermissionAlreadyExistsException",
2128
- $fault: "client",
1414
+ const exception = new models_0_1.PermissionAlreadyExistsException({
2129
1415
  $metadata: deserializeMetadata(parsedOutput),
2130
1416
  ...deserialized,
2131
- };
2132
- return contents;
1417
+ });
1418
+ return smithy_client_1.decorateServiceException(exception, body);
2133
1419
  };
2134
1420
  const deserializeAws_json1_1RequestAlreadyProcessedExceptionResponse = async (parsedOutput, context) => {
2135
1421
  const body = parsedOutput.body;
2136
1422
  const deserialized = deserializeAws_json1_1RequestAlreadyProcessedException(body, context);
2137
- const contents = {
2138
- name: "RequestAlreadyProcessedException",
2139
- $fault: "client",
1423
+ const exception = new models_0_1.RequestAlreadyProcessedException({
2140
1424
  $metadata: deserializeMetadata(parsedOutput),
2141
1425
  ...deserialized,
2142
- };
2143
- return contents;
1426
+ });
1427
+ return smithy_client_1.decorateServiceException(exception, body);
2144
1428
  };
2145
1429
  const deserializeAws_json1_1RequestFailedExceptionResponse = async (parsedOutput, context) => {
2146
1430
  const body = parsedOutput.body;
2147
1431
  const deserialized = deserializeAws_json1_1RequestFailedException(body, context);
2148
- const contents = {
2149
- name: "RequestFailedException",
2150
- $fault: "client",
1432
+ const exception = new models_0_1.RequestFailedException({
2151
1433
  $metadata: deserializeMetadata(parsedOutput),
2152
1434
  ...deserialized,
2153
- };
2154
- return contents;
1435
+ });
1436
+ return smithy_client_1.decorateServiceException(exception, body);
2155
1437
  };
2156
1438
  const deserializeAws_json1_1RequestInProgressExceptionResponse = async (parsedOutput, context) => {
2157
1439
  const body = parsedOutput.body;
2158
1440
  const deserialized = deserializeAws_json1_1RequestInProgressException(body, context);
2159
- const contents = {
2160
- name: "RequestInProgressException",
2161
- $fault: "client",
1441
+ const exception = new models_0_1.RequestInProgressException({
2162
1442
  $metadata: deserializeMetadata(parsedOutput),
2163
1443
  ...deserialized,
2164
- };
2165
- return contents;
1444
+ });
1445
+ return smithy_client_1.decorateServiceException(exception, body);
2166
1446
  };
2167
1447
  const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2168
1448
  const body = parsedOutput.body;
2169
1449
  const deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
2170
- const contents = {
2171
- name: "ResourceNotFoundException",
2172
- $fault: "client",
1450
+ const exception = new models_0_1.ResourceNotFoundException({
2173
1451
  $metadata: deserializeMetadata(parsedOutput),
2174
1452
  ...deserialized,
2175
- };
2176
- return contents;
1453
+ });
1454
+ return smithy_client_1.decorateServiceException(exception, body);
2177
1455
  };
2178
1456
  const deserializeAws_json1_1TooManyTagsExceptionResponse = async (parsedOutput, context) => {
2179
1457
  const body = parsedOutput.body;
2180
1458
  const deserialized = deserializeAws_json1_1TooManyTagsException(body, context);
2181
- const contents = {
2182
- name: "TooManyTagsException",
2183
- $fault: "client",
1459
+ const exception = new models_0_1.TooManyTagsException({
2184
1460
  $metadata: deserializeMetadata(parsedOutput),
2185
1461
  ...deserialized,
2186
- };
2187
- return contents;
1462
+ });
1463
+ return smithy_client_1.decorateServiceException(exception, body);
2188
1464
  };
2189
1465
  const serializeAws_json1_1AccessDescription = (input, context) => {
2190
1466
  return {
@@ -2672,7 +1948,7 @@ const deserializeAws_json1_1AccessDescription = (output, context) => {
2672
1948
  };
2673
1949
  };
2674
1950
  const deserializeAws_json1_1AccessDescriptionList = (output, context) => {
2675
- return (output || [])
1951
+ const retVal = (output || [])
2676
1952
  .filter((e) => e != null)
2677
1953
  .map((entry) => {
2678
1954
  if (entry === null) {
@@ -2680,6 +1956,7 @@ const deserializeAws_json1_1AccessDescriptionList = (output, context) => {
2680
1956
  }
2681
1957
  return deserializeAws_json1_1AccessDescription(entry, context);
2682
1958
  });
1959
+ return retVal;
2683
1960
  };
2684
1961
  const deserializeAws_json1_1AccessMethod = (output, context) => {
2685
1962
  return {
@@ -2688,7 +1965,7 @@ const deserializeAws_json1_1AccessMethod = (output, context) => {
2688
1965
  };
2689
1966
  };
2690
1967
  const deserializeAws_json1_1ActionList = (output, context) => {
2691
- return (output || [])
1968
+ const retVal = (output || [])
2692
1969
  .filter((e) => e != null)
2693
1970
  .map((entry) => {
2694
1971
  if (entry === null) {
@@ -2696,6 +1973,7 @@ const deserializeAws_json1_1ActionList = (output, context) => {
2696
1973
  }
2697
1974
  return smithy_client_1.expectString(entry);
2698
1975
  });
1976
+ return retVal;
2699
1977
  };
2700
1978
  const deserializeAws_json1_1ASN1Subject = (output, context) => {
2701
1979
  return {
@@ -2716,7 +1994,7 @@ const deserializeAws_json1_1ASN1Subject = (output, context) => {
2716
1994
  };
2717
1995
  };
2718
1996
  const deserializeAws_json1_1CertificateAuthorities = (output, context) => {
2719
- return (output || [])
1997
+ const retVal = (output || [])
2720
1998
  .filter((e) => e != null)
2721
1999
  .map((entry) => {
2722
2000
  if (entry === null) {
@@ -2724,6 +2002,7 @@ const deserializeAws_json1_1CertificateAuthorities = (output, context) => {
2724
2002
  }
2725
2003
  return deserializeAws_json1_1CertificateAuthority(entry, context);
2726
2004
  });
2005
+ return retVal;
2727
2006
  };
2728
2007
  const deserializeAws_json1_1CertificateAuthority = (output, context) => {
2729
2008
  return {
@@ -3001,7 +2280,7 @@ const deserializeAws_json1_1PermissionAlreadyExistsException = (output, context)
3001
2280
  };
3002
2281
  };
3003
2282
  const deserializeAws_json1_1PermissionList = (output, context) => {
3004
- return (output || [])
2283
+ const retVal = (output || [])
3005
2284
  .filter((e) => e != null)
3006
2285
  .map((entry) => {
3007
2286
  if (entry === null) {
@@ -3009,6 +2288,7 @@ const deserializeAws_json1_1PermissionList = (output, context) => {
3009
2288
  }
3010
2289
  return deserializeAws_json1_1Permission(entry, context);
3011
2290
  });
2291
+ return retVal;
3012
2292
  };
3013
2293
  const deserializeAws_json1_1RequestAlreadyProcessedException = (output, context) => {
3014
2294
  return {
@@ -3047,7 +2327,7 @@ const deserializeAws_json1_1Tag = (output, context) => {
3047
2327
  };
3048
2328
  };
3049
2329
  const deserializeAws_json1_1TagList = (output, context) => {
3050
- return (output || [])
2330
+ const retVal = (output || [])
3051
2331
  .filter((e) => e != null)
3052
2332
  .map((entry) => {
3053
2333
  if (entry === null) {
@@ -3055,6 +2335,7 @@ const deserializeAws_json1_1TagList = (output, context) => {
3055
2335
  }
3056
2336
  return deserializeAws_json1_1Tag(entry, context);
3057
2337
  });
2338
+ return retVal;
3058
2339
  };
3059
2340
  const deserializeAws_json1_1TooManyTagsException = (output, context) => {
3060
2341
  return {