@aws-sdk/client-networkmonitor 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
@@ -205,6 +205,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
205
205
  var import_types = require("@smithy/types");
206
206
 
207
207
  // src/protocols/Aws_restJson1.ts
208
+ var import_core2 = require("@aws-sdk/core");
208
209
 
209
210
 
210
211
  var import_uuid = require("uuid");
@@ -544,7 +545,7 @@ var de_CreateMonitorCommand = /* @__PURE__ */ __name(async (output, context) =>
544
545
  const contents = (0, import_smithy_client.map)({
545
546
  $metadata: deserializeMetadata(output)
546
547
  });
547
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
548
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
548
549
  const doc = (0, import_smithy_client.take)(data, {
549
550
  aggregationPeriod: import_smithy_client.expectLong,
550
551
  monitorArn: import_smithy_client.expectString,
@@ -562,7 +563,7 @@ var de_CreateProbeCommand = /* @__PURE__ */ __name(async (output, context) => {
562
563
  const contents = (0, import_smithy_client.map)({
563
564
  $metadata: deserializeMetadata(output)
564
565
  });
565
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
566
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
566
567
  const doc = (0, import_smithy_client.take)(data, {
567
568
  addressFamily: import_smithy_client.expectString,
568
569
  createdAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseEpochTimestamp)((0, import_smithy_client.expectNumber)(_))),
@@ -608,7 +609,7 @@ var de_GetMonitorCommand = /* @__PURE__ */ __name(async (output, context) => {
608
609
  const contents = (0, import_smithy_client.map)({
609
610
  $metadata: deserializeMetadata(output)
610
611
  });
611
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
612
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
612
613
  const doc = (0, import_smithy_client.take)(data, {
613
614
  aggregationPeriod: import_smithy_client.expectLong,
614
615
  createdAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseEpochTimestamp)((0, import_smithy_client.expectNumber)(_))),
@@ -629,7 +630,7 @@ var de_GetProbeCommand = /* @__PURE__ */ __name(async (output, context) => {
629
630
  const contents = (0, import_smithy_client.map)({
630
631
  $metadata: deserializeMetadata(output)
631
632
  });
632
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
633
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
633
634
  const doc = (0, import_smithy_client.take)(data, {
634
635
  addressFamily: import_smithy_client.expectString,
635
636
  createdAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseEpochTimestamp)((0, import_smithy_client.expectNumber)(_))),
@@ -655,7 +656,7 @@ var de_ListMonitorsCommand = /* @__PURE__ */ __name(async (output, context) => {
655
656
  const contents = (0, import_smithy_client.map)({
656
657
  $metadata: deserializeMetadata(output)
657
658
  });
658
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
659
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
659
660
  const doc = (0, import_smithy_client.take)(data, {
660
661
  monitors: import_smithy_client._json,
661
662
  nextToken: import_smithy_client.expectString
@@ -670,7 +671,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
670
671
  const contents = (0, import_smithy_client.map)({
671
672
  $metadata: deserializeMetadata(output)
672
673
  });
673
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
674
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
674
675
  const doc = (0, import_smithy_client.take)(data, {
675
676
  tags: import_smithy_client._json
676
677
  });
@@ -704,7 +705,7 @@ var de_UpdateMonitorCommand = /* @__PURE__ */ __name(async (output, context) =>
704
705
  const contents = (0, import_smithy_client.map)({
705
706
  $metadata: deserializeMetadata(output)
706
707
  });
707
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
708
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
708
709
  const doc = (0, import_smithy_client.take)(data, {
709
710
  aggregationPeriod: import_smithy_client.expectLong,
710
711
  monitorArn: import_smithy_client.expectString,
@@ -722,7 +723,7 @@ var de_UpdateProbeCommand = /* @__PURE__ */ __name(async (output, context) => {
722
723
  const contents = (0, import_smithy_client.map)({
723
724
  $metadata: deserializeMetadata(output)
724
725
  });
725
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
726
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
726
727
  const doc = (0, import_smithy_client.take)(data, {
727
728
  addressFamily: import_smithy_client.expectString,
728
729
  createdAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseEpochTimestamp)((0, import_smithy_client.expectNumber)(_))),
@@ -744,9 +745,9 @@ var de_UpdateProbeCommand = /* @__PURE__ */ __name(async (output, context) => {
744
745
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
745
746
  const parsedOutput = {
746
747
  ...output,
747
- body: await parseErrorBody(output.body, context)
748
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
748
749
  };
749
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
750
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
750
751
  switch (errorCode) {
751
752
  case "AccessDeniedException":
752
753
  case "com.amazonaws.networkmonitor#AccessDeniedException":
@@ -899,51 +900,10 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
899
900
  extendedRequestId: output.headers["x-amz-id-2"],
900
901
  cfId: output.headers["x-amz-cf-id"]
901
902
  }), "deserializeMetadata");
902
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
903
903
  var _mR = "maxResults";
904
904
  var _nT = "nextToken";
905
905
  var _s = "state";
906
906
  var _tK = "tagKeys";
907
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
908
- if (encoded.length) {
909
- return JSON.parse(encoded);
910
- }
911
- return {};
912
- }), "parseBody");
913
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
914
- const value = await parseBody(errorBody, context);
915
- value.message = value.message ?? value.Message;
916
- return value;
917
- }, "parseErrorBody");
918
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
919
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
920
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
921
- let cleanValue = rawValue;
922
- if (typeof cleanValue === "number") {
923
- cleanValue = cleanValue.toString();
924
- }
925
- if (cleanValue.indexOf(",") >= 0) {
926
- cleanValue = cleanValue.split(",")[0];
927
- }
928
- if (cleanValue.indexOf(":") >= 0) {
929
- cleanValue = cleanValue.split(":")[0];
930
- }
931
- if (cleanValue.indexOf("#") >= 0) {
932
- cleanValue = cleanValue.split("#")[1];
933
- }
934
- return cleanValue;
935
- }, "sanitizeErrorCode");
936
- const headerKey = findKey(output.headers, "x-amzn-errortype");
937
- if (headerKey !== void 0) {
938
- return sanitizeErrorCode(output.headers[headerKey]);
939
- }
940
- if (data.code !== void 0) {
941
- return sanitizeErrorCode(data.code);
942
- }
943
- if (data["__type"] !== void 0) {
944
- return sanitizeErrorCode(data["__type"]);
945
- }
946
- }, "loadRestJsonErrorCode");
947
907
 
948
908
  // src/commands/CreateMonitorCommand.ts
949
909
  var _CreateMonitorCommand = class _CreateMonitorCommand 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 { requestBuilder as rb } from "@smithy/core";
2
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { v4 as generateIdempotencyToken } from "uuid";
@@ -532,43 +533,3 @@ const _mR = "maxResults";
532
533
  const _nT = "nextToken";
533
534
  const _s = "state";
534
535
  const _tK = "tagKeys";
535
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
536
- if (encoded.length) {
537
- return JSON.parse(encoded);
538
- }
539
- return {};
540
- });
541
- const parseErrorBody = async (errorBody, context) => {
542
- const value = await parseBody(errorBody, context);
543
- value.message = value.message ?? value.Message;
544
- return value;
545
- };
546
- const loadRestJsonErrorCode = (output, data) => {
547
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
548
- const sanitizeErrorCode = (rawValue) => {
549
- let cleanValue = rawValue;
550
- if (typeof cleanValue === "number") {
551
- cleanValue = cleanValue.toString();
552
- }
553
- if (cleanValue.indexOf(",") >= 0) {
554
- cleanValue = cleanValue.split(",")[0];
555
- }
556
- if (cleanValue.indexOf(":") >= 0) {
557
- cleanValue = cleanValue.split(":")[0];
558
- }
559
- if (cleanValue.indexOf("#") >= 0) {
560
- cleanValue = cleanValue.split("#")[1];
561
- }
562
- return cleanValue;
563
- };
564
- const headerKey = findKey(output.headers, "x-amzn-errortype");
565
- if (headerKey !== undefined) {
566
- return sanitizeErrorCode(output.headers[headerKey]);
567
- }
568
- if (data.code !== undefined) {
569
- return sanitizeErrorCode(data.code);
570
- }
571
- if (data["__type"] !== undefined) {
572
- return sanitizeErrorCode(data["__type"]);
573
- }
574
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-networkmonitor",
3
3
  "description": "AWS SDK for JavaScript Networkmonitor 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-networkmonitor",
@@ -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",