Skip to content

Commit 8bd69ca

Browse files
author
awstools
committed
feat(client-cloudtrail): This release adds a new API ListInsightsMetricData to retrieve metric data from CloudTrail Insights.
1 parent 5f79e22 commit 8bd69ca

File tree

13 files changed

+1023
-183
lines changed

13 files changed

+1023
-183
lines changed

clients/client-cloudtrail/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,14 @@ ListImports
434434

435435
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudtrail/command/ListImportsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/ListImportsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/ListImportsCommandOutput/)
436436

437+
</details>
438+
<details>
439+
<summary>
440+
ListInsightsMetricData
441+
</summary>
442+
443+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudtrail/command/ListInsightsMetricDataCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/ListInsightsMetricDataCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/ListInsightsMetricDataCommandOutput/)
444+
437445
</details>
438446
<details>
439447
<summary>

clients/client-cloudtrail/src/CloudTrail.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ import {
106106
ListImportFailuresCommandOutput,
107107
} from "./commands/ListImportFailuresCommand";
108108
import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
109+
import {
110+
ListInsightsMetricDataCommand,
111+
ListInsightsMetricDataCommandInput,
112+
ListInsightsMetricDataCommandOutput,
113+
} from "./commands/ListInsightsMetricDataCommand";
109114
import {
110115
ListPublicKeysCommand,
111116
ListPublicKeysCommandInput,
@@ -204,6 +209,7 @@ const commands = {
204209
ListEventDataStoresCommand,
205210
ListImportFailuresCommand,
206211
ListImportsCommand,
212+
ListInsightsMetricDataCommand,
207213
ListPublicKeysCommand,
208214
ListQueriesCommand,
209215
ListTagsCommand,
@@ -606,6 +612,23 @@ export interface CloudTrail {
606612
cb: (err: any, data?: ListImportsCommandOutput) => void
607613
): void;
608614

615+
/**
616+
* @see {@link ListInsightsMetricDataCommand}
617+
*/
618+
listInsightsMetricData(
619+
args: ListInsightsMetricDataCommandInput,
620+
options?: __HttpHandlerOptions
621+
): Promise<ListInsightsMetricDataCommandOutput>;
622+
listInsightsMetricData(
623+
args: ListInsightsMetricDataCommandInput,
624+
cb: (err: any, data?: ListInsightsMetricDataCommandOutput) => void
625+
): void;
626+
listInsightsMetricData(
627+
args: ListInsightsMetricDataCommandInput,
628+
options: __HttpHandlerOptions,
629+
cb: (err: any, data?: ListInsightsMetricDataCommandOutput) => void
630+
): void;
631+
609632
/**
610633
* @see {@link ListPublicKeysCommand}
611634
*/

clients/client-cloudtrail/src/CloudTrailClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ import {
9393
} from "./commands/ListEventDataStoresCommand";
9494
import { ListImportFailuresCommandInput, ListImportFailuresCommandOutput } from "./commands/ListImportFailuresCommand";
9595
import { ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
96+
import {
97+
ListInsightsMetricDataCommandInput,
98+
ListInsightsMetricDataCommandOutput,
99+
} from "./commands/ListInsightsMetricDataCommand";
96100
import { ListPublicKeysCommandInput, ListPublicKeysCommandOutput } from "./commands/ListPublicKeysCommand";
97101
import { ListQueriesCommandInput, ListQueriesCommandOutput } from "./commands/ListQueriesCommand";
98102
import { ListTagsCommandInput, ListTagsCommandOutput } from "./commands/ListTagsCommand";
@@ -174,6 +178,7 @@ export type ServiceInputTypes =
174178
| ListEventDataStoresCommandInput
175179
| ListImportFailuresCommandInput
176180
| ListImportsCommandInput
181+
| ListInsightsMetricDataCommandInput
177182
| ListPublicKeysCommandInput
178183
| ListQueriesCommandInput
179184
| ListTagsCommandInput
@@ -227,6 +232,7 @@ export type ServiceOutputTypes =
227232
| ListEventDataStoresCommandOutput
228233
| ListImportFailuresCommandOutput
229234
| ListImportsCommandOutput
235+
| ListInsightsMetricDataCommandOutput
230236
| ListPublicKeysCommandOutput
231237
| ListQueriesCommandOutput
232238
| ListTagsCommandOutput

clients/client-cloudtrail/src/commands/DisableFederationCommand.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ export interface DisableFederationCommandOutput extends DisableFederationRespons
2929
/**
3030
* @public
3131
* <p>
32-
* Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail
33-
* removes the metadata associated with the federated event data store in the Glue Data Catalog and removes registration for
34-
* the federation role ARN and event data store in Lake Formation. No CloudTrail Lake data is deleted
35-
* when you disable federation.
36-
* </p>
32+
* Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail disables
33+
* the integration with Glue, Lake Formation, and Amazon Athena.
34+
* After disabling Lake query federation, you can no longer query your event data in Amazon Athena.</p>
35+
* <p>No CloudTrail Lake data is deleted when you disable federation and you can continue to run queries in CloudTrail Lake.</p>
3736
* @example
3837
* Use a bare-bones client and the command you need to make an API call.
3938
* ```javascript

clients/client-cloudtrail/src/commands/EnableFederationCommand.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ export interface EnableFederationCommandOutput extends EnableFederationResponse,
3434
* SQL queries against your event data using Amazon Athena. The table metadata stored in the Glue Data Catalog
3535
* lets the Athena query engine know how to find, read, and process the data that you want to query.</p>
3636
* <p>When you enable Lake query federation, CloudTrail
37-
* creates a federated database named <code>aws:cloudtrail</code> (if the database doesn't already exist) and a federated table in
37+
* creates a managed database named <code>aws:cloudtrail</code> (if the database doesn't already exist) and a managed federated table in
3838
* the Glue Data Catalog. The event data store ID is used for the table name. CloudTrail registers the role ARN and event data store in
39-
* <a href="https://docs.aws.amazon.com/lake-formation/latest/dg/how-it-works.html">Lake Formation</a>, the service responsible for revoking or granting permissions
40-
* to the federated resources in the Glue Data Catalog.
41-
* </p>
39+
* <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-federation-lake-formation.html">Lake Formation</a>, the service responsible for allowing fine-grained access control
40+
* of the federated resources in the Glue Data Catalog.</p>
4241
* <p>For more information about Lake query federation, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-federation.html">Federate an event data store</a>.</p>
4342
* @example
4443
* Use a bare-bones client and the command you need to make an API call.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { CloudTrailClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudTrailClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { ListInsightsMetricDataRequest, ListInsightsMetricDataResponse } from "../models/models_0";
10+
import { de_ListInsightsMetricDataCommand, se_ListInsightsMetricDataCommand } from "../protocols/Aws_json1_1";
11+
12+
/**
13+
* @public
14+
*/
15+
export { __MetadataBearer, $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link ListInsightsMetricDataCommand}.
20+
*/
21+
export interface ListInsightsMetricDataCommandInput extends ListInsightsMetricDataRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link ListInsightsMetricDataCommand}.
26+
*/
27+
export interface ListInsightsMetricDataCommandOutput extends ListInsightsMetricDataResponse, __MetadataBearer {}
28+
29+
/**
30+
* @public
31+
* <p>Returns Insights metrics data for trails that have enabled Insights. The request must include the <code>EventSource</code>,
32+
* <code>EventName</code>, and <code>InsightType</code> parameters.</p>
33+
* <p>If the <code>InsightType</code> is set to <code>ApiErrorRateInsight</code>, the request must also include the <code>ErrorCode</code> parameter.</p>
34+
* <p>The following are the available time periods for <code>ListInsightsMetricData</code>. Each cutoff is inclusive.</p>
35+
* <ul>
36+
* <li>
37+
* <p>Data points with a period of 60 seconds (1-minute) are available for 15 days.</p>
38+
* </li>
39+
* <li>
40+
* <p>Data points with a period of 300 seconds (5-minute) are available for 63 days.</p>
41+
* </li>
42+
* <li>
43+
* <p>Data points with a period of 3600 seconds (1 hour) are available for 90 days.</p>
44+
* </li>
45+
* </ul>
46+
* <p>Access to the <code>ListInsightsMetricData</code> API operation is linked to the <code>cloudtrail:LookupEvents</code> action. To use this operation,
47+
* you must have permissions to perform the <code>cloudtrail:LookupEvents</code> action.</p>
48+
* @example
49+
* Use a bare-bones client and the command you need to make an API call.
50+
* ```javascript
51+
* import { CloudTrailClient, ListInsightsMetricDataCommand } from "@aws-sdk/client-cloudtrail"; // ES Modules import
52+
* // const { CloudTrailClient, ListInsightsMetricDataCommand } = require("@aws-sdk/client-cloudtrail"); // CommonJS import
53+
* const client = new CloudTrailClient(config);
54+
* const input = { // ListInsightsMetricDataRequest
55+
* EventSource: "STRING_VALUE", // required
56+
* EventName: "STRING_VALUE", // required
57+
* InsightType: "ApiCallRateInsight" || "ApiErrorRateInsight", // required
58+
* ErrorCode: "STRING_VALUE",
59+
* StartTime: new Date("TIMESTAMP"),
60+
* EndTime: new Date("TIMESTAMP"),
61+
* Period: Number("int"),
62+
* DataType: "FillWithZeros" || "NonZeroData",
63+
* MaxResults: Number("int"),
64+
* NextToken: "STRING_VALUE",
65+
* };
66+
* const command = new ListInsightsMetricDataCommand(input);
67+
* const response = await client.send(command);
68+
* // { // ListInsightsMetricDataResponse
69+
* // EventSource: "STRING_VALUE",
70+
* // EventName: "STRING_VALUE",
71+
* // InsightType: "ApiCallRateInsight" || "ApiErrorRateInsight",
72+
* // ErrorCode: "STRING_VALUE",
73+
* // Timestamps: [ // Timestamps
74+
* // new Date("TIMESTAMP"),
75+
* // ],
76+
* // Values: [ // InsightsMetricValues
77+
* // Number("double"),
78+
* // ],
79+
* // NextToken: "STRING_VALUE",
80+
* // };
81+
*
82+
* ```
83+
*
84+
* @param ListInsightsMetricDataCommandInput - {@link ListInsightsMetricDataCommandInput}
85+
* @returns {@link ListInsightsMetricDataCommandOutput}
86+
* @see {@link ListInsightsMetricDataCommandInput} for command's `input` shape.
87+
* @see {@link ListInsightsMetricDataCommandOutput} for command's `response` shape.
88+
* @see {@link CloudTrailClientResolvedConfig | config} for CloudTrailClient's `config` shape.
89+
*
90+
* @throws {@link InvalidParameterException} (client fault)
91+
* <p>The request includes a parameter that is not valid.</p>
92+
*
93+
* @throws {@link OperationNotPermittedException} (client fault)
94+
* <p>This exception is thrown when the requested operation is not permitted.</p>
95+
*
96+
* @throws {@link UnsupportedOperationException} (client fault)
97+
* <p>This exception is thrown when the requested operation is not supported.</p>
98+
*
99+
* @throws {@link CloudTrailServiceException}
100+
* <p>Base exception class for all service exceptions from CloudTrail service.</p>
101+
*
102+
*/
103+
export class ListInsightsMetricDataCommand extends $Command
104+
.classBuilder<
105+
ListInsightsMetricDataCommandInput,
106+
ListInsightsMetricDataCommandOutput,
107+
CloudTrailClientResolvedConfig,
108+
ServiceInputTypes,
109+
ServiceOutputTypes
110+
>()
111+
.ep({
112+
...commonParams,
113+
})
114+
.m(function (this: any, Command: any, cs: any, config: CloudTrailClientResolvedConfig, o: any) {
115+
return [
116+
getSerdePlugin(config, this.serialize, this.deserialize),
117+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
118+
];
119+
})
120+
.s("CloudTrail_20131101", "ListInsightsMetricData", {})
121+
.n("CloudTrailClient", "ListInsightsMetricDataCommand")
122+
.f(void 0, void 0)
123+
.ser(se_ListInsightsMetricDataCommand)
124+
.de(de_ListInsightsMetricDataCommand)
125+
.build() {}

clients/client-cloudtrail/src/commands/UpdateEventDataStoreCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export interface UpdateEventDataStoreCommandOutput extends UpdateEventDataStoreR
3434
* <code>RetentionPeriod</code> is in days, and valid values are integers between 7 and
3535
* 3653 if the <code>BillingMode</code> is set to <code>EXTENDABLE_RETENTION_PRICING</code>, or between 7 and 2557 if <code>BillingMode</code> is set to <code>FIXED_RETENTION_PRICING</code>. By default, <code>TerminationProtection</code> is enabled.</p>
3636
* <p>For event data stores for CloudTrail events, <code>AdvancedEventSelectors</code>
37-
* includes or excludes management, data, or Insights events in your event data store. For more
37+
* includes or excludes management or data events in your event data store. For more
3838
* information about <code>AdvancedEventSelectors</code>, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_AdvancedEventSelector.html">AdvancedEventSelectors</a>.</p>
39-
* <p> For event data stores for Config configuration items, Audit Manager evidence, or non-Amazon Web Services events,
39+
* <p> For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or non-Amazon Web Services events,
4040
* <code>AdvancedEventSelectors</code> includes events of that type in your event data store.</p>
4141
* @example
4242
* Use a bare-bones client and the command you need to make an API call.

clients/client-cloudtrail/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export * from "./ListChannelsCommand";
2626
export * from "./ListEventDataStoresCommand";
2727
export * from "./ListImportFailuresCommand";
2828
export * from "./ListImportsCommand";
29+
export * from "./ListInsightsMetricDataCommand";
2930
export * from "./ListPublicKeysCommand";
3031
export * from "./ListQueriesCommand";
3132
export * from "./ListTagsCommand";

0 commit comments

Comments
 (0)