@aws-sdk/client-cloudcontrol 3.525.0 → 3.529.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.
package/dist-cjs/index.js CHANGED
@@ -717,6 +717,7 @@ var UpdateResourceOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
717
717
  }), "UpdateResourceOutputFilterSensitiveLog");
718
718
 
719
719
  // src/protocols/Aws_json1_0.ts
720
+ var import_core2 = require("@aws-sdk/core");
720
721
 
721
722
 
722
723
  var import_uuid = require("uuid");
@@ -772,7 +773,7 @@ var de_CancelResourceRequestCommand = /* @__PURE__ */ __name(async (output, cont
772
773
  if (output.statusCode >= 300) {
773
774
  return de_CommandError(output, context);
774
775
  }
775
- const data = await parseBody(output.body, context);
776
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
776
777
  let contents = {};
777
778
  contents = de_CancelResourceRequestOutput(data, context);
778
779
  const response = {
@@ -785,7 +786,7 @@ var de_CreateResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
785
786
  if (output.statusCode >= 300) {
786
787
  return de_CommandError(output, context);
787
788
  }
788
- const data = await parseBody(output.body, context);
789
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
789
790
  let contents = {};
790
791
  contents = de_CreateResourceOutput(data, context);
791
792
  const response = {
@@ -798,7 +799,7 @@ var de_DeleteResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
798
799
  if (output.statusCode >= 300) {
799
800
  return de_CommandError(output, context);
800
801
  }
801
- const data = await parseBody(output.body, context);
802
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
802
803
  let contents = {};
803
804
  contents = de_DeleteResourceOutput(data, context);
804
805
  const response = {
@@ -811,7 +812,7 @@ var de_GetResourceCommand = /* @__PURE__ */ __name(async (output, context) => {
811
812
  if (output.statusCode >= 300) {
812
813
  return de_CommandError(output, context);
813
814
  }
814
- const data = await parseBody(output.body, context);
815
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
815
816
  let contents = {};
816
817
  contents = (0, import_smithy_client._json)(data);
817
818
  const response = {
@@ -824,7 +825,7 @@ var de_GetResourceRequestStatusCommand = /* @__PURE__ */ __name(async (output, c
824
825
  if (output.statusCode >= 300) {
825
826
  return de_CommandError(output, context);
826
827
  }
827
- const data = await parseBody(output.body, context);
828
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
828
829
  let contents = {};
829
830
  contents = de_GetResourceRequestStatusOutput(data, context);
830
831
  const response = {
@@ -837,7 +838,7 @@ var de_ListResourceRequestsCommand = /* @__PURE__ */ __name(async (output, conte
837
838
  if (output.statusCode >= 300) {
838
839
  return de_CommandError(output, context);
839
840
  }
840
- const data = await parseBody(output.body, context);
841
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
841
842
  let contents = {};
842
843
  contents = de_ListResourceRequestsOutput(data, context);
843
844
  const response = {
@@ -850,7 +851,7 @@ var de_ListResourcesCommand = /* @__PURE__ */ __name(async (output, context) =>
850
851
  if (output.statusCode >= 300) {
851
852
  return de_CommandError(output, context);
852
853
  }
853
- const data = await parseBody(output.body, context);
854
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
854
855
  let contents = {};
855
856
  contents = (0, import_smithy_client._json)(data);
856
857
  const response = {
@@ -863,7 +864,7 @@ var de_UpdateResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
863
864
  if (output.statusCode >= 300) {
864
865
  return de_CommandError(output, context);
865
866
  }
866
- const data = await parseBody(output.body, context);
867
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
867
868
  let contents = {};
868
869
  contents = de_UpdateResourceOutput(data, context);
869
870
  const response = {
@@ -875,9 +876,9 @@ var de_UpdateResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
875
876
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
876
877
  const parsedOutput = {
877
878
  ...output,
878
- body: await parseErrorBody(output.body, context)
879
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
879
880
  };
880
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
881
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
881
882
  switch (errorCode) {
882
883
  case "ConcurrentModificationException":
883
884
  case "com.amazonaws.cloudcontrol#ConcurrentModificationException":
@@ -1225,7 +1226,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
1225
1226
  extendedRequestId: output.headers["x-amz-id-2"],
1226
1227
  cfId: output.headers["x-amz-cf-id"]
1227
1228
  }), "deserializeMetadata");
1228
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
1229
1229
  var throwDefaultError = (0, import_smithy_client.withBaseException)(CloudControlServiceException);
1230
1230
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
1231
1231
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -1252,46 +1252,6 @@ function sharedHeaders(operation) {
1252
1252
  };
1253
1253
  }
1254
1254
  __name(sharedHeaders, "sharedHeaders");
1255
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1256
- if (encoded.length) {
1257
- return JSON.parse(encoded);
1258
- }
1259
- return {};
1260
- }), "parseBody");
1261
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
1262
- const value = await parseBody(errorBody, context);
1263
- value.message = value.message ?? value.Message;
1264
- return value;
1265
- }, "parseErrorBody");
1266
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
1267
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
1268
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
1269
- let cleanValue = rawValue;
1270
- if (typeof cleanValue === "number") {
1271
- cleanValue = cleanValue.toString();
1272
- }
1273
- if (cleanValue.indexOf(",") >= 0) {
1274
- cleanValue = cleanValue.split(",")[0];
1275
- }
1276
- if (cleanValue.indexOf(":") >= 0) {
1277
- cleanValue = cleanValue.split(":")[0];
1278
- }
1279
- if (cleanValue.indexOf("#") >= 0) {
1280
- cleanValue = cleanValue.split("#")[1];
1281
- }
1282
- return cleanValue;
1283
- }, "sanitizeErrorCode");
1284
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1285
- if (headerKey !== void 0) {
1286
- return sanitizeErrorCode(output.headers[headerKey]);
1287
- }
1288
- if (data.code !== void 0) {
1289
- return sanitizeErrorCode(data.code);
1290
- }
1291
- if (data["__type"] !== void 0) {
1292
- return sanitizeErrorCode(data["__type"]);
1293
- }
1294
- }, "loadRestJsonErrorCode");
1295
1255
 
1296
1256
  // src/commands/CancelResourceRequestCommand.ts
1297
1257
  var _CancelResourceRequestCommand = class _CancelResourceRequestCommand 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, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { v4 as generateIdempotencyToken } from "uuid";
@@ -536,43 +537,3 @@ function sharedHeaders(operation) {
536
537
  "x-amz-target": `CloudApiService.${operation}`,
537
538
  };
538
539
  }
539
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
540
- if (encoded.length) {
541
- return JSON.parse(encoded);
542
- }
543
- return {};
544
- });
545
- const parseErrorBody = async (errorBody, context) => {
546
- const value = await parseBody(errorBody, context);
547
- value.message = value.message ?? value.Message;
548
- return value;
549
- };
550
- const loadRestJsonErrorCode = (output, data) => {
551
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
552
- const sanitizeErrorCode = (rawValue) => {
553
- let cleanValue = rawValue;
554
- if (typeof cleanValue === "number") {
555
- cleanValue = cleanValue.toString();
556
- }
557
- if (cleanValue.indexOf(",") >= 0) {
558
- cleanValue = cleanValue.split(",")[0];
559
- }
560
- if (cleanValue.indexOf(":") >= 0) {
561
- cleanValue = cleanValue.split(":")[0];
562
- }
563
- if (cleanValue.indexOf("#") >= 0) {
564
- cleanValue = cleanValue.split("#")[1];
565
- }
566
- return cleanValue;
567
- };
568
- const headerKey = findKey(output.headers, "x-amzn-errortype");
569
- if (headerKey !== undefined) {
570
- return sanitizeErrorCode(output.headers[headerKey]);
571
- }
572
- if (data.code !== undefined) {
573
- return sanitizeErrorCode(data.code);
574
- }
575
- if (data["__type"] !== undefined) {
576
- return sanitizeErrorCode(data["__type"]);
577
- }
578
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-cloudcontrol",
3
3
  "description": "AWS SDK for JavaScript Cloudcontrol Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
4
+ "version": "3.529.0",
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-cloudcontrol",
@@ -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.0",
24
+ "@aws-sdk/core": "3.529.0",
25
+ "@aws-sdk/credential-provider-node": "3.529.0",
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",