Skip to content

Commit 3cccfec

Browse files
author
awstools
committed
feat(client-cloudtrail): CloudTrail Lake now supports federating event data stores. giving users the ability to run queries against their event data using Amazon Athena.
1 parent 419b519 commit 3cccfec

File tree

12 files changed

+1335
-3
lines changed

12 files changed

+1335
-3
lines changed

clients/client-cloudtrail/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,22 @@ DescribeTrails
314314

315315
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudtrail/command/DescribeTrailsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/DescribeTrailsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/DescribeTrailsCommandOutput/)
316316

317+
</details>
318+
<details>
319+
<summary>
320+
DisableFederation
321+
</summary>
322+
323+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudtrail/command/DisableFederationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/DisableFederationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/DisableFederationCommandOutput/)
324+
325+
</details>
326+
<details>
327+
<summary>
328+
EnableFederation
329+
</summary>
330+
331+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudtrail/command/EnableFederationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/EnableFederationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudtrail/Interface/EnableFederationCommandOutput/)
332+
317333
</details>
318334
<details>
319335
<summary>

clients/client-cloudtrail/src/CloudTrail.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ import {
4747
DescribeTrailsCommandInput,
4848
DescribeTrailsCommandOutput,
4949
} from "./commands/DescribeTrailsCommand";
50+
import {
51+
DisableFederationCommand,
52+
DisableFederationCommandInput,
53+
DisableFederationCommandOutput,
54+
} from "./commands/DisableFederationCommand";
55+
import {
56+
EnableFederationCommand,
57+
EnableFederationCommandInput,
58+
EnableFederationCommandOutput,
59+
} from "./commands/EnableFederationCommand";
5060
import { GetChannelCommand, GetChannelCommandInput, GetChannelCommandOutput } from "./commands/GetChannelCommand";
5161
import {
5262
GetEventDataStoreCommand,
@@ -179,6 +189,8 @@ const commands = {
179189
DeregisterOrganizationDelegatedAdminCommand,
180190
DescribeQueryCommand,
181191
DescribeTrailsCommand,
192+
DisableFederationCommand,
193+
EnableFederationCommand,
182194
GetChannelCommand,
183195
GetEventDataStoreCommand,
184196
GetEventSelectorsCommand,
@@ -375,6 +387,40 @@ export interface CloudTrail {
375387
cb: (err: any, data?: DescribeTrailsCommandOutput) => void
376388
): void;
377389

390+
/**
391+
* @see {@link DisableFederationCommand}
392+
*/
393+
disableFederation(
394+
args: DisableFederationCommandInput,
395+
options?: __HttpHandlerOptions
396+
): Promise<DisableFederationCommandOutput>;
397+
disableFederation(
398+
args: DisableFederationCommandInput,
399+
cb: (err: any, data?: DisableFederationCommandOutput) => void
400+
): void;
401+
disableFederation(
402+
args: DisableFederationCommandInput,
403+
options: __HttpHandlerOptions,
404+
cb: (err: any, data?: DisableFederationCommandOutput) => void
405+
): void;
406+
407+
/**
408+
* @see {@link EnableFederationCommand}
409+
*/
410+
enableFederation(
411+
args: EnableFederationCommandInput,
412+
options?: __HttpHandlerOptions
413+
): Promise<EnableFederationCommandOutput>;
414+
enableFederation(
415+
args: EnableFederationCommandInput,
416+
cb: (err: any, data?: EnableFederationCommandOutput) => void
417+
): void;
418+
enableFederation(
419+
args: EnableFederationCommandInput,
420+
options: __HttpHandlerOptions,
421+
cb: (err: any, data?: EnableFederationCommandOutput) => void
422+
): void;
423+
378424
/**
379425
* @see {@link GetChannelCommand}
380426
*/

clients/client-cloudtrail/src/CloudTrailClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ import {
7474
} from "./commands/DeregisterOrganizationDelegatedAdminCommand";
7575
import { DescribeQueryCommandInput, DescribeQueryCommandOutput } from "./commands/DescribeQueryCommand";
7676
import { DescribeTrailsCommandInput, DescribeTrailsCommandOutput } from "./commands/DescribeTrailsCommand";
77+
import { DisableFederationCommandInput, DisableFederationCommandOutput } from "./commands/DisableFederationCommand";
78+
import { EnableFederationCommandInput, EnableFederationCommandOutput } from "./commands/EnableFederationCommand";
7779
import { GetChannelCommandInput, GetChannelCommandOutput } from "./commands/GetChannelCommand";
7880
import { GetEventDataStoreCommandInput, GetEventDataStoreCommandOutput } from "./commands/GetEventDataStoreCommand";
7981
import { GetEventSelectorsCommandInput, GetEventSelectorsCommandOutput } from "./commands/GetEventSelectorsCommand";
@@ -159,6 +161,8 @@ export type ServiceInputTypes =
159161
| DeregisterOrganizationDelegatedAdminCommandInput
160162
| DescribeQueryCommandInput
161163
| DescribeTrailsCommandInput
164+
| DisableFederationCommandInput
165+
| EnableFederationCommandInput
162166
| GetChannelCommandInput
163167
| GetEventDataStoreCommandInput
164168
| GetEventSelectorsCommandInput
@@ -210,6 +214,8 @@ export type ServiceOutputTypes =
210214
| DeregisterOrganizationDelegatedAdminCommandOutput
211215
| DescribeQueryCommandOutput
212216
| DescribeTrailsCommandOutput
217+
| DisableFederationCommandOutput
218+
| EnableFederationCommandOutput
213219
| GetChannelCommandOutput
214220
| GetEventDataStoreCommandOutput
215221
| GetEventSelectorsCommandOutput

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ export interface DeleteEventDataStoreCommandOutput extends DeleteEventDataStoreR
4141
* event data store ARN. After you run <code>DeleteEventDataStore</code>, the event data store
4242
* enters a <code>PENDING_DELETION</code> state, and is automatically deleted after a wait
4343
* period of seven days. <code>TerminationProtectionEnabled</code> must be set to
44-
* <code>False</code> on the event data store; this operation cannot work if
45-
* <code>TerminationProtectionEnabled</code> is <code>True</code>.</p>
44+
* <code>False</code> on the event data store and the <code>FederationStatus</code> must be <code>DISABLED</code>.
45+
* You cannot delete an event data store if <code>TerminationProtectionEnabled</code>
46+
* is <code>True</code> or the <code>FederationStatus</code> is <code>ENABLED</code>.</p>
4647
* <p>After you run <code>DeleteEventDataStore</code> on an event data store, you cannot run
4748
* <code>ListQueries</code>, <code>DescribeQuery</code>, or <code>GetQueryResults</code> on
4849
* queries that are using an event data store in a <code>PENDING_DELETION</code> state. An
@@ -72,10 +73,22 @@ export interface DeleteEventDataStoreCommandOutput extends DeleteEventDataStoreR
7273
* <p>This exception is thrown when the specified event data store cannot yet be deleted because it
7374
* is in use by a channel.</p>
7475
*
76+
* @throws {@link ConflictException} (client fault)
77+
* <p>This exception is thrown when the specified resource is not ready for an operation. This
78+
* can occur when you try to run an operation on a resource before CloudTrail has time
79+
* to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the
80+
* operation again.</p>
81+
*
7582
* @throws {@link EventDataStoreARNInvalidException} (client fault)
7683
* <p>The specified event data store ARN is not valid or does not map to an event data store
7784
* in your account.</p>
7885
*
86+
* @throws {@link EventDataStoreFederationEnabledException} (client fault)
87+
* <p>
88+
* You cannot delete the event data store because Lake query federation is enabled. To delete the event data store, run the <code>DisableFederation</code> operation to
89+
* disable Lake query federation on the event data store.
90+
* </p>
91+
*
7992
* @throws {@link EventDataStoreHasOngoingImportException} (client fault)
8093
* <p> This exception is thrown when you try to update or delete an event data store that
8194
* currently has an import in progress. </p>
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
5+
import { Command as $Command } from "@smithy/smithy-client";
6+
import {
7+
FinalizeHandlerArguments,
8+
Handler,
9+
HandlerExecutionContext,
10+
HttpHandlerOptions as __HttpHandlerOptions,
11+
MetadataBearer as __MetadataBearer,
12+
MiddlewareStack,
13+
SerdeContext as __SerdeContext,
14+
SMITHY_CONTEXT_KEY,
15+
} from "@smithy/types";
16+
17+
import { CloudTrailClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudTrailClient";
18+
import { DisableFederationRequest, DisableFederationResponse } from "../models/models_0";
19+
import { de_DisableFederationCommand, se_DisableFederationCommand } from "../protocols/Aws_json1_1";
20+
21+
/**
22+
* @public
23+
*/
24+
export { __MetadataBearer, $Command };
25+
/**
26+
* @public
27+
*
28+
* The input for {@link DisableFederationCommand}.
29+
*/
30+
export interface DisableFederationCommandInput extends DisableFederationRequest {}
31+
/**
32+
* @public
33+
*
34+
* The output of {@link DisableFederationCommand}.
35+
*/
36+
export interface DisableFederationCommandOutput extends DisableFederationResponse, __MetadataBearer {}
37+
38+
/**
39+
* @public
40+
* <p>
41+
* Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail
42+
* removes the metadata associated with the federated event data store in the Glue Data Catalog and removes registration for
43+
* the federation role ARN and event data store in Lake Formation. No CloudTrail Lake data is deleted
44+
* when you disable federation.
45+
* </p>
46+
* @example
47+
* Use a bare-bones client and the command you need to make an API call.
48+
* ```javascript
49+
* import { CloudTrailClient, DisableFederationCommand } from "@aws-sdk/client-cloudtrail"; // ES Modules import
50+
* // const { CloudTrailClient, DisableFederationCommand } = require("@aws-sdk/client-cloudtrail"); // CommonJS import
51+
* const client = new CloudTrailClient(config);
52+
* const input = { // DisableFederationRequest
53+
* EventDataStore: "STRING_VALUE", // required
54+
* };
55+
* const command = new DisableFederationCommand(input);
56+
* const response = await client.send(command);
57+
* // { // DisableFederationResponse
58+
* // EventDataStoreArn: "STRING_VALUE",
59+
* // FederationStatus: "ENABLING" || "ENABLED" || "DISABLING" || "DISABLED",
60+
* // };
61+
*
62+
* ```
63+
*
64+
* @param DisableFederationCommandInput - {@link DisableFederationCommandInput}
65+
* @returns {@link DisableFederationCommandOutput}
66+
* @see {@link DisableFederationCommandInput} for command's `input` shape.
67+
* @see {@link DisableFederationCommandOutput} for command's `response` shape.
68+
* @see {@link CloudTrailClientResolvedConfig | config} for CloudTrailClient's `config` shape.
69+
*
70+
* @throws {@link AccessDeniedException} (client fault)
71+
* <p>
72+
* You do not have sufficient access to perform this action.
73+
* </p>
74+
*
75+
* @throws {@link CloudTrailAccessNotEnabledException} (client fault)
76+
* <p>This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html">Enabling Trusted Access with Other Amazon Web Services Services</a> and <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-an-organizational-trail-prepare.html">Prepare For Creating a Trail For Your Organization</a>. </p>
77+
*
78+
* @throws {@link ConcurrentModificationException} (client fault)
79+
* <p>
80+
* You are trying to update a resource when another request is in progress. Allow sufficient wait time for the previous request to complete, then retry your request.
81+
* </p>
82+
*
83+
* @throws {@link EventDataStoreARNInvalidException} (client fault)
84+
* <p>The specified event data store ARN is not valid or does not map to an event data store
85+
* in your account.</p>
86+
*
87+
* @throws {@link EventDataStoreNotFoundException} (client fault)
88+
* <p>The specified event data store was not found.</p>
89+
*
90+
* @throws {@link InactiveEventDataStoreException} (client fault)
91+
* <p>The event data store is inactive.</p>
92+
*
93+
* @throws {@link InsufficientDependencyServiceAccessPermissionException} (client fault)
94+
* <p>This exception is thrown when the IAM identity that is used to create
95+
* the organization resource lacks one or more required permissions for creating an
96+
* organization resource in a required service.</p>
97+
*
98+
* @throws {@link InvalidParameterException} (client fault)
99+
* <p>The request includes a parameter that is not valid.</p>
100+
*
101+
* @throws {@link NoManagementAccountSLRExistsException} (client fault)
102+
* <p> This exception is thrown when the management account does not have a service-linked
103+
* role. </p>
104+
*
105+
* @throws {@link NotOrganizationMasterAccountException} (client fault)
106+
* <p>This exception is thrown when the Amazon Web Services account making the request to
107+
* create or update an organization trail or event data store is not the management account
108+
* for an organization in Organizations. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-an-organizational-trail-prepare.html">Prepare For Creating a Trail For Your Organization</a> or <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-event-data-store.html">Create an event data store</a>.</p>
109+
*
110+
* @throws {@link OperationNotPermittedException} (client fault)
111+
* <p>This exception is thrown when the requested operation is not permitted.</p>
112+
*
113+
* @throws {@link OrganizationNotInAllFeaturesModeException} (client fault)
114+
* <p>This exception is thrown when Organizations is not configured to support all
115+
* features. All features must be enabled in Organizations to support creating an
116+
* organization trail or event data store.</p>
117+
*
118+
* @throws {@link OrganizationsNotInUseException} (client fault)
119+
* <p>This exception is thrown when the request is made from an Amazon Web Services account
120+
* that is not a member of an organization. To make this request, sign in using the
121+
* credentials of an account that belongs to an organization.</p>
122+
*
123+
* @throws {@link UnsupportedOperationException} (client fault)
124+
* <p>This exception is thrown when the requested operation is not supported.</p>
125+
*
126+
* @throws {@link CloudTrailServiceException}
127+
* <p>Base exception class for all service exceptions from CloudTrail service.</p>
128+
*
129+
*/
130+
export class DisableFederationCommand extends $Command<
131+
DisableFederationCommandInput,
132+
DisableFederationCommandOutput,
133+
CloudTrailClientResolvedConfig
134+
> {
135+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
136+
return {
137+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
138+
Endpoint: { type: "builtInParams", name: "endpoint" },
139+
Region: { type: "builtInParams", name: "region" },
140+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
141+
};
142+
}
143+
144+
/**
145+
* @public
146+
*/
147+
constructor(readonly input: DisableFederationCommandInput) {
148+
super();
149+
}
150+
151+
/**
152+
* @internal
153+
*/
154+
resolveMiddleware(
155+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
156+
configuration: CloudTrailClientResolvedConfig,
157+
options?: __HttpHandlerOptions
158+
): Handler<DisableFederationCommandInput, DisableFederationCommandOutput> {
159+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
160+
this.middlewareStack.use(
161+
getEndpointPlugin(configuration, DisableFederationCommand.getEndpointParameterInstructions())
162+
);
163+
164+
const stack = clientStack.concat(this.middlewareStack);
165+
166+
const { logger } = configuration;
167+
const clientName = "CloudTrailClient";
168+
const commandName = "DisableFederationCommand";
169+
const handlerExecutionContext: HandlerExecutionContext = {
170+
logger,
171+
clientName,
172+
commandName,
173+
inputFilterSensitiveLog: (_: any) => _,
174+
outputFilterSensitiveLog: (_: any) => _,
175+
[SMITHY_CONTEXT_KEY]: {
176+
service: "CloudTrail_20131101",
177+
operation: "DisableFederation",
178+
},
179+
};
180+
const { requestHandler } = configuration;
181+
return stack.resolve(
182+
(request: FinalizeHandlerArguments<any>) =>
183+
requestHandler.handle(request.request as __HttpRequest, options || {}),
184+
handlerExecutionContext
185+
);
186+
}
187+
188+
/**
189+
* @internal
190+
*/
191+
private serialize(input: DisableFederationCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
192+
return se_DisableFederationCommand(input, context);
193+
}
194+
195+
/**
196+
* @internal
197+
*/
198+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DisableFederationCommandOutput> {
199+
return de_DisableFederationCommand(output, context);
200+
}
201+
}

0 commit comments

Comments
 (0)