@aws-sdk/client-route53-recovery-cluster 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
@@ -196,6 +196,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
196
196
  var import_types = require("@smithy/types");
197
197
 
198
198
  // src/protocols/Aws_json1_0.ts
199
+ var import_core2 = require("@aws-sdk/core");
199
200
 
200
201
 
201
202
 
@@ -402,7 +403,7 @@ var de_GetRoutingControlStateCommand = /* @__PURE__ */ __name(async (output, con
402
403
  if (output.statusCode >= 300) {
403
404
  return de_CommandError(output, context);
404
405
  }
405
- const data = await parseBody(output.body, context);
406
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
406
407
  let contents = {};
407
408
  contents = (0, import_smithy_client._json)(data);
408
409
  const response = {
@@ -415,7 +416,7 @@ var de_ListRoutingControlsCommand = /* @__PURE__ */ __name(async (output, contex
415
416
  if (output.statusCode >= 300) {
416
417
  return de_CommandError(output, context);
417
418
  }
418
- const data = await parseBody(output.body, context);
419
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
419
420
  let contents = {};
420
421
  contents = (0, import_smithy_client._json)(data);
421
422
  const response = {
@@ -428,7 +429,7 @@ var de_UpdateRoutingControlStateCommand = /* @__PURE__ */ __name(async (output,
428
429
  if (output.statusCode >= 300) {
429
430
  return de_CommandError(output, context);
430
431
  }
431
- const data = await parseBody(output.body, context);
432
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
432
433
  let contents = {};
433
434
  contents = (0, import_smithy_client._json)(data);
434
435
  const response = {
@@ -441,7 +442,7 @@ var de_UpdateRoutingControlStatesCommand = /* @__PURE__ */ __name(async (output,
441
442
  if (output.statusCode >= 300) {
442
443
  return de_CommandError(output, context);
443
444
  }
444
- const data = await parseBody(output.body, context);
445
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
445
446
  let contents = {};
446
447
  contents = (0, import_smithy_client._json)(data);
447
448
  const response = {
@@ -453,9 +454,9 @@ var de_UpdateRoutingControlStatesCommand = /* @__PURE__ */ __name(async (output,
453
454
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
454
455
  const parsedOutput = {
455
456
  ...output,
456
- body: await parseErrorBody(output.body, context)
457
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
457
458
  };
458
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
459
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
459
460
  switch (errorCode) {
460
461
  case "AccessDeniedException":
461
462
  case "com.amazonaws.route53recoverycluster#AccessDeniedException":
@@ -568,7 +569,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
568
569
  extendedRequestId: output.headers["x-amz-id-2"],
569
570
  cfId: output.headers["x-amz-cf-id"]
570
571
  }), "deserializeMetadata");
571
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
572
572
  var throwDefaultError = (0, import_smithy_client.withBaseException)(Route53RecoveryClusterServiceException);
573
573
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
574
574
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -595,46 +595,6 @@ function sharedHeaders(operation) {
595
595
  };
596
596
  }
597
597
  __name(sharedHeaders, "sharedHeaders");
598
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
599
- if (encoded.length) {
600
- return JSON.parse(encoded);
601
- }
602
- return {};
603
- }), "parseBody");
604
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
605
- const value = await parseBody(errorBody, context);
606
- value.message = value.message ?? value.Message;
607
- return value;
608
- }, "parseErrorBody");
609
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
610
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
611
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
612
- let cleanValue = rawValue;
613
- if (typeof cleanValue === "number") {
614
- cleanValue = cleanValue.toString();
615
- }
616
- if (cleanValue.indexOf(",") >= 0) {
617
- cleanValue = cleanValue.split(",")[0];
618
- }
619
- if (cleanValue.indexOf(":") >= 0) {
620
- cleanValue = cleanValue.split(":")[0];
621
- }
622
- if (cleanValue.indexOf("#") >= 0) {
623
- cleanValue = cleanValue.split("#")[1];
624
- }
625
- return cleanValue;
626
- }, "sanitizeErrorCode");
627
- const headerKey = findKey(output.headers, "x-amzn-errortype");
628
- if (headerKey !== void 0) {
629
- return sanitizeErrorCode(output.headers[headerKey]);
630
- }
631
- if (data.code !== void 0) {
632
- return sanitizeErrorCode(data.code);
633
- }
634
- if (data["__type"] !== void 0) {
635
- return sanitizeErrorCode(data["__type"]);
636
- }
637
- }, "loadRestJsonErrorCode");
638
598
 
639
599
  // src/commands/GetRoutingControlStateCommand.ts
640
600
  var _GetRoutingControlStateCommand = class _GetRoutingControlStateCommand 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, withBaseException, } from "@smithy/smithy-client";
3
4
  import { AccessDeniedException, ConflictException, EndpointTemporarilyUnavailableException, InternalServerException, ResourceNotFoundException, ServiceLimitExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
@@ -222,43 +223,3 @@ function sharedHeaders(operation) {
222
223
  "x-amz-target": `ToggleCustomerAPI.${operation}`,
223
224
  };
224
225
  }
225
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
226
- if (encoded.length) {
227
- return JSON.parse(encoded);
228
- }
229
- return {};
230
- });
231
- const parseErrorBody = async (errorBody, context) => {
232
- const value = await parseBody(errorBody, context);
233
- value.message = value.message ?? value.Message;
234
- return value;
235
- };
236
- const loadRestJsonErrorCode = (output, data) => {
237
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
238
- const sanitizeErrorCode = (rawValue) => {
239
- let cleanValue = rawValue;
240
- if (typeof cleanValue === "number") {
241
- cleanValue = cleanValue.toString();
242
- }
243
- if (cleanValue.indexOf(",") >= 0) {
244
- cleanValue = cleanValue.split(",")[0];
245
- }
246
- if (cleanValue.indexOf(":") >= 0) {
247
- cleanValue = cleanValue.split(":")[0];
248
- }
249
- if (cleanValue.indexOf("#") >= 0) {
250
- cleanValue = cleanValue.split("#")[1];
251
- }
252
- return cleanValue;
253
- };
254
- const headerKey = findKey(output.headers, "x-amzn-errortype");
255
- if (headerKey !== undefined) {
256
- return sanitizeErrorCode(output.headers[headerKey]);
257
- }
258
- if (data.code !== undefined) {
259
- return sanitizeErrorCode(data.code);
260
- }
261
- if (data["__type"] !== undefined) {
262
- return sanitizeErrorCode(data["__type"]);
263
- }
264
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-route53-recovery-cluster",
3
3
  "description": "AWS SDK for JavaScript Route53 Recovery Cluster 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-route53-recovery-cluster",
@@ -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",