@aws-sdk/client-cloudtrail-data 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 +4 -44
- package/dist-es/protocols/Aws_restJson1.js +1 -40
- package/package.json +4 -4
package/dist-cjs/index.js
CHANGED
|
@@ -190,6 +190,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
|
|
|
190
190
|
var import_types = require("@smithy/types");
|
|
191
191
|
|
|
192
192
|
// src/protocols/Aws_restJson1.ts
|
|
193
|
+
var import_core2 = require("@aws-sdk/core");
|
|
193
194
|
|
|
194
195
|
|
|
195
196
|
|
|
@@ -338,7 +339,7 @@ var de_PutAuditEventsCommand = /* @__PURE__ */ __name(async (output, context) =>
|
|
|
338
339
|
const contents = (0, import_smithy_client.map)({
|
|
339
340
|
$metadata: deserializeMetadata(output)
|
|
340
341
|
});
|
|
341
|
-
const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await
|
|
342
|
+
const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
|
|
342
343
|
const doc = (0, import_smithy_client.take)(data, {
|
|
343
344
|
failed: import_smithy_client._json,
|
|
344
345
|
successful: import_smithy_client._json
|
|
@@ -349,9 +350,9 @@ var de_PutAuditEventsCommand = /* @__PURE__ */ __name(async (output, context) =>
|
|
|
349
350
|
var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
|
|
350
351
|
const parsedOutput = {
|
|
351
352
|
...output,
|
|
352
|
-
body: await
|
|
353
|
+
body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
|
|
353
354
|
};
|
|
354
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
355
|
+
const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
|
|
355
356
|
switch (errorCode) {
|
|
356
357
|
case "ChannelInsufficientPermission":
|
|
357
358
|
case "com.amazonaws.cloudtraildata#ChannelInsufficientPermission":
|
|
@@ -465,49 +466,8 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
|
|
|
465
466
|
extendedRequestId: output.headers["x-amz-id-2"],
|
|
466
467
|
cfId: output.headers["x-amz-cf-id"]
|
|
467
468
|
}), "deserializeMetadata");
|
|
468
|
-
var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
|
|
469
469
|
var _cA = "channelArn";
|
|
470
470
|
var _eI = "externalId";
|
|
471
|
-
var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
472
|
-
if (encoded.length) {
|
|
473
|
-
return JSON.parse(encoded);
|
|
474
|
-
}
|
|
475
|
-
return {};
|
|
476
|
-
}), "parseBody");
|
|
477
|
-
var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
|
|
478
|
-
const value = await parseBody(errorBody, context);
|
|
479
|
-
value.message = value.message ?? value.Message;
|
|
480
|
-
return value;
|
|
481
|
-
}, "parseErrorBody");
|
|
482
|
-
var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
|
|
483
|
-
const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
|
|
484
|
-
const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
|
|
485
|
-
let cleanValue = rawValue;
|
|
486
|
-
if (typeof cleanValue === "number") {
|
|
487
|
-
cleanValue = cleanValue.toString();
|
|
488
|
-
}
|
|
489
|
-
if (cleanValue.indexOf(",") >= 0) {
|
|
490
|
-
cleanValue = cleanValue.split(",")[0];
|
|
491
|
-
}
|
|
492
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
493
|
-
cleanValue = cleanValue.split(":")[0];
|
|
494
|
-
}
|
|
495
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
496
|
-
cleanValue = cleanValue.split("#")[1];
|
|
497
|
-
}
|
|
498
|
-
return cleanValue;
|
|
499
|
-
}, "sanitizeErrorCode");
|
|
500
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
501
|
-
if (headerKey !== void 0) {
|
|
502
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
503
|
-
}
|
|
504
|
-
if (data.code !== void 0) {
|
|
505
|
-
return sanitizeErrorCode(data.code);
|
|
506
|
-
}
|
|
507
|
-
if (data["__type"] !== void 0) {
|
|
508
|
-
return sanitizeErrorCode(data["__type"]);
|
|
509
|
-
}
|
|
510
|
-
}, "loadRestJsonErrorCode");
|
|
511
471
|
|
|
512
472
|
// src/commands/PutAuditEventsCommand.ts
|
|
513
473
|
var _PutAuditEventsCommand = class _PutAuditEventsCommand 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, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException, } from "@smithy/smithy-client";
|
|
3
4
|
import { CloudTrailDataServiceException as __BaseException } from "../models/CloudTrailDataServiceException";
|
|
@@ -161,43 +162,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
|
161
162
|
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
162
163
|
const _cA = "channelArn";
|
|
163
164
|
const _eI = "externalId";
|
|
164
|
-
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
165
|
-
if (encoded.length) {
|
|
166
|
-
return JSON.parse(encoded);
|
|
167
|
-
}
|
|
168
|
-
return {};
|
|
169
|
-
});
|
|
170
|
-
const parseErrorBody = async (errorBody, context) => {
|
|
171
|
-
const value = await parseBody(errorBody, context);
|
|
172
|
-
value.message = value.message ?? value.Message;
|
|
173
|
-
return value;
|
|
174
|
-
};
|
|
175
|
-
const loadRestJsonErrorCode = (output, data) => {
|
|
176
|
-
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
177
|
-
const sanitizeErrorCode = (rawValue) => {
|
|
178
|
-
let cleanValue = rawValue;
|
|
179
|
-
if (typeof cleanValue === "number") {
|
|
180
|
-
cleanValue = cleanValue.toString();
|
|
181
|
-
}
|
|
182
|
-
if (cleanValue.indexOf(",") >= 0) {
|
|
183
|
-
cleanValue = cleanValue.split(",")[0];
|
|
184
|
-
}
|
|
185
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
186
|
-
cleanValue = cleanValue.split(":")[0];
|
|
187
|
-
}
|
|
188
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
189
|
-
cleanValue = cleanValue.split("#")[1];
|
|
190
|
-
}
|
|
191
|
-
return cleanValue;
|
|
192
|
-
};
|
|
193
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
194
|
-
if (headerKey !== undefined) {
|
|
195
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
196
|
-
}
|
|
197
|
-
if (data.code !== undefined) {
|
|
198
|
-
return sanitizeErrorCode(data.code);
|
|
199
|
-
}
|
|
200
|
-
if (data["__type"] !== undefined) {
|
|
201
|
-
return sanitizeErrorCode(data["__type"]);
|
|
202
|
-
}
|
|
203
|
-
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/client-cloudtrail-data",
|
|
3
3
|
"description": "AWS SDK for JavaScript Cloudtrail Data Client for Node.js, Browser and React Native",
|
|
4
|
-
"version": "3.
|
|
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-cloudtrail-data",
|
|
@@ -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.
|
|
24
|
-
"@aws-sdk/core": "3.
|
|
25
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
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",
|