@aws-sdk/client-cloudhsm-v2 3.525.0 → 3.529.1

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.
package/dist-cjs/index.js CHANGED
@@ -210,6 +210,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
210
210
  var import_types = require("@smithy/types");
211
211
 
212
212
  // src/protocols/Aws_json1_1.ts
213
+ var import_core2 = require("@aws-sdk/core");
213
214
 
214
215
 
215
216
 
@@ -462,7 +463,7 @@ var de_CopyBackupToRegionCommand = /* @__PURE__ */ __name(async (output, context
462
463
  if (output.statusCode >= 300) {
463
464
  return de_CommandError(output, context);
464
465
  }
465
- const data = await parseBody(output.body, context);
466
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
466
467
  let contents = {};
467
468
  contents = de_CopyBackupToRegionResponse(data, context);
468
469
  const response = {
@@ -475,7 +476,7 @@ var de_CreateClusterCommand = /* @__PURE__ */ __name(async (output, context) =>
475
476
  if (output.statusCode >= 300) {
476
477
  return de_CommandError(output, context);
477
478
  }
478
- const data = await parseBody(output.body, context);
479
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
479
480
  let contents = {};
480
481
  contents = de_CreateClusterResponse(data, context);
481
482
  const response = {
@@ -488,7 +489,7 @@ var de_CreateHsmCommand = /* @__PURE__ */ __name(async (output, context) => {
488
489
  if (output.statusCode >= 300) {
489
490
  return de_CommandError(output, context);
490
491
  }
491
- const data = await parseBody(output.body, context);
492
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
492
493
  let contents = {};
493
494
  contents = (0, import_smithy_client._json)(data);
494
495
  const response = {
@@ -501,7 +502,7 @@ var de_DeleteBackupCommand = /* @__PURE__ */ __name(async (output, context) => {
501
502
  if (output.statusCode >= 300) {
502
503
  return de_CommandError(output, context);
503
504
  }
504
- const data = await parseBody(output.body, context);
505
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
505
506
  let contents = {};
506
507
  contents = de_DeleteBackupResponse(data, context);
507
508
  const response = {
@@ -514,7 +515,7 @@ var de_DeleteClusterCommand = /* @__PURE__ */ __name(async (output, context) =>
514
515
  if (output.statusCode >= 300) {
515
516
  return de_CommandError(output, context);
516
517
  }
517
- const data = await parseBody(output.body, context);
518
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
518
519
  let contents = {};
519
520
  contents = de_DeleteClusterResponse(data, context);
520
521
  const response = {
@@ -527,7 +528,7 @@ var de_DeleteHsmCommand = /* @__PURE__ */ __name(async (output, context) => {
527
528
  if (output.statusCode >= 300) {
528
529
  return de_CommandError(output, context);
529
530
  }
530
- const data = await parseBody(output.body, context);
531
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
531
532
  let contents = {};
532
533
  contents = (0, import_smithy_client._json)(data);
533
534
  const response = {
@@ -540,7 +541,7 @@ var de_DescribeBackupsCommand = /* @__PURE__ */ __name(async (output, context) =
540
541
  if (output.statusCode >= 300) {
541
542
  return de_CommandError(output, context);
542
543
  }
543
- const data = await parseBody(output.body, context);
544
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
544
545
  let contents = {};
545
546
  contents = de_DescribeBackupsResponse(data, context);
546
547
  const response = {
@@ -553,7 +554,7 @@ var de_DescribeClustersCommand = /* @__PURE__ */ __name(async (output, context)
553
554
  if (output.statusCode >= 300) {
554
555
  return de_CommandError(output, context);
555
556
  }
556
- const data = await parseBody(output.body, context);
557
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
557
558
  let contents = {};
558
559
  contents = de_DescribeClustersResponse(data, context);
559
560
  const response = {
@@ -566,7 +567,7 @@ var de_InitializeClusterCommand = /* @__PURE__ */ __name(async (output, context)
566
567
  if (output.statusCode >= 300) {
567
568
  return de_CommandError(output, context);
568
569
  }
569
- const data = await parseBody(output.body, context);
570
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
570
571
  let contents = {};
571
572
  contents = (0, import_smithy_client._json)(data);
572
573
  const response = {
@@ -579,7 +580,7 @@ var de_ListTagsCommand = /* @__PURE__ */ __name(async (output, context) => {
579
580
  if (output.statusCode >= 300) {
580
581
  return de_CommandError(output, context);
581
582
  }
582
- const data = await parseBody(output.body, context);
583
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
583
584
  let contents = {};
584
585
  contents = (0, import_smithy_client._json)(data);
585
586
  const response = {
@@ -592,7 +593,7 @@ var de_ModifyBackupAttributesCommand = /* @__PURE__ */ __name(async (output, con
592
593
  if (output.statusCode >= 300) {
593
594
  return de_CommandError(output, context);
594
595
  }
595
- const data = await parseBody(output.body, context);
596
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
596
597
  let contents = {};
597
598
  contents = de_ModifyBackupAttributesResponse(data, context);
598
599
  const response = {
@@ -605,7 +606,7 @@ var de_ModifyClusterCommand = /* @__PURE__ */ __name(async (output, context) =>
605
606
  if (output.statusCode >= 300) {
606
607
  return de_CommandError(output, context);
607
608
  }
608
- const data = await parseBody(output.body, context);
609
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
609
610
  let contents = {};
610
611
  contents = de_ModifyClusterResponse(data, context);
611
612
  const response = {
@@ -618,7 +619,7 @@ var de_RestoreBackupCommand = /* @__PURE__ */ __name(async (output, context) =>
618
619
  if (output.statusCode >= 300) {
619
620
  return de_CommandError(output, context);
620
621
  }
621
- const data = await parseBody(output.body, context);
622
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
622
623
  let contents = {};
623
624
  contents = de_RestoreBackupResponse(data, context);
624
625
  const response = {
@@ -631,7 +632,7 @@ var de_TagResourceCommand = /* @__PURE__ */ __name(async (output, context) => {
631
632
  if (output.statusCode >= 300) {
632
633
  return de_CommandError(output, context);
633
634
  }
634
- const data = await parseBody(output.body, context);
635
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
635
636
  let contents = {};
636
637
  contents = (0, import_smithy_client._json)(data);
637
638
  const response = {
@@ -644,7 +645,7 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
644
645
  if (output.statusCode >= 300) {
645
646
  return de_CommandError(output, context);
646
647
  }
647
- const data = await parseBody(output.body, context);
648
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
648
649
  let contents = {};
649
650
  contents = (0, import_smithy_client._json)(data);
650
651
  const response = {
@@ -656,9 +657,9 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
656
657
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
657
658
  const parsedOutput = {
658
659
  ...output,
659
- body: await parseErrorBody(output.body, context)
660
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
660
661
  };
661
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
662
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
662
663
  switch (errorCode) {
663
664
  case "CloudHsmAccessDeniedException":
664
665
  case "com.amazonaws.cloudhsmv2#CloudHsmAccessDeniedException":
@@ -848,7 +849,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
848
849
  extendedRequestId: output.headers["x-amz-id-2"],
849
850
  cfId: output.headers["x-amz-cf-id"]
850
851
  }), "deserializeMetadata");
851
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
852
852
  var throwDefaultError = (0, import_smithy_client.withBaseException)(CloudHSMV2ServiceException);
853
853
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
854
854
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -875,46 +875,6 @@ function sharedHeaders(operation) {
875
875
  };
876
876
  }
877
877
  __name(sharedHeaders, "sharedHeaders");
878
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
879
- if (encoded.length) {
880
- return JSON.parse(encoded);
881
- }
882
- return {};
883
- }), "parseBody");
884
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
885
- const value = await parseBody(errorBody, context);
886
- value.message = value.message ?? value.Message;
887
- return value;
888
- }, "parseErrorBody");
889
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
890
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
891
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
892
- let cleanValue = rawValue;
893
- if (typeof cleanValue === "number") {
894
- cleanValue = cleanValue.toString();
895
- }
896
- if (cleanValue.indexOf(",") >= 0) {
897
- cleanValue = cleanValue.split(",")[0];
898
- }
899
- if (cleanValue.indexOf(":") >= 0) {
900
- cleanValue = cleanValue.split(":")[0];
901
- }
902
- if (cleanValue.indexOf("#") >= 0) {
903
- cleanValue = cleanValue.split("#")[1];
904
- }
905
- return cleanValue;
906
- }, "sanitizeErrorCode");
907
- const headerKey = findKey(output.headers, "x-amzn-errortype");
908
- if (headerKey !== void 0) {
909
- return sanitizeErrorCode(output.headers[headerKey]);
910
- }
911
- if (data.code !== void 0) {
912
- return sanitizeErrorCode(data.code);
913
- }
914
- if (data["__type"] !== void 0) {
915
- return sanitizeErrorCode(data["__type"]);
916
- }
917
- }, "loadRestJsonErrorCode");
918
878
 
919
879
  // src/commands/CopyBackupToRegionCommand.ts
920
880
  var _CopyBackupToRegionCommand = class _CopyBackupToRegionCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,3 +1,4 @@
1
+ import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
1
2
  import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { CloudHSMV2ServiceException as __BaseException } from "../models/CloudHSMV2ServiceException";
@@ -512,43 +513,3 @@ function sharedHeaders(operation) {
512
513
  "x-amz-target": `BaldrApiService.${operation}`,
513
514
  };
514
515
  }
515
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
516
- if (encoded.length) {
517
- return JSON.parse(encoded);
518
- }
519
- return {};
520
- });
521
- const parseErrorBody = async (errorBody, context) => {
522
- const value = await parseBody(errorBody, context);
523
- value.message = value.message ?? value.Message;
524
- return value;
525
- };
526
- const loadRestJsonErrorCode = (output, data) => {
527
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
528
- const sanitizeErrorCode = (rawValue) => {
529
- let cleanValue = rawValue;
530
- if (typeof cleanValue === "number") {
531
- cleanValue = cleanValue.toString();
532
- }
533
- if (cleanValue.indexOf(",") >= 0) {
534
- cleanValue = cleanValue.split(",")[0];
535
- }
536
- if (cleanValue.indexOf(":") >= 0) {
537
- cleanValue = cleanValue.split(":")[0];
538
- }
539
- if (cleanValue.indexOf("#") >= 0) {
540
- cleanValue = cleanValue.split("#")[1];
541
- }
542
- return cleanValue;
543
- };
544
- const headerKey = findKey(output.headers, "x-amzn-errortype");
545
- if (headerKey !== undefined) {
546
- return sanitizeErrorCode(output.headers[headerKey]);
547
- }
548
- if (data.code !== undefined) {
549
- return sanitizeErrorCode(data.code);
550
- }
551
- if (data["__type"] !== undefined) {
552
- return sanitizeErrorCode(data["__type"]);
553
- }
554
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-cloudhsm-v2",
3
3
  "description": "AWS SDK for JavaScript Cloudhsm V2 Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
4
+ "version": "3.529.1",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-cloudhsm-v2",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sts": "3.525.0",
24
- "@aws-sdk/core": "3.525.0",
25
- "@aws-sdk/credential-provider-node": "3.525.0",
23
+ "@aws-sdk/client-sts": "3.529.1",
24
+ "@aws-sdk/core": "3.529.1",
25
+ "@aws-sdk/credential-provider-node": "3.529.1",
26
26
  "@aws-sdk/middleware-host-header": "3.523.0",
27
27
  "@aws-sdk/middleware-logger": "3.523.0",
28
28
  "@aws-sdk/middleware-recursion-detection": "3.523.0",