@aws-sdk/client-cloudtrail-data 3.262.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.
Files changed (67) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +210 -0
  3. package/dist-cjs/CloudTrailData.js +22 -0
  4. package/dist-cjs/CloudTrailDataClient.js +40 -0
  5. package/dist-cjs/commands/PutAuditEventsCommand.js +46 -0
  6. package/dist-cjs/commands/index.js +4 -0
  7. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  8. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  9. package/dist-cjs/endpoint/ruleset.js +7 -0
  10. package/dist-cjs/index.js +10 -0
  11. package/dist-cjs/models/CloudTrailDataServiceException.js +11 -0
  12. package/dist-cjs/models/index.js +4 -0
  13. package/dist-cjs/models/models_0.js +102 -0
  14. package/dist-cjs/protocols/Aws_restJson1.js +265 -0
  15. package/dist-cjs/runtimeConfig.browser.js +39 -0
  16. package/dist-cjs/runtimeConfig.js +48 -0
  17. package/dist-cjs/runtimeConfig.native.js +15 -0
  18. package/dist-cjs/runtimeConfig.shared.js +21 -0
  19. package/dist-es/CloudTrailData.js +18 -0
  20. package/dist-es/CloudTrailDataClient.js +36 -0
  21. package/dist-es/commands/PutAuditEventsCommand.js +42 -0
  22. package/dist-es/commands/index.js +1 -0
  23. package/dist-es/endpoint/EndpointParameters.js +8 -0
  24. package/dist-es/endpoint/endpointResolver.js +8 -0
  25. package/dist-es/endpoint/ruleset.js +4 -0
  26. package/dist-es/index.js +5 -0
  27. package/dist-es/models/CloudTrailDataServiceException.js +7 -0
  28. package/dist-es/models/index.js +1 -0
  29. package/dist-es/models/models_0.js +88 -0
  30. package/dist-es/protocols/Aws_restJson1.js +260 -0
  31. package/dist-es/runtimeConfig.browser.js +34 -0
  32. package/dist-es/runtimeConfig.js +43 -0
  33. package/dist-es/runtimeConfig.native.js +11 -0
  34. package/dist-es/runtimeConfig.shared.js +17 -0
  35. package/dist-types/CloudTrailData.d.ts +23 -0
  36. package/dist-types/CloudTrailDataClient.d.ts +147 -0
  37. package/dist-types/commands/PutAuditEventsCommand.d.ts +41 -0
  38. package/dist-types/commands/index.d.ts +1 -0
  39. package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
  40. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  41. package/dist-types/endpoint/ruleset.d.ts +2 -0
  42. package/dist-types/index.d.ts +5 -0
  43. package/dist-types/models/CloudTrailDataServiceException.d.ts +10 -0
  44. package/dist-types/models/index.d.ts +1 -0
  45. package/dist-types/models/models_0.d.ts +174 -0
  46. package/dist-types/protocols/Aws_restJson1.d.ts +5 -0
  47. package/dist-types/runtimeConfig.browser.d.ts +42 -0
  48. package/dist-types/runtimeConfig.d.ts +42 -0
  49. package/dist-types/runtimeConfig.native.d.ts +41 -0
  50. package/dist-types/runtimeConfig.shared.d.ts +18 -0
  51. package/dist-types/ts3.4/CloudTrailData.d.ts +21 -0
  52. package/dist-types/ts3.4/CloudTrailDataClient.d.ts +117 -0
  53. package/dist-types/ts3.4/commands/PutAuditEventsCommand.d.ts +37 -0
  54. package/dist-types/ts3.4/commands/index.d.ts +1 -0
  55. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +34 -0
  56. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  57. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  58. package/dist-types/ts3.4/index.d.ts +5 -0
  59. package/dist-types/ts3.4/models/CloudTrailDataServiceException.d.ts +7 -0
  60. package/dist-types/ts3.4/models/index.d.ts +1 -0
  61. package/dist-types/ts3.4/models/models_0.d.ts +76 -0
  62. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +17 -0
  63. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +91 -0
  64. package/dist-types/ts3.4/runtimeConfig.d.ts +91 -0
  65. package/dist-types/ts3.4/runtimeConfig.native.d.ts +80 -0
  66. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +18 -0
  67. package/package.json +102 -0
@@ -0,0 +1,88 @@
1
+ import { CloudTrailDataServiceException as __BaseException } from "./CloudTrailDataServiceException";
2
+ export class ChannelInsufficientPermission extends __BaseException {
3
+ constructor(opts) {
4
+ super({
5
+ name: "ChannelInsufficientPermission",
6
+ $fault: "client",
7
+ ...opts,
8
+ });
9
+ this.name = "ChannelInsufficientPermission";
10
+ this.$fault = "client";
11
+ Object.setPrototypeOf(this, ChannelInsufficientPermission.prototype);
12
+ }
13
+ }
14
+ export class ChannelNotFound extends __BaseException {
15
+ constructor(opts) {
16
+ super({
17
+ name: "ChannelNotFound",
18
+ $fault: "client",
19
+ ...opts,
20
+ });
21
+ this.name = "ChannelNotFound";
22
+ this.$fault = "client";
23
+ Object.setPrototypeOf(this, ChannelNotFound.prototype);
24
+ }
25
+ }
26
+ export class ChannelUnsupportedSchema extends __BaseException {
27
+ constructor(opts) {
28
+ super({
29
+ name: "ChannelUnsupportedSchema",
30
+ $fault: "client",
31
+ ...opts,
32
+ });
33
+ this.name = "ChannelUnsupportedSchema";
34
+ this.$fault = "client";
35
+ Object.setPrototypeOf(this, ChannelUnsupportedSchema.prototype);
36
+ }
37
+ }
38
+ export class DuplicatedAuditEventId extends __BaseException {
39
+ constructor(opts) {
40
+ super({
41
+ name: "DuplicatedAuditEventId",
42
+ $fault: "client",
43
+ ...opts,
44
+ });
45
+ this.name = "DuplicatedAuditEventId";
46
+ this.$fault = "client";
47
+ Object.setPrototypeOf(this, DuplicatedAuditEventId.prototype);
48
+ }
49
+ }
50
+ export class InvalidChannelARN extends __BaseException {
51
+ constructor(opts) {
52
+ super({
53
+ name: "InvalidChannelARN",
54
+ $fault: "client",
55
+ ...opts,
56
+ });
57
+ this.name = "InvalidChannelARN";
58
+ this.$fault = "client";
59
+ Object.setPrototypeOf(this, InvalidChannelARN.prototype);
60
+ }
61
+ }
62
+ export class UnsupportedOperationException extends __BaseException {
63
+ constructor(opts) {
64
+ super({
65
+ name: "UnsupportedOperationException",
66
+ $fault: "client",
67
+ ...opts,
68
+ });
69
+ this.name = "UnsupportedOperationException";
70
+ this.$fault = "client";
71
+ Object.setPrototypeOf(this, UnsupportedOperationException.prototype);
72
+ }
73
+ }
74
+ export const AuditEventFilterSensitiveLog = (obj) => ({
75
+ ...obj,
76
+ });
77
+ export const AuditEventResultEntryFilterSensitiveLog = (obj) => ({
78
+ ...obj,
79
+ });
80
+ export const PutAuditEventsRequestFilterSensitiveLog = (obj) => ({
81
+ ...obj,
82
+ });
83
+ export const ResultErrorEntryFilterSensitiveLog = (obj) => ({
84
+ ...obj,
85
+ });
86
+ export const PutAuditEventsResponseFilterSensitiveLog = (obj) => ({
87
+ ...obj,
88
+ });
@@ -0,0 +1,260 @@
1
+ import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
+ import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
3
+ import { CloudTrailDataServiceException as __BaseException } from "../models/CloudTrailDataServiceException";
4
+ import { ChannelInsufficientPermission, ChannelNotFound, ChannelUnsupportedSchema, DuplicatedAuditEventId, InvalidChannelARN, UnsupportedOperationException, } from "../models/models_0";
5
+ export const serializeAws_restJson1PutAuditEventsCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {
8
+ "content-type": "application/json",
9
+ };
10
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutAuditEvents";
11
+ const query = map({
12
+ channelArn: [, __expectNonNull(input.channelArn, `channelArn`)],
13
+ externalId: [, input.externalId],
14
+ });
15
+ let body;
16
+ body = JSON.stringify({
17
+ ...(input.auditEvents != null && { auditEvents: serializeAws_restJson1AuditEvents(input.auditEvents, context) }),
18
+ });
19
+ return new __HttpRequest({
20
+ protocol,
21
+ hostname,
22
+ port,
23
+ method: "POST",
24
+ headers,
25
+ path: resolvedPath,
26
+ query,
27
+ body,
28
+ });
29
+ };
30
+ export const deserializeAws_restJson1PutAuditEventsCommand = async (output, context) => {
31
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
32
+ return deserializeAws_restJson1PutAuditEventsCommandError(output, context);
33
+ }
34
+ const contents = map({
35
+ $metadata: deserializeMetadata(output),
36
+ });
37
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
38
+ if (data.failed != null) {
39
+ contents.failed = deserializeAws_restJson1ResultErrorEntries(data.failed, context);
40
+ }
41
+ if (data.successful != null) {
42
+ contents.successful = deserializeAws_restJson1AuditEventResultEntries(data.successful, context);
43
+ }
44
+ return contents;
45
+ };
46
+ const deserializeAws_restJson1PutAuditEventsCommandError = async (output, context) => {
47
+ const parsedOutput = {
48
+ ...output,
49
+ body: await parseErrorBody(output.body, context),
50
+ };
51
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
52
+ switch (errorCode) {
53
+ case "ChannelInsufficientPermission":
54
+ case "com.amazonaws.cloudtraildata#ChannelInsufficientPermission":
55
+ throw await deserializeAws_restJson1ChannelInsufficientPermissionResponse(parsedOutput, context);
56
+ case "ChannelNotFound":
57
+ case "com.amazonaws.cloudtraildata#ChannelNotFound":
58
+ throw await deserializeAws_restJson1ChannelNotFoundResponse(parsedOutput, context);
59
+ case "ChannelUnsupportedSchema":
60
+ case "com.amazonaws.cloudtraildata#ChannelUnsupportedSchema":
61
+ throw await deserializeAws_restJson1ChannelUnsupportedSchemaResponse(parsedOutput, context);
62
+ case "DuplicatedAuditEventId":
63
+ case "com.amazonaws.cloudtraildata#DuplicatedAuditEventId":
64
+ throw await deserializeAws_restJson1DuplicatedAuditEventIdResponse(parsedOutput, context);
65
+ case "InvalidChannelARN":
66
+ case "com.amazonaws.cloudtraildata#InvalidChannelARN":
67
+ throw await deserializeAws_restJson1InvalidChannelARNResponse(parsedOutput, context);
68
+ case "UnsupportedOperationException":
69
+ case "com.amazonaws.cloudtraildata#UnsupportedOperationException":
70
+ throw await deserializeAws_restJson1UnsupportedOperationExceptionResponse(parsedOutput, context);
71
+ default:
72
+ const parsedBody = parsedOutput.body;
73
+ throwDefaultError({
74
+ output,
75
+ parsedBody,
76
+ exceptionCtor: __BaseException,
77
+ errorCode,
78
+ });
79
+ }
80
+ };
81
+ const map = __map;
82
+ const deserializeAws_restJson1ChannelInsufficientPermissionResponse = async (parsedOutput, context) => {
83
+ const contents = map({});
84
+ const data = parsedOutput.body;
85
+ if (data.message != null) {
86
+ contents.message = __expectString(data.message);
87
+ }
88
+ const exception = new ChannelInsufficientPermission({
89
+ $metadata: deserializeMetadata(parsedOutput),
90
+ ...contents,
91
+ });
92
+ return __decorateServiceException(exception, parsedOutput.body);
93
+ };
94
+ const deserializeAws_restJson1ChannelNotFoundResponse = async (parsedOutput, context) => {
95
+ const contents = map({});
96
+ const data = parsedOutput.body;
97
+ if (data.message != null) {
98
+ contents.message = __expectString(data.message);
99
+ }
100
+ const exception = new ChannelNotFound({
101
+ $metadata: deserializeMetadata(parsedOutput),
102
+ ...contents,
103
+ });
104
+ return __decorateServiceException(exception, parsedOutput.body);
105
+ };
106
+ const deserializeAws_restJson1ChannelUnsupportedSchemaResponse = async (parsedOutput, context) => {
107
+ const contents = map({});
108
+ const data = parsedOutput.body;
109
+ if (data.message != null) {
110
+ contents.message = __expectString(data.message);
111
+ }
112
+ const exception = new ChannelUnsupportedSchema({
113
+ $metadata: deserializeMetadata(parsedOutput),
114
+ ...contents,
115
+ });
116
+ return __decorateServiceException(exception, parsedOutput.body);
117
+ };
118
+ const deserializeAws_restJson1DuplicatedAuditEventIdResponse = async (parsedOutput, context) => {
119
+ const contents = map({});
120
+ const data = parsedOutput.body;
121
+ if (data.message != null) {
122
+ contents.message = __expectString(data.message);
123
+ }
124
+ const exception = new DuplicatedAuditEventId({
125
+ $metadata: deserializeMetadata(parsedOutput),
126
+ ...contents,
127
+ });
128
+ return __decorateServiceException(exception, parsedOutput.body);
129
+ };
130
+ const deserializeAws_restJson1InvalidChannelARNResponse = async (parsedOutput, context) => {
131
+ const contents = map({});
132
+ const data = parsedOutput.body;
133
+ if (data.message != null) {
134
+ contents.message = __expectString(data.message);
135
+ }
136
+ const exception = new InvalidChannelARN({
137
+ $metadata: deserializeMetadata(parsedOutput),
138
+ ...contents,
139
+ });
140
+ return __decorateServiceException(exception, parsedOutput.body);
141
+ };
142
+ const deserializeAws_restJson1UnsupportedOperationExceptionResponse = async (parsedOutput, context) => {
143
+ const contents = map({});
144
+ const data = parsedOutput.body;
145
+ if (data.message != null) {
146
+ contents.message = __expectString(data.message);
147
+ }
148
+ const exception = new UnsupportedOperationException({
149
+ $metadata: deserializeMetadata(parsedOutput),
150
+ ...contents,
151
+ });
152
+ return __decorateServiceException(exception, parsedOutput.body);
153
+ };
154
+ const serializeAws_restJson1AuditEvent = (input, context) => {
155
+ return {
156
+ ...(input.eventData != null && { eventData: input.eventData }),
157
+ ...(input.eventDataChecksum != null && { eventDataChecksum: input.eventDataChecksum }),
158
+ ...(input.id != null && { id: input.id }),
159
+ };
160
+ };
161
+ const serializeAws_restJson1AuditEvents = (input, context) => {
162
+ return input
163
+ .filter((e) => e != null)
164
+ .map((entry) => {
165
+ return serializeAws_restJson1AuditEvent(entry, context);
166
+ });
167
+ };
168
+ const deserializeAws_restJson1AuditEventResultEntries = (output, context) => {
169
+ const retVal = (output || [])
170
+ .filter((e) => e != null)
171
+ .map((entry) => {
172
+ if (entry === null) {
173
+ return null;
174
+ }
175
+ return deserializeAws_restJson1AuditEventResultEntry(entry, context);
176
+ });
177
+ return retVal;
178
+ };
179
+ const deserializeAws_restJson1AuditEventResultEntry = (output, context) => {
180
+ return {
181
+ eventID: __expectString(output.eventID),
182
+ id: __expectString(output.id),
183
+ };
184
+ };
185
+ const deserializeAws_restJson1ResultErrorEntries = (output, context) => {
186
+ const retVal = (output || [])
187
+ .filter((e) => e != null)
188
+ .map((entry) => {
189
+ if (entry === null) {
190
+ return null;
191
+ }
192
+ return deserializeAws_restJson1ResultErrorEntry(entry, context);
193
+ });
194
+ return retVal;
195
+ };
196
+ const deserializeAws_restJson1ResultErrorEntry = (output, context) => {
197
+ return {
198
+ errorCode: __expectString(output.errorCode),
199
+ errorMessage: __expectString(output.errorMessage),
200
+ id: __expectString(output.id),
201
+ };
202
+ };
203
+ const deserializeMetadata = (output) => ({
204
+ httpStatusCode: output.statusCode,
205
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
206
+ extendedRequestId: output.headers["x-amz-id-2"],
207
+ cfId: output.headers["x-amz-cf-id"],
208
+ });
209
+ const collectBody = (streamBody = new Uint8Array(), context) => {
210
+ if (streamBody instanceof Uint8Array) {
211
+ return Promise.resolve(streamBody);
212
+ }
213
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
214
+ };
215
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
216
+ const isSerializableHeaderValue = (value) => value !== undefined &&
217
+ value !== null &&
218
+ value !== "" &&
219
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
220
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
221
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
222
+ if (encoded.length) {
223
+ return JSON.parse(encoded);
224
+ }
225
+ return {};
226
+ });
227
+ const parseErrorBody = async (errorBody, context) => {
228
+ const value = await parseBody(errorBody, context);
229
+ value.message = value.message ?? value.Message;
230
+ return value;
231
+ };
232
+ const loadRestJsonErrorCode = (output, data) => {
233
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
234
+ const sanitizeErrorCode = (rawValue) => {
235
+ let cleanValue = rawValue;
236
+ if (typeof cleanValue === "number") {
237
+ cleanValue = cleanValue.toString();
238
+ }
239
+ if (cleanValue.indexOf(",") >= 0) {
240
+ cleanValue = cleanValue.split(",")[0];
241
+ }
242
+ if (cleanValue.indexOf(":") >= 0) {
243
+ cleanValue = cleanValue.split(":")[0];
244
+ }
245
+ if (cleanValue.indexOf("#") >= 0) {
246
+ cleanValue = cleanValue.split("#")[1];
247
+ }
248
+ return cleanValue;
249
+ };
250
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
251
+ if (headerKey !== undefined) {
252
+ return sanitizeErrorCode(output.headers[headerKey]);
253
+ }
254
+ if (data.code !== undefined) {
255
+ return sanitizeErrorCode(data.code);
256
+ }
257
+ if (data["__type"] !== undefined) {
258
+ return sanitizeErrorCode(data["__type"]);
259
+ }
260
+ };
@@ -0,0 +1,34 @@
1
+ import packageInfo from "../package.json";
2
+ import { Sha256 } from "@aws-crypto/sha256-browser";
3
+ import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@aws-sdk/config-resolver";
4
+ import { FetchHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
5
+ import { invalidProvider } from "@aws-sdk/invalid-dependency";
6
+ import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
7
+ import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/util-retry";
8
+ import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
9
+ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
10
+ import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
11
+ import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-browser";
12
+ export const getRuntimeConfig = (config) => {
13
+ const defaultsMode = resolveDefaultsModeConfig(config);
14
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
15
+ const clientSharedValues = getSharedRuntimeConfig(config);
16
+ return {
17
+ ...clientSharedValues,
18
+ ...config,
19
+ runtime: "browser",
20
+ defaultsMode,
21
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
22
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
23
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ??
24
+ defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
25
+ maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
26
+ region: config?.region ?? invalidProvider("Region is missing"),
27
+ requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
28
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
29
+ sha256: config?.sha256 ?? Sha256,
30
+ streamCollector: config?.streamCollector ?? streamCollector,
31
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
32
+ useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
33
+ };
34
+ };
@@ -0,0 +1,43 @@
1
+ import packageInfo from "../package.json";
2
+ import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
3
+ import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@aws-sdk/config-resolver";
4
+ import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
5
+ import { Hash } from "@aws-sdk/hash-node";
6
+ import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
7
+ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
8
+ import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler";
9
+ import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
10
+ import { DEFAULT_RETRY_MODE } from "@aws-sdk/util-retry";
11
+ import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
12
+ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
13
+ import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
14
+ import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-node";
15
+ import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
16
+ export const getRuntimeConfig = (config) => {
17
+ emitWarningIfUnsupportedVersion(process.version);
18
+ const defaultsMode = resolveDefaultsModeConfig(config);
19
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
20
+ const clientSharedValues = getSharedRuntimeConfig(config);
21
+ return {
22
+ ...clientSharedValues,
23
+ ...config,
24
+ runtime: "node",
25
+ defaultsMode,
26
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
27
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
28
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ??
29
+ defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
30
+ maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
31
+ region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
32
+ requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
33
+ retryMode: config?.retryMode ??
34
+ loadNodeConfig({
35
+ ...NODE_RETRY_MODE_CONFIG_OPTIONS,
36
+ default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
37
+ }),
38
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
39
+ streamCollector: config?.streamCollector ?? streamCollector,
40
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
41
+ useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
42
+ };
43
+ };
@@ -0,0 +1,11 @@
1
+ import { Sha256 } from "@aws-crypto/sha256-js";
2
+ import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
3
+ export const getRuntimeConfig = (config) => {
4
+ const browserDefaults = getBrowserRuntimeConfig(config);
5
+ return {
6
+ ...browserDefaults,
7
+ ...config,
8
+ runtime: "react-native",
9
+ sha256: config?.sha256 ?? Sha256,
10
+ };
11
+ };
@@ -0,0 +1,17 @@
1
+ import { NoOpLogger } from "@aws-sdk/smithy-client";
2
+ import { parseUrl } from "@aws-sdk/url-parser";
3
+ import { fromBase64, toBase64 } from "@aws-sdk/util-base64";
4
+ import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8";
5
+ import { defaultEndpointResolver } from "./endpoint/endpointResolver";
6
+ export const getRuntimeConfig = (config) => ({
7
+ apiVersion: "2021-08-11",
8
+ base64Decoder: config?.base64Decoder ?? fromBase64,
9
+ base64Encoder: config?.base64Encoder ?? toBase64,
10
+ disableHostPrefix: config?.disableHostPrefix ?? false,
11
+ endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
12
+ logger: config?.logger ?? new NoOpLogger(),
13
+ serviceId: config?.serviceId ?? "CloudTrail Data",
14
+ urlParser: config?.urlParser ?? parseUrl,
15
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
16
+ utf8Encoder: config?.utf8Encoder ?? toUtf8,
17
+ });
@@ -0,0 +1,23 @@
1
+ import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";
2
+ import { CloudTrailDataClient } from "./CloudTrailDataClient";
3
+ import { PutAuditEventsCommandInput, PutAuditEventsCommandOutput } from "./commands/PutAuditEventsCommand";
4
+ /**
5
+ * <p>The CloudTrail Data Service lets you ingest events into CloudTrail from any source in your
6
+ * hybrid environments, such as in-house or SaaS applications hosted on-premises or in the cloud,
7
+ * virtual machines, or containers. You can store, access, analyze, troubleshoot and take action on
8
+ * this data without maintaining multiple log aggregators and reporting tools. After you run
9
+ * <code>PutAuditEvents</code> to ingest your application activity into CloudTrail, you can use CloudTrail Lake to search, query, and analyze the data that is logged
10
+ * from your applications.</p>
11
+ */
12
+ export declare class CloudTrailData extends CloudTrailDataClient {
13
+ /**
14
+ * <p>Ingests your application events into CloudTrail Lake. A required parameter,
15
+ * <code>auditEvents</code>, accepts the JSON records (also called
16
+ * <i>payload</i>) of events that you want CloudTrail to ingest. You
17
+ * can add up to 100 of these events (or up to 1 MB) per <code>PutAuditEvents</code>
18
+ * request.</p>
19
+ */
20
+ putAuditEvents(args: PutAuditEventsCommandInput, options?: __HttpHandlerOptions): Promise<PutAuditEventsCommandOutput>;
21
+ putAuditEvents(args: PutAuditEventsCommandInput, cb: (err: any, data?: PutAuditEventsCommandOutput) => void): void;
22
+ putAuditEvents(args: PutAuditEventsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: PutAuditEventsCommandOutput) => void): void;
23
+ }
@@ -0,0 +1,147 @@
1
+ import { RegionInputConfig, RegionResolvedConfig } from "@aws-sdk/config-resolver";
2
+ import { EndpointInputConfig, EndpointResolvedConfig } from "@aws-sdk/middleware-endpoint";
3
+ import { HostHeaderInputConfig, HostHeaderResolvedConfig } from "@aws-sdk/middleware-host-header";
4
+ import { RetryInputConfig, RetryResolvedConfig } from "@aws-sdk/middleware-retry";
5
+ import { AwsAuthInputConfig, AwsAuthResolvedConfig } from "@aws-sdk/middleware-signing";
6
+ import { UserAgentInputConfig, UserAgentResolvedConfig } from "@aws-sdk/middleware-user-agent";
7
+ import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http";
8
+ import { Client as __Client, DefaultsMode as __DefaultsMode, SmithyConfiguration as __SmithyConfiguration, SmithyResolvedConfiguration as __SmithyResolvedConfiguration } from "@aws-sdk/smithy-client";
9
+ import { BodyLengthCalculator as __BodyLengthCalculator, ChecksumConstructor as __ChecksumConstructor, Credentials as __Credentials, Decoder as __Decoder, Encoder as __Encoder, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent } from "@aws-sdk/types";
10
+ import { PutAuditEventsCommandInput, PutAuditEventsCommandOutput } from "./commands/PutAuditEventsCommand";
11
+ import { ClientInputEndpointParameters, ClientResolvedEndpointParameters, EndpointParameters } from "./endpoint/EndpointParameters";
12
+ export declare type ServiceInputTypes = PutAuditEventsCommandInput;
13
+ export declare type ServiceOutputTypes = PutAuditEventsCommandOutput;
14
+ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
15
+ /**
16
+ * The HTTP handler to use. Fetch in browser and Https in Nodejs.
17
+ */
18
+ requestHandler?: __HttpHandler;
19
+ /**
20
+ * A constructor for a class implementing the {@link __Checksum} interface
21
+ * that computes the SHA-256 HMAC or checksum of a string or binary buffer.
22
+ * @internal
23
+ */
24
+ sha256?: __ChecksumConstructor | __HashConstructor;
25
+ /**
26
+ * The function that will be used to convert strings into HTTP endpoints.
27
+ * @internal
28
+ */
29
+ urlParser?: __UrlParser;
30
+ /**
31
+ * A function that can calculate the length of a request body.
32
+ * @internal
33
+ */
34
+ bodyLengthChecker?: __BodyLengthCalculator;
35
+ /**
36
+ * A function that converts a stream into an array of bytes.
37
+ * @internal
38
+ */
39
+ streamCollector?: __StreamCollector;
40
+ /**
41
+ * The function that will be used to convert a base64-encoded string to a byte array.
42
+ * @internal
43
+ */
44
+ base64Decoder?: __Decoder;
45
+ /**
46
+ * The function that will be used to convert binary data to a base64-encoded string.
47
+ * @internal
48
+ */
49
+ base64Encoder?: __Encoder;
50
+ /**
51
+ * The function that will be used to convert a UTF8-encoded string to a byte array.
52
+ * @internal
53
+ */
54
+ utf8Decoder?: __Decoder;
55
+ /**
56
+ * The function that will be used to convert binary data to a UTF-8 encoded string.
57
+ * @internal
58
+ */
59
+ utf8Encoder?: __Encoder;
60
+ /**
61
+ * The runtime environment.
62
+ * @internal
63
+ */
64
+ runtime?: string;
65
+ /**
66
+ * Disable dyanamically changing the endpoint of the client based on the hostPrefix
67
+ * trait of an operation.
68
+ */
69
+ disableHostPrefix?: boolean;
70
+ /**
71
+ * Value for how many times a request will be made at most in case of retry.
72
+ */
73
+ maxAttempts?: number | __Provider<number>;
74
+ /**
75
+ * Specifies which retry algorithm to use.
76
+ */
77
+ retryMode?: string | __Provider<string>;
78
+ /**
79
+ * Optional logger for logging debug/info/warn/error.
80
+ */
81
+ logger?: __Logger;
82
+ /**
83
+ * Enables IPv6/IPv4 dualstack endpoint.
84
+ */
85
+ useDualstackEndpoint?: boolean | __Provider<boolean>;
86
+ /**
87
+ * Enables FIPS compatible endpoints.
88
+ */
89
+ useFipsEndpoint?: boolean | __Provider<boolean>;
90
+ /**
91
+ * Unique service identifier.
92
+ * @internal
93
+ */
94
+ serviceId?: string;
95
+ /**
96
+ * The AWS region to which this client will send requests
97
+ */
98
+ region?: string | __Provider<string>;
99
+ /**
100
+ * Default credentials provider; Not available in browser runtime.
101
+ * @internal
102
+ */
103
+ credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;
104
+ /**
105
+ * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
106
+ * @internal
107
+ */
108
+ defaultUserAgentProvider?: Provider<__UserAgent>;
109
+ /**
110
+ * The {@link __DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK.
111
+ */
112
+ defaultsMode?: __DefaultsMode | __Provider<__DefaultsMode>;
113
+ }
114
+ declare type CloudTrailDataClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & RegionInputConfig & EndpointInputConfig<EndpointParameters> & RetryInputConfig & HostHeaderInputConfig & AwsAuthInputConfig & UserAgentInputConfig & ClientInputEndpointParameters;
115
+ /**
116
+ * The configuration interface of CloudTrailDataClient class constructor that set the region, credentials and other options.
117
+ */
118
+ export interface CloudTrailDataClientConfig extends CloudTrailDataClientConfigType {
119
+ }
120
+ declare type CloudTrailDataClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RegionResolvedConfig & EndpointResolvedConfig<EndpointParameters> & RetryResolvedConfig & HostHeaderResolvedConfig & AwsAuthResolvedConfig & UserAgentResolvedConfig & ClientResolvedEndpointParameters;
121
+ /**
122
+ * The resolved configuration interface of CloudTrailDataClient class. This is resolved and normalized from the {@link CloudTrailDataClientConfig | constructor configuration interface}.
123
+ */
124
+ export interface CloudTrailDataClientResolvedConfig extends CloudTrailDataClientResolvedConfigType {
125
+ }
126
+ /**
127
+ * <p>The CloudTrail Data Service lets you ingest events into CloudTrail from any source in your
128
+ * hybrid environments, such as in-house or SaaS applications hosted on-premises or in the cloud,
129
+ * virtual machines, or containers. You can store, access, analyze, troubleshoot and take action on
130
+ * this data without maintaining multiple log aggregators and reporting tools. After you run
131
+ * <code>PutAuditEvents</code> to ingest your application activity into CloudTrail, you can use CloudTrail Lake to search, query, and analyze the data that is logged
132
+ * from your applications.</p>
133
+ */
134
+ export declare class CloudTrailDataClient extends __Client<__HttpHandlerOptions, ServiceInputTypes, ServiceOutputTypes, CloudTrailDataClientResolvedConfig> {
135
+ /**
136
+ * The resolved configuration of CloudTrailDataClient class. This is resolved and normalized from the {@link CloudTrailDataClientConfig | constructor configuration interface}.
137
+ */
138
+ readonly config: CloudTrailDataClientResolvedConfig;
139
+ constructor(configuration: CloudTrailDataClientConfig);
140
+ /**
141
+ * Destroy underlying resources, like sockets. It's usually not necessary to do this.
142
+ * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
143
+ * Otherwise, sockets might stay open for quite a long time before the server terminates them.
144
+ */
145
+ destroy(): void;
146
+ }
147
+ export {};
@@ -0,0 +1,41 @@
1
+ import { EndpointParameterInstructions } from "@aws-sdk/middleware-endpoint";
2
+ import { Command as $Command } from "@aws-sdk/smithy-client";
3
+ import { Handler, HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack } from "@aws-sdk/types";
4
+ import { CloudTrailDataClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudTrailDataClient";
5
+ import { PutAuditEventsRequest, PutAuditEventsResponse } from "../models/models_0";
6
+ export interface PutAuditEventsCommandInput extends PutAuditEventsRequest {
7
+ }
8
+ export interface PutAuditEventsCommandOutput extends PutAuditEventsResponse, __MetadataBearer {
9
+ }
10
+ /**
11
+ * <p>Ingests your application events into CloudTrail Lake. A required parameter,
12
+ * <code>auditEvents</code>, accepts the JSON records (also called
13
+ * <i>payload</i>) of events that you want CloudTrail to ingest. You
14
+ * can add up to 100 of these events (or up to 1 MB) per <code>PutAuditEvents</code>
15
+ * request.</p>
16
+ * @example
17
+ * Use a bare-bones client and the command you need to make an API call.
18
+ * ```javascript
19
+ * import { CloudTrailDataClient, PutAuditEventsCommand } from "@aws-sdk/client-cloudtrail-data"; // ES Modules import
20
+ * // const { CloudTrailDataClient, PutAuditEventsCommand } = require("@aws-sdk/client-cloudtrail-data"); // CommonJS import
21
+ * const client = new CloudTrailDataClient(config);
22
+ * const command = new PutAuditEventsCommand(input);
23
+ * const response = await client.send(command);
24
+ * ```
25
+ *
26
+ * @see {@link PutAuditEventsCommandInput} for command's `input` shape.
27
+ * @see {@link PutAuditEventsCommandOutput} for command's `response` shape.
28
+ * @see {@link CloudTrailDataClientResolvedConfig | config} for CloudTrailDataClient's `config` shape.
29
+ *
30
+ */
31
+ export declare class PutAuditEventsCommand extends $Command<PutAuditEventsCommandInput, PutAuditEventsCommandOutput, CloudTrailDataClientResolvedConfig> {
32
+ readonly input: PutAuditEventsCommandInput;
33
+ static getEndpointParameterInstructions(): EndpointParameterInstructions;
34
+ constructor(input: PutAuditEventsCommandInput);
35
+ /**
36
+ * @internal
37
+ */
38
+ resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: CloudTrailDataClientResolvedConfig, options?: __HttpHandlerOptions): Handler<PutAuditEventsCommandInput, PutAuditEventsCommandOutput>;
39
+ private serialize;
40
+ private deserialize;
41
+ }