@aws-sdk/client-ec2-instance-connect 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
@@ -194,6 +194,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
194
194
  var import_types = require("@smithy/types");
195
195
 
196
196
  // src/protocols/Aws_json1_1.ts
197
+ var import_core2 = require("@aws-sdk/core");
197
198
 
198
199
 
199
200
 
@@ -428,7 +429,7 @@ var de_SendSerialConsoleSSHPublicKeyCommand = /* @__PURE__ */ __name(async (outp
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_SendSSHPublicKeyCommand = /* @__PURE__ */ __name(async (output, context)
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_SendSSHPublicKeyCommand = /* @__PURE__ */ __name(async (output, context)
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 "AuthException":
461
462
  case "com.amazonaws.ec2instanceconnect#AuthException":
@@ -604,7 +605,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
604
605
  extendedRequestId: output.headers["x-amz-id-2"],
605
606
  cfId: output.headers["x-amz-cf-id"]
606
607
  }), "deserializeMetadata");
607
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
608
608
  var throwDefaultError = (0, import_smithy_client.withBaseException)(EC2InstanceConnectServiceException);
609
609
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
610
610
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -631,46 +631,6 @@ function sharedHeaders(operation) {
631
631
  };
632
632
  }
633
633
  __name(sharedHeaders, "sharedHeaders");
634
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
635
- if (encoded.length) {
636
- return JSON.parse(encoded);
637
- }
638
- return {};
639
- }), "parseBody");
640
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
641
- const value = await parseBody(errorBody, context);
642
- value.message = value.message ?? value.Message;
643
- return value;
644
- }, "parseErrorBody");
645
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
646
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
647
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
648
- let cleanValue = rawValue;
649
- if (typeof cleanValue === "number") {
650
- cleanValue = cleanValue.toString();
651
- }
652
- if (cleanValue.indexOf(",") >= 0) {
653
- cleanValue = cleanValue.split(",")[0];
654
- }
655
- if (cleanValue.indexOf(":") >= 0) {
656
- cleanValue = cleanValue.split(":")[0];
657
- }
658
- if (cleanValue.indexOf("#") >= 0) {
659
- cleanValue = cleanValue.split("#")[1];
660
- }
661
- return cleanValue;
662
- }, "sanitizeErrorCode");
663
- const headerKey = findKey(output.headers, "x-amzn-errortype");
664
- if (headerKey !== void 0) {
665
- return sanitizeErrorCode(output.headers[headerKey]);
666
- }
667
- if (data.code !== void 0) {
668
- return sanitizeErrorCode(data.code);
669
- }
670
- if (data["__type"] !== void 0) {
671
- return sanitizeErrorCode(data["__type"]);
672
- }
673
- }, "loadRestJsonErrorCode");
674
634
 
675
635
  // src/commands/SendSerialConsoleSSHPublicKeyCommand.ts
676
636
  var _SendSerialConsoleSSHPublicKeyCommand = class _SendSerialConsoleSSHPublicKeyCommand 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 { EC2InstanceConnectServiceException as __BaseException } from "../models/EC2InstanceConnectServiceException";
@@ -220,43 +221,3 @@ function sharedHeaders(operation) {
220
221
  "x-amz-target": `AWSEC2InstanceConnectService.${operation}`,
221
222
  };
222
223
  }
223
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
224
- if (encoded.length) {
225
- return JSON.parse(encoded);
226
- }
227
- return {};
228
- });
229
- const parseErrorBody = async (errorBody, context) => {
230
- const value = await parseBody(errorBody, context);
231
- value.message = value.message ?? value.Message;
232
- return value;
233
- };
234
- const loadRestJsonErrorCode = (output, data) => {
235
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
236
- const sanitizeErrorCode = (rawValue) => {
237
- let cleanValue = rawValue;
238
- if (typeof cleanValue === "number") {
239
- cleanValue = cleanValue.toString();
240
- }
241
- if (cleanValue.indexOf(",") >= 0) {
242
- cleanValue = cleanValue.split(",")[0];
243
- }
244
- if (cleanValue.indexOf(":") >= 0) {
245
- cleanValue = cleanValue.split(":")[0];
246
- }
247
- if (cleanValue.indexOf("#") >= 0) {
248
- cleanValue = cleanValue.split("#")[1];
249
- }
250
- return cleanValue;
251
- };
252
- const headerKey = findKey(output.headers, "x-amzn-errortype");
253
- if (headerKey !== undefined) {
254
- return sanitizeErrorCode(output.headers[headerKey]);
255
- }
256
- if (data.code !== undefined) {
257
- return sanitizeErrorCode(data.code);
258
- }
259
- if (data["__type"] !== undefined) {
260
- return sanitizeErrorCode(data["__type"]);
261
- }
262
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-ec2-instance-connect",
3
3
  "description": "AWS SDK for JavaScript Ec2 Instance Connect 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-ec2-instance-connect",
@@ -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",