Skip to content

Commit

Permalink
feat(client-cloudtrail): This release adds a new API ListInsightsMetr…
Browse files Browse the repository at this point in the history
…icData to retrieve metric data from CloudTrail Insights.
  • Loading branch information
awstools committed Jan 18, 2024
1 parent 5f79e22 commit 8bd69ca
Show file tree
Hide file tree
Showing 13 changed files with 1,023 additions and 183 deletions.
8 changes: 8 additions & 0 deletions clients/client-cloudtrail/README.md
Expand Up @@ -434,6 +434,14 @@ ListImports

[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/)

</details>
<details>
<summary>
ListInsightsMetricData
</summary>

[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/)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-cloudtrail/src/CloudTrail.ts
Expand Up @@ -106,6 +106,11 @@ import {
ListImportFailuresCommandOutput,
} from "./commands/ListImportFailuresCommand";
import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
import {
ListInsightsMetricDataCommand,
ListInsightsMetricDataCommandInput,
ListInsightsMetricDataCommandOutput,
} from "./commands/ListInsightsMetricDataCommand";
import {
ListPublicKeysCommand,
ListPublicKeysCommandInput,
Expand Down Expand Up @@ -204,6 +209,7 @@ const commands = {
ListEventDataStoresCommand,
ListImportFailuresCommand,
ListImportsCommand,
ListInsightsMetricDataCommand,
ListPublicKeysCommand,
ListQueriesCommand,
ListTagsCommand,
Expand Down Expand Up @@ -606,6 +612,23 @@ export interface CloudTrail {
cb: (err: any, data?: ListImportsCommandOutput) => void
): void;

/**
* @see {@link ListInsightsMetricDataCommand}
*/
listInsightsMetricData(
args: ListInsightsMetricDataCommandInput,
options?: __HttpHandlerOptions
): Promise<ListInsightsMetricDataCommandOutput>;
listInsightsMetricData(
args: ListInsightsMetricDataCommandInput,
cb: (err: any, data?: ListInsightsMetricDataCommandOutput) => void
): void;
listInsightsMetricData(
args: ListInsightsMetricDataCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListInsightsMetricDataCommandOutput) => void
): void;

/**
* @see {@link ListPublicKeysCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-cloudtrail/src/CloudTrailClient.ts
Expand Up @@ -93,6 +93,10 @@ import {
} from "./commands/ListEventDataStoresCommand";
import { ListImportFailuresCommandInput, ListImportFailuresCommandOutput } from "./commands/ListImportFailuresCommand";
import { ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
import {
ListInsightsMetricDataCommandInput,
ListInsightsMetricDataCommandOutput,
} from "./commands/ListInsightsMetricDataCommand";
import { ListPublicKeysCommandInput, ListPublicKeysCommandOutput } from "./commands/ListPublicKeysCommand";
import { ListQueriesCommandInput, ListQueriesCommandOutput } from "./commands/ListQueriesCommand";
import { ListTagsCommandInput, ListTagsCommandOutput } from "./commands/ListTagsCommand";
Expand Down Expand Up @@ -174,6 +178,7 @@ export type ServiceInputTypes =
| ListEventDataStoresCommandInput
| ListImportFailuresCommandInput
| ListImportsCommandInput
| ListInsightsMetricDataCommandInput
| ListPublicKeysCommandInput
| ListQueriesCommandInput
| ListTagsCommandInput
Expand Down Expand Up @@ -227,6 +232,7 @@ export type ServiceOutputTypes =
| ListEventDataStoresCommandOutput
| ListImportFailuresCommandOutput
| ListImportsCommandOutput
| ListInsightsMetricDataCommandOutput
| ListPublicKeysCommandOutput
| ListQueriesCommandOutput
| ListTagsCommandOutput
Expand Down
Expand Up @@ -29,11 +29,10 @@ export interface DisableFederationCommandOutput extends DisableFederationRespons
/**
* @public
* <p>
* Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail
* removes the metadata associated with the federated event data store in the Glue Data Catalog and removes registration for
* the federation role ARN and event data store in Lake Formation. No CloudTrail Lake data is deleted
* when you disable federation.
* </p>
* Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail disables
* the integration with Glue, Lake Formation, and Amazon Athena.
* After disabling Lake query federation, you can no longer query your event data in Amazon Athena.</p>
* <p>No CloudTrail Lake data is deleted when you disable federation and you can continue to run queries in CloudTrail Lake.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Expand Up @@ -34,11 +34,10 @@ export interface EnableFederationCommandOutput extends EnableFederationResponse,
* SQL queries against your event data using Amazon Athena. The table metadata stored in the Glue Data Catalog
* lets the Athena query engine know how to find, read, and process the data that you want to query.</p>
* <p>When you enable Lake query federation, CloudTrail
* creates a federated database named <code>aws:cloudtrail</code> (if the database doesn't already exist) and a federated table in
* creates a managed database named <code>aws:cloudtrail</code> (if the database doesn't already exist) and a managed federated table in
* 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
* <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
* to the federated resources in the Glue Data Catalog.
* </p>
* <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
* of the federated resources in the Glue Data Catalog.</p>
* <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>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
@@ -0,0 +1,125 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { CloudTrailClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudTrailClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { ListInsightsMetricDataRequest, ListInsightsMetricDataResponse } from "../models/models_0";
import { de_ListInsightsMetricDataCommand, se_ListInsightsMetricDataCommand } from "../protocols/Aws_json1_1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link ListInsightsMetricDataCommand}.
*/
export interface ListInsightsMetricDataCommandInput extends ListInsightsMetricDataRequest {}
/**
* @public
*
* The output of {@link ListInsightsMetricDataCommand}.
*/
export interface ListInsightsMetricDataCommandOutput extends ListInsightsMetricDataResponse, __MetadataBearer {}

/**
* @public
* <p>Returns Insights metrics data for trails that have enabled Insights. The request must include the <code>EventSource</code>,
* <code>EventName</code>, and <code>InsightType</code> parameters.</p>
* <p>If the <code>InsightType</code> is set to <code>ApiErrorRateInsight</code>, the request must also include the <code>ErrorCode</code> parameter.</p>
* <p>The following are the available time periods for <code>ListInsightsMetricData</code>. Each cutoff is inclusive.</p>
* <ul>
* <li>
* <p>Data points with a period of 60 seconds (1-minute) are available for 15 days.</p>
* </li>
* <li>
* <p>Data points with a period of 300 seconds (5-minute) are available for 63 days.</p>
* </li>
* <li>
* <p>Data points with a period of 3600 seconds (1 hour) are available for 90 days.</p>
* </li>
* </ul>
* <p>Access to the <code>ListInsightsMetricData</code> API operation is linked to the <code>cloudtrail:LookupEvents</code> action. To use this operation,
* you must have permissions to perform the <code>cloudtrail:LookupEvents</code> action.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { CloudTrailClient, ListInsightsMetricDataCommand } from "@aws-sdk/client-cloudtrail"; // ES Modules import
* // const { CloudTrailClient, ListInsightsMetricDataCommand } = require("@aws-sdk/client-cloudtrail"); // CommonJS import
* const client = new CloudTrailClient(config);
* const input = { // ListInsightsMetricDataRequest
* EventSource: "STRING_VALUE", // required
* EventName: "STRING_VALUE", // required
* InsightType: "ApiCallRateInsight" || "ApiErrorRateInsight", // required
* ErrorCode: "STRING_VALUE",
* StartTime: new Date("TIMESTAMP"),
* EndTime: new Date("TIMESTAMP"),
* Period: Number("int"),
* DataType: "FillWithZeros" || "NonZeroData",
* MaxResults: Number("int"),
* NextToken: "STRING_VALUE",
* };
* const command = new ListInsightsMetricDataCommand(input);
* const response = await client.send(command);
* // { // ListInsightsMetricDataResponse
* // EventSource: "STRING_VALUE",
* // EventName: "STRING_VALUE",
* // InsightType: "ApiCallRateInsight" || "ApiErrorRateInsight",
* // ErrorCode: "STRING_VALUE",
* // Timestamps: [ // Timestamps
* // new Date("TIMESTAMP"),
* // ],
* // Values: [ // InsightsMetricValues
* // Number("double"),
* // ],
* // NextToken: "STRING_VALUE",
* // };
*
* ```
*
* @param ListInsightsMetricDataCommandInput - {@link ListInsightsMetricDataCommandInput}
* @returns {@link ListInsightsMetricDataCommandOutput}
* @see {@link ListInsightsMetricDataCommandInput} for command's `input` shape.
* @see {@link ListInsightsMetricDataCommandOutput} for command's `response` shape.
* @see {@link CloudTrailClientResolvedConfig | config} for CloudTrailClient's `config` shape.
*
* @throws {@link InvalidParameterException} (client fault)
* <p>The request includes a parameter that is not valid.</p>
*
* @throws {@link OperationNotPermittedException} (client fault)
* <p>This exception is thrown when the requested operation is not permitted.</p>
*
* @throws {@link UnsupportedOperationException} (client fault)
* <p>This exception is thrown when the requested operation is not supported.</p>
*
* @throws {@link CloudTrailServiceException}
* <p>Base exception class for all service exceptions from CloudTrail service.</p>
*
*/
export class ListInsightsMetricDataCommand extends $Command
.classBuilder<
ListInsightsMetricDataCommandInput,
ListInsightsMetricDataCommandOutput,
CloudTrailClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: CloudTrailClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("CloudTrail_20131101", "ListInsightsMetricData", {})
.n("CloudTrailClient", "ListInsightsMetricDataCommand")
.f(void 0, void 0)
.ser(se_ListInsightsMetricDataCommand)
.de(de_ListInsightsMetricDataCommand)
.build() {}
Expand Up @@ -34,9 +34,9 @@ export interface UpdateEventDataStoreCommandOutput extends UpdateEventDataStoreR
* <code>RetentionPeriod</code> is in days, and valid values are integers between 7 and
* 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>
* <p>For event data stores for CloudTrail events, <code>AdvancedEventSelectors</code>
* includes or excludes management, data, or Insights events in your event data store. For more
* includes or excludes management or data events in your event data store. For more
* information about <code>AdvancedEventSelectors</code>, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_AdvancedEventSelector.html">AdvancedEventSelectors</a>.</p>
* <p> For event data stores for Config configuration items, Audit Manager evidence, or non-Amazon Web Services events,
* <p> For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or non-Amazon Web Services events,
* <code>AdvancedEventSelectors</code> includes events of that type in your event data store.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
1 change: 1 addition & 0 deletions clients/client-cloudtrail/src/commands/index.ts
Expand Up @@ -26,6 +26,7 @@ export * from "./ListChannelsCommand";
export * from "./ListEventDataStoresCommand";
export * from "./ListImportFailuresCommand";
export * from "./ListImportsCommand";
export * from "./ListInsightsMetricDataCommand";
export * from "./ListPublicKeysCommand";
export * from "./ListQueriesCommand";
export * from "./ListTagsCommand";
Expand Down

0 comments on commit 8bd69ca

Please sign in to comment.