Skip to content

Commit 3c7cfa2

Browse files
author
awstools
committed
feat(client-cloudtrail): This release adds CloudTrail getChannel and listChannels APIs to allow customer to view the ServiceLinkedChannel configurations.
1 parent e01fa5e commit 3c7cfa2

File tree

11 files changed

+1190
-13
lines changed

11 files changed

+1190
-13
lines changed

clients/client-cloudtrail/src/CloudTrail.ts

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
DescribeTrailsCommandInput,
2727
DescribeTrailsCommandOutput,
2828
} from "./commands/DescribeTrailsCommand";
29+
import { GetChannelCommand, GetChannelCommandInput, GetChannelCommandOutput } from "./commands/GetChannelCommand";
2930
import {
3031
GetEventDataStoreCommand,
3132
GetEventDataStoreCommandInput,
@@ -52,6 +53,11 @@ import {
5253
GetTrailStatusCommandInput,
5354
GetTrailStatusCommandOutput,
5455
} from "./commands/GetTrailStatusCommand";
56+
import {
57+
ListChannelsCommand,
58+
ListChannelsCommandInput,
59+
ListChannelsCommandOutput,
60+
} from "./commands/ListChannelsCommand";
5561
import {
5662
ListEventDataStoresCommand,
5763
ListEventDataStoresCommandInput,
@@ -371,6 +377,34 @@ export class CloudTrail extends CloudTrailClient {
371377
}
372378
}
373379

380+
/**
381+
* <p>
382+
* Returns the specified CloudTrail service-linked channel. Amazon Web Services services create service-linked channels to view CloudTrail events.
383+
* </p>
384+
*/
385+
public getChannel(args: GetChannelCommandInput, options?: __HttpHandlerOptions): Promise<GetChannelCommandOutput>;
386+
public getChannel(args: GetChannelCommandInput, cb: (err: any, data?: GetChannelCommandOutput) => void): void;
387+
public getChannel(
388+
args: GetChannelCommandInput,
389+
options: __HttpHandlerOptions,
390+
cb: (err: any, data?: GetChannelCommandOutput) => void
391+
): void;
392+
public getChannel(
393+
args: GetChannelCommandInput,
394+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetChannelCommandOutput) => void),
395+
cb?: (err: any, data?: GetChannelCommandOutput) => void
396+
): Promise<GetChannelCommandOutput> | void {
397+
const command = new GetChannelCommand(args);
398+
if (typeof optionsOrCb === "function") {
399+
this.send(command, optionsOrCb);
400+
} else if (typeof cb === "function") {
401+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
402+
this.send(command, optionsOrCb || {}, cb);
403+
} else {
404+
return this.send(command, optionsOrCb);
405+
}
406+
}
407+
374408
/**
375409
* <p>Returns information about an event data store specified as either an ARN or the ID portion of the ARN.</p>
376410
*/
@@ -580,6 +614,37 @@ export class CloudTrail extends CloudTrailClient {
580614
}
581615
}
582616

617+
/**
618+
* <p>
619+
* Returns all CloudTrail channels.
620+
* </p>
621+
*/
622+
public listChannels(
623+
args: ListChannelsCommandInput,
624+
options?: __HttpHandlerOptions
625+
): Promise<ListChannelsCommandOutput>;
626+
public listChannels(args: ListChannelsCommandInput, cb: (err: any, data?: ListChannelsCommandOutput) => void): void;
627+
public listChannels(
628+
args: ListChannelsCommandInput,
629+
options: __HttpHandlerOptions,
630+
cb: (err: any, data?: ListChannelsCommandOutput) => void
631+
): void;
632+
public listChannels(
633+
args: ListChannelsCommandInput,
634+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListChannelsCommandOutput) => void),
635+
cb?: (err: any, data?: ListChannelsCommandOutput) => void
636+
): Promise<ListChannelsCommandOutput> | void {
637+
const command = new ListChannelsCommand(args);
638+
if (typeof optionsOrCb === "function") {
639+
this.send(command, optionsOrCb);
640+
} else if (typeof cb === "function") {
641+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
642+
this.send(command, optionsOrCb || {}, cb);
643+
} else {
644+
return this.send(command, optionsOrCb);
645+
}
646+
}
647+
583648
/**
584649
* <p>Returns information about all event data stores in the account, in the current region.</p>
585650
*/
@@ -1069,7 +1134,7 @@ export class CloudTrail extends CloudTrailClient {
10691134
/**
10701135
* <p>Updates an event data store. The required <code>EventDataStore</code> value is an ARN or the ID portion of the ARN.
10711136
* Other parameters are optional, but at least one optional parameter must be specified, or CloudTrail throws an error.
1072-
* <code>RetentionPeriod</code> is in days, and valid values are integers between 90 and 2555.
1137+
* <code>RetentionPeriod</code> is in days, and valid values are integers between 90 and 2557.
10731138
* By default, <code>TerminationProtection</code> is enabled. <code>AdvancedEventSelectors</code> includes or excludes management
10741139
* and data events in your event data store; for more information about <code>AdvancedEventSelectors</code>, see
10751140
* <a>PutEventSelectorsRequest$AdvancedEventSelectors</a>.</p>

clients/client-cloudtrail/src/CloudTrailClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import {
6767
import { DeleteTrailCommandInput, DeleteTrailCommandOutput } from "./commands/DeleteTrailCommand";
6868
import { DescribeQueryCommandInput, DescribeQueryCommandOutput } from "./commands/DescribeQueryCommand";
6969
import { DescribeTrailsCommandInput, DescribeTrailsCommandOutput } from "./commands/DescribeTrailsCommand";
70+
import { GetChannelCommandInput, GetChannelCommandOutput } from "./commands/GetChannelCommand";
7071
import { GetEventDataStoreCommandInput, GetEventDataStoreCommandOutput } from "./commands/GetEventDataStoreCommand";
7172
import { GetEventSelectorsCommandInput, GetEventSelectorsCommandOutput } from "./commands/GetEventSelectorsCommand";
7273
import {
@@ -76,6 +77,7 @@ import {
7677
import { GetQueryResultsCommandInput, GetQueryResultsCommandOutput } from "./commands/GetQueryResultsCommand";
7778
import { GetTrailCommandInput, GetTrailCommandOutput } from "./commands/GetTrailCommand";
7879
import { GetTrailStatusCommandInput, GetTrailStatusCommandOutput } from "./commands/GetTrailStatusCommand";
80+
import { ListChannelsCommandInput, ListChannelsCommandOutput } from "./commands/ListChannelsCommand";
7981
import {
8082
ListEventDataStoresCommandInput,
8183
ListEventDataStoresCommandOutput,
@@ -114,12 +116,14 @@ export type ServiceInputTypes =
114116
| DeleteTrailCommandInput
115117
| DescribeQueryCommandInput
116118
| DescribeTrailsCommandInput
119+
| GetChannelCommandInput
117120
| GetEventDataStoreCommandInput
118121
| GetEventSelectorsCommandInput
119122
| GetInsightSelectorsCommandInput
120123
| GetQueryResultsCommandInput
121124
| GetTrailCommandInput
122125
| GetTrailStatusCommandInput
126+
| ListChannelsCommandInput
123127
| ListEventDataStoresCommandInput
124128
| ListPublicKeysCommandInput
125129
| ListQueriesCommandInput
@@ -145,12 +149,14 @@ export type ServiceOutputTypes =
145149
| DeleteTrailCommandOutput
146150
| DescribeQueryCommandOutput
147151
| DescribeTrailsCommandOutput
152+
| GetChannelCommandOutput
148153
| GetEventDataStoreCommandOutput
149154
| GetEventSelectorsCommandOutput
150155
| GetInsightSelectorsCommandOutput
151156
| GetQueryResultsCommandOutput
152157
| GetTrailCommandOutput
153158
| GetTrailStatusCommandOutput
159+
| ListChannelsCommandOutput
154160
| ListEventDataStoresCommandOutput
155161
| ListPublicKeysCommandOutput
156162
| ListQueriesCommandOutput
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { CloudTrailClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudTrailClient";
16+
import {
17+
GetChannelRequest,
18+
GetChannelRequestFilterSensitiveLog,
19+
GetChannelResponse,
20+
GetChannelResponseFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_json1_1GetChannelCommand,
24+
serializeAws_json1_1GetChannelCommand,
25+
} from "../protocols/Aws_json1_1";
26+
27+
export interface GetChannelCommandInput extends GetChannelRequest {}
28+
export interface GetChannelCommandOutput extends GetChannelResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p>
32+
* Returns the specified CloudTrail service-linked channel. Amazon Web Services services create service-linked channels to view CloudTrail events.
33+
* </p>
34+
* @example
35+
* Use a bare-bones client and the command you need to make an API call.
36+
* ```javascript
37+
* import { CloudTrailClient, GetChannelCommand } from "@aws-sdk/client-cloudtrail"; // ES Modules import
38+
* // const { CloudTrailClient, GetChannelCommand } = require("@aws-sdk/client-cloudtrail"); // CommonJS import
39+
* const client = new CloudTrailClient(config);
40+
* const command = new GetChannelCommand(input);
41+
* const response = await client.send(command);
42+
* ```
43+
*
44+
* @see {@link GetChannelCommandInput} for command's `input` shape.
45+
* @see {@link GetChannelCommandOutput} for command's `response` shape.
46+
* @see {@link CloudTrailClientResolvedConfig | config} for CloudTrailClient's `config` shape.
47+
*
48+
*/
49+
export class GetChannelCommand extends $Command<
50+
GetChannelCommandInput,
51+
GetChannelCommandOutput,
52+
CloudTrailClientResolvedConfig
53+
> {
54+
// Start section: command_properties
55+
// End section: command_properties
56+
57+
constructor(readonly input: GetChannelCommandInput) {
58+
// Start section: command_constructor
59+
super();
60+
// End section: command_constructor
61+
}
62+
63+
/**
64+
* @internal
65+
*/
66+
resolveMiddleware(
67+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
68+
configuration: CloudTrailClientResolvedConfig,
69+
options?: __HttpHandlerOptions
70+
): Handler<GetChannelCommandInput, GetChannelCommandOutput> {
71+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
72+
73+
const stack = clientStack.concat(this.middlewareStack);
74+
75+
const { logger } = configuration;
76+
const clientName = "CloudTrailClient";
77+
const commandName = "GetChannelCommand";
78+
const handlerExecutionContext: HandlerExecutionContext = {
79+
logger,
80+
clientName,
81+
commandName,
82+
inputFilterSensitiveLog: GetChannelRequestFilterSensitiveLog,
83+
outputFilterSensitiveLog: GetChannelResponseFilterSensitiveLog,
84+
};
85+
const { requestHandler } = configuration;
86+
return stack.resolve(
87+
(request: FinalizeHandlerArguments<any>) =>
88+
requestHandler.handle(request.request as __HttpRequest, options || {}),
89+
handlerExecutionContext
90+
);
91+
}
92+
93+
private serialize(input: GetChannelCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
94+
return serializeAws_json1_1GetChannelCommand(input, context);
95+
}
96+
97+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetChannelCommandOutput> {
98+
return deserializeAws_json1_1GetChannelCommand(output, context);
99+
}
100+
101+
// Start section: command_body_extra
102+
// End section: command_body_extra
103+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { CloudTrailClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudTrailClient";
16+
import {
17+
ListChannelsRequest,
18+
ListChannelsRequestFilterSensitiveLog,
19+
ListChannelsResponse,
20+
ListChannelsResponseFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_json1_1ListChannelsCommand,
24+
serializeAws_json1_1ListChannelsCommand,
25+
} from "../protocols/Aws_json1_1";
26+
27+
export interface ListChannelsCommandInput extends ListChannelsRequest {}
28+
export interface ListChannelsCommandOutput extends ListChannelsResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p>
32+
* Returns all CloudTrail channels.
33+
* </p>
34+
* @example
35+
* Use a bare-bones client and the command you need to make an API call.
36+
* ```javascript
37+
* import { CloudTrailClient, ListChannelsCommand } from "@aws-sdk/client-cloudtrail"; // ES Modules import
38+
* // const { CloudTrailClient, ListChannelsCommand } = require("@aws-sdk/client-cloudtrail"); // CommonJS import
39+
* const client = new CloudTrailClient(config);
40+
* const command = new ListChannelsCommand(input);
41+
* const response = await client.send(command);
42+
* ```
43+
*
44+
* @see {@link ListChannelsCommandInput} for command's `input` shape.
45+
* @see {@link ListChannelsCommandOutput} for command's `response` shape.
46+
* @see {@link CloudTrailClientResolvedConfig | config} for CloudTrailClient's `config` shape.
47+
*
48+
*/
49+
export class ListChannelsCommand extends $Command<
50+
ListChannelsCommandInput,
51+
ListChannelsCommandOutput,
52+
CloudTrailClientResolvedConfig
53+
> {
54+
// Start section: command_properties
55+
// End section: command_properties
56+
57+
constructor(readonly input: ListChannelsCommandInput) {
58+
// Start section: command_constructor
59+
super();
60+
// End section: command_constructor
61+
}
62+
63+
/**
64+
* @internal
65+
*/
66+
resolveMiddleware(
67+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
68+
configuration: CloudTrailClientResolvedConfig,
69+
options?: __HttpHandlerOptions
70+
): Handler<ListChannelsCommandInput, ListChannelsCommandOutput> {
71+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
72+
73+
const stack = clientStack.concat(this.middlewareStack);
74+
75+
const { logger } = configuration;
76+
const clientName = "CloudTrailClient";
77+
const commandName = "ListChannelsCommand";
78+
const handlerExecutionContext: HandlerExecutionContext = {
79+
logger,
80+
clientName,
81+
commandName,
82+
inputFilterSensitiveLog: ListChannelsRequestFilterSensitiveLog,
83+
outputFilterSensitiveLog: ListChannelsResponseFilterSensitiveLog,
84+
};
85+
const { requestHandler } = configuration;
86+
return stack.resolve(
87+
(request: FinalizeHandlerArguments<any>) =>
88+
requestHandler.handle(request.request as __HttpRequest, options || {}),
89+
handlerExecutionContext
90+
);
91+
}
92+
93+
private serialize(input: ListChannelsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
94+
return serializeAws_json1_1ListChannelsCommand(input, context);
95+
}
96+
97+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<ListChannelsCommandOutput> {
98+
return deserializeAws_json1_1ListChannelsCommand(output, context);
99+
}
100+
101+
// Start section: command_body_extra
102+
// End section: command_body_extra
103+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface UpdateEventDataStoreCommandOutput extends UpdateEventDataStoreR
3030
/**
3131
* <p>Updates an event data store. The required <code>EventDataStore</code> value is an ARN or the ID portion of the ARN.
3232
* Other parameters are optional, but at least one optional parameter must be specified, or CloudTrail throws an error.
33-
* <code>RetentionPeriod</code> is in days, and valid values are integers between 90 and 2555.
33+
* <code>RetentionPeriod</code> is in days, and valid values are integers between 90 and 2557.
3434
* By default, <code>TerminationProtection</code> is enabled. <code>AdvancedEventSelectors</code> includes or excludes management
3535
* and data events in your event data store; for more information about <code>AdvancedEventSelectors</code>, see
3636
* <a>PutEventSelectorsRequest$AdvancedEventSelectors</a>.</p>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ export * from "./DeleteEventDataStoreCommand";
77
export * from "./DeleteTrailCommand";
88
export * from "./DescribeQueryCommand";
99
export * from "./DescribeTrailsCommand";
10+
export * from "./GetChannelCommand";
1011
export * from "./GetEventDataStoreCommand";
1112
export * from "./GetEventSelectorsCommand";
1213
export * from "./GetInsightSelectorsCommand";
1314
export * from "./GetQueryResultsCommand";
1415
export * from "./GetTrailCommand";
1516
export * from "./GetTrailStatusCommand";
17+
export * from "./ListChannelsCommand";
1618
export * from "./ListEventDataStoresCommand";
1719
export * from "./ListPublicKeysCommand";
1820
export * from "./ListQueriesCommand";

0 commit comments

Comments
 (0)