@aws-sdk/client-iotsecuretunneling 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
@@ -197,6 +197,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
197
197
  var import_types = require("@smithy/types");
198
198
 
199
199
  // src/protocols/Aws_json1_1.ts
200
+ var import_core2 = require("@aws-sdk/core");
200
201
 
201
202
 
202
203
 
@@ -327,7 +328,7 @@ var de_CloseTunnelCommand = /* @__PURE__ */ __name(async (output, context) => {
327
328
  if (output.statusCode >= 300) {
328
329
  return de_CommandError(output, context);
329
330
  }
330
- const data = await parseBody(output.body, context);
331
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
331
332
  let contents = {};
332
333
  contents = (0, import_smithy_client._json)(data);
333
334
  const response = {
@@ -340,7 +341,7 @@ var de_DescribeTunnelCommand = /* @__PURE__ */ __name(async (output, context) =>
340
341
  if (output.statusCode >= 300) {
341
342
  return de_CommandError(output, context);
342
343
  }
343
- const data = await parseBody(output.body, context);
344
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
344
345
  let contents = {};
345
346
  contents = de_DescribeTunnelResponse(data, context);
346
347
  const response = {
@@ -353,7 +354,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
353
354
  if (output.statusCode >= 300) {
354
355
  return de_CommandError(output, context);
355
356
  }
356
- const data = await parseBody(output.body, context);
357
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
357
358
  let contents = {};
358
359
  contents = (0, import_smithy_client._json)(data);
359
360
  const response = {
@@ -366,7 +367,7 @@ var de_ListTunnelsCommand = /* @__PURE__ */ __name(async (output, context) => {
366
367
  if (output.statusCode >= 300) {
367
368
  return de_CommandError(output, context);
368
369
  }
369
- const data = await parseBody(output.body, context);
370
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
370
371
  let contents = {};
371
372
  contents = de_ListTunnelsResponse(data, context);
372
373
  const response = {
@@ -379,7 +380,7 @@ var de_OpenTunnelCommand = /* @__PURE__ */ __name(async (output, context) => {
379
380
  if (output.statusCode >= 300) {
380
381
  return de_CommandError(output, context);
381
382
  }
382
- const data = await parseBody(output.body, context);
383
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
383
384
  let contents = {};
384
385
  contents = (0, import_smithy_client._json)(data);
385
386
  const response = {
@@ -392,7 +393,7 @@ var de_RotateTunnelAccessTokenCommand = /* @__PURE__ */ __name(async (output, co
392
393
  if (output.statusCode >= 300) {
393
394
  return de_CommandError(output, context);
394
395
  }
395
- const data = await parseBody(output.body, context);
396
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
396
397
  let contents = {};
397
398
  contents = (0, import_smithy_client._json)(data);
398
399
  const response = {
@@ -405,7 +406,7 @@ var de_TagResourceCommand = /* @__PURE__ */ __name(async (output, context) => {
405
406
  if (output.statusCode >= 300) {
406
407
  return de_CommandError(output, context);
407
408
  }
408
- const data = await parseBody(output.body, context);
409
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
409
410
  let contents = {};
410
411
  contents = (0, import_smithy_client._json)(data);
411
412
  const response = {
@@ -418,7 +419,7 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
418
419
  if (output.statusCode >= 300) {
419
420
  return de_CommandError(output, context);
420
421
  }
421
- const data = await parseBody(output.body, context);
422
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
422
423
  let contents = {};
423
424
  contents = (0, import_smithy_client._json)(data);
424
425
  const response = {
@@ -430,9 +431,9 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
430
431
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
431
432
  const parsedOutput = {
432
433
  ...output,
433
- body: await parseErrorBody(output.body, context)
434
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
434
435
  };
435
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
436
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
436
437
  switch (errorCode) {
437
438
  case "ResourceNotFoundException":
438
439
  case "com.amazonaws.iotsecuretunneling#ResourceNotFoundException":
@@ -521,7 +522,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
521
522
  extendedRequestId: output.headers["x-amz-id-2"],
522
523
  cfId: output.headers["x-amz-cf-id"]
523
524
  }), "deserializeMetadata");
524
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
525
525
  var throwDefaultError = (0, import_smithy_client.withBaseException)(IoTSecureTunnelingServiceException);
526
526
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
527
527
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -548,46 +548,6 @@ function sharedHeaders(operation) {
548
548
  };
549
549
  }
550
550
  __name(sharedHeaders, "sharedHeaders");
551
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
552
- if (encoded.length) {
553
- return JSON.parse(encoded);
554
- }
555
- return {};
556
- }), "parseBody");
557
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
558
- const value = await parseBody(errorBody, context);
559
- value.message = value.message ?? value.Message;
560
- return value;
561
- }, "parseErrorBody");
562
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
563
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
564
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
565
- let cleanValue = rawValue;
566
- if (typeof cleanValue === "number") {
567
- cleanValue = cleanValue.toString();
568
- }
569
- if (cleanValue.indexOf(",") >= 0) {
570
- cleanValue = cleanValue.split(",")[0];
571
- }
572
- if (cleanValue.indexOf(":") >= 0) {
573
- cleanValue = cleanValue.split(":")[0];
574
- }
575
- if (cleanValue.indexOf("#") >= 0) {
576
- cleanValue = cleanValue.split("#")[1];
577
- }
578
- return cleanValue;
579
- }, "sanitizeErrorCode");
580
- const headerKey = findKey(output.headers, "x-amzn-errortype");
581
- if (headerKey !== void 0) {
582
- return sanitizeErrorCode(output.headers[headerKey]);
583
- }
584
- if (data.code !== void 0) {
585
- return sanitizeErrorCode(data.code);
586
- }
587
- if (data["__type"] !== void 0) {
588
- return sanitizeErrorCode(data["__type"]);
589
- }
590
- }, "loadRestJsonErrorCode");
591
551
 
592
552
  // src/commands/CloseTunnelCommand.ts
593
553
  var _CloseTunnelCommand = class _CloseTunnelCommand 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 { IoTSecureTunnelingServiceException as __BaseException } from "../models/IoTSecureTunnelingServiceException";
@@ -276,43 +277,3 @@ function sharedHeaders(operation) {
276
277
  "x-amz-target": `IoTSecuredTunneling.${operation}`,
277
278
  };
278
279
  }
279
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
280
- if (encoded.length) {
281
- return JSON.parse(encoded);
282
- }
283
- return {};
284
- });
285
- const parseErrorBody = async (errorBody, context) => {
286
- const value = await parseBody(errorBody, context);
287
- value.message = value.message ?? value.Message;
288
- return value;
289
- };
290
- const loadRestJsonErrorCode = (output, data) => {
291
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
292
- const sanitizeErrorCode = (rawValue) => {
293
- let cleanValue = rawValue;
294
- if (typeof cleanValue === "number") {
295
- cleanValue = cleanValue.toString();
296
- }
297
- if (cleanValue.indexOf(",") >= 0) {
298
- cleanValue = cleanValue.split(",")[0];
299
- }
300
- if (cleanValue.indexOf(":") >= 0) {
301
- cleanValue = cleanValue.split(":")[0];
302
- }
303
- if (cleanValue.indexOf("#") >= 0) {
304
- cleanValue = cleanValue.split("#")[1];
305
- }
306
- return cleanValue;
307
- };
308
- const headerKey = findKey(output.headers, "x-amzn-errortype");
309
- if (headerKey !== undefined) {
310
- return sanitizeErrorCode(output.headers[headerKey]);
311
- }
312
- if (data.code !== undefined) {
313
- return sanitizeErrorCode(data.code);
314
- }
315
- if (data["__type"] !== undefined) {
316
- return sanitizeErrorCode(data["__type"]);
317
- }
318
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-iotsecuretunneling",
3
3
  "description": "AWS SDK for JavaScript Iotsecuretunneling 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-iotsecuretunneling",
@@ -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",