Skip to content

Commit 12ad701

Browse files
author
awstools
committed
feat(client-kafka): Amazon MSK adds three new APIs, ListTopics, DescribeTopic, and DescribeTopicPartitions for viewing Kafka topics in your MSK clusters.
1 parent 0b0c9b8 commit 12ad701

File tree

13 files changed

+1462
-4
lines changed

13 files changed

+1462
-4
lines changed

clients/client-kafka/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,22 @@ DescribeReplicator
354354

355355
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/kafka/command/DescribeReplicatorCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/DescribeReplicatorCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/DescribeReplicatorCommandOutput/)
356356

357+
</details>
358+
<details>
359+
<summary>
360+
DescribeTopic
361+
</summary>
362+
363+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/kafka/command/DescribeTopicCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/DescribeTopicCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/DescribeTopicCommandOutput/)
364+
365+
</details>
366+
<details>
367+
<summary>
368+
DescribeTopicPartitions
369+
</summary>
370+
371+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/kafka/command/DescribeTopicPartitionsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/DescribeTopicPartitionsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/DescribeTopicPartitionsCommandOutput/)
372+
357373
</details>
358374
<details>
359375
<summary>
@@ -482,6 +498,14 @@ ListTagsForResource
482498

483499
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/kafka/command/ListTagsForResourceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/ListTagsForResourceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/ListTagsForResourceCommandOutput/)
484500

501+
</details>
502+
<details>
503+
<summary>
504+
ListTopics
505+
</summary>
506+
507+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/kafka/command/ListTopicsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/ListTopicsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-kafka/Interface/ListTopicsCommandOutput/)
508+
485509
</details>
486510
<details>
487511
<summary>

clients/client-kafka/src/Kafka.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ import {
9797
DescribeReplicatorCommandInput,
9898
DescribeReplicatorCommandOutput,
9999
} from "./commands/DescribeReplicatorCommand";
100+
import {
101+
DescribeTopicCommand,
102+
DescribeTopicCommandInput,
103+
DescribeTopicCommandOutput,
104+
} from "./commands/DescribeTopicCommand";
105+
import {
106+
DescribeTopicPartitionsCommand,
107+
DescribeTopicPartitionsCommandInput,
108+
DescribeTopicPartitionsCommandOutput,
109+
} from "./commands/DescribeTopicPartitionsCommand";
100110
import {
101111
DescribeVpcConnectionCommand,
102112
DescribeVpcConnectionCommandInput,
@@ -173,6 +183,7 @@ import {
173183
ListTagsForResourceCommandInput,
174184
ListTagsForResourceCommandOutput,
175185
} from "./commands/ListTagsForResourceCommand";
186+
import { ListTopicsCommand, ListTopicsCommandInput, ListTopicsCommandOutput } from "./commands/ListTopicsCommand";
176187
import {
177188
ListVpcConnectionsCommand,
178189
ListVpcConnectionsCommandInput,
@@ -281,6 +292,8 @@ const commands = {
281292
DescribeConfigurationCommand,
282293
DescribeConfigurationRevisionCommand,
283294
DescribeReplicatorCommand,
295+
DescribeTopicCommand,
296+
DescribeTopicPartitionsCommand,
284297
DescribeVpcConnectionCommand,
285298
GetBootstrapBrokersCommand,
286299
GetClusterPolicyCommand,
@@ -297,6 +310,7 @@ const commands = {
297310
ListReplicatorsCommand,
298311
ListScramSecretsCommand,
299312
ListTagsForResourceCommand,
313+
ListTopicsCommand,
300314
ListVpcConnectionsCommand,
301315
PutClusterPolicyCommand,
302316
RebootBrokerCommand,
@@ -623,6 +637,34 @@ export interface Kafka {
623637
cb: (err: any, data?: DescribeReplicatorCommandOutput) => void
624638
): void;
625639

640+
/**
641+
* @see {@link DescribeTopicCommand}
642+
*/
643+
describeTopic(args: DescribeTopicCommandInput, options?: __HttpHandlerOptions): Promise<DescribeTopicCommandOutput>;
644+
describeTopic(args: DescribeTopicCommandInput, cb: (err: any, data?: DescribeTopicCommandOutput) => void): void;
645+
describeTopic(
646+
args: DescribeTopicCommandInput,
647+
options: __HttpHandlerOptions,
648+
cb: (err: any, data?: DescribeTopicCommandOutput) => void
649+
): void;
650+
651+
/**
652+
* @see {@link DescribeTopicPartitionsCommand}
653+
*/
654+
describeTopicPartitions(
655+
args: DescribeTopicPartitionsCommandInput,
656+
options?: __HttpHandlerOptions
657+
): Promise<DescribeTopicPartitionsCommandOutput>;
658+
describeTopicPartitions(
659+
args: DescribeTopicPartitionsCommandInput,
660+
cb: (err: any, data?: DescribeTopicPartitionsCommandOutput) => void
661+
): void;
662+
describeTopicPartitions(
663+
args: DescribeTopicPartitionsCommandInput,
664+
options: __HttpHandlerOptions,
665+
cb: (err: any, data?: DescribeTopicPartitionsCommandOutput) => void
666+
): void;
667+
626668
/**
627669
* @see {@link DescribeVpcConnectionCommand}
628670
*/
@@ -883,6 +925,17 @@ export interface Kafka {
883925
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
884926
): void;
885927

928+
/**
929+
* @see {@link ListTopicsCommand}
930+
*/
931+
listTopics(args: ListTopicsCommandInput, options?: __HttpHandlerOptions): Promise<ListTopicsCommandOutput>;
932+
listTopics(args: ListTopicsCommandInput, cb: (err: any, data?: ListTopicsCommandOutput) => void): void;
933+
listTopics(
934+
args: ListTopicsCommandInput,
935+
options: __HttpHandlerOptions,
936+
cb: (err: any, data?: ListTopicsCommandOutput) => void
937+
): void;
938+
886939
/**
887940
* @see {@link ListVpcConnectionsCommand}
888941
*/

clients/client-kafka/src/KafkaClient.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ import {
109109
DescribeConfigurationRevisionCommandOutput,
110110
} from "./commands/DescribeConfigurationRevisionCommand";
111111
import { DescribeReplicatorCommandInput, DescribeReplicatorCommandOutput } from "./commands/DescribeReplicatorCommand";
112+
import { DescribeTopicCommandInput, DescribeTopicCommandOutput } from "./commands/DescribeTopicCommand";
113+
import {
114+
DescribeTopicPartitionsCommandInput,
115+
DescribeTopicPartitionsCommandOutput,
116+
} from "./commands/DescribeTopicPartitionsCommand";
112117
import {
113118
DescribeVpcConnectionCommandInput,
114119
DescribeVpcConnectionCommandOutput,
@@ -149,6 +154,7 @@ import {
149154
ListTagsForResourceCommandInput,
150155
ListTagsForResourceCommandOutput,
151156
} from "./commands/ListTagsForResourceCommand";
157+
import { ListTopicsCommandInput, ListTopicsCommandOutput } from "./commands/ListTopicsCommand";
152158
import { ListVpcConnectionsCommandInput, ListVpcConnectionsCommandOutput } from "./commands/ListVpcConnectionsCommand";
153159
import { PutClusterPolicyCommandInput, PutClusterPolicyCommandOutput } from "./commands/PutClusterPolicyCommand";
154160
import { RebootBrokerCommandInput, RebootBrokerCommandOutput } from "./commands/RebootBrokerCommand";
@@ -219,6 +225,8 @@ export type ServiceInputTypes =
219225
| DescribeConfigurationCommandInput
220226
| DescribeConfigurationRevisionCommandInput
221227
| DescribeReplicatorCommandInput
228+
| DescribeTopicCommandInput
229+
| DescribeTopicPartitionsCommandInput
222230
| DescribeVpcConnectionCommandInput
223231
| GetBootstrapBrokersCommandInput
224232
| GetClusterPolicyCommandInput
@@ -235,6 +243,7 @@ export type ServiceInputTypes =
235243
| ListReplicatorsCommandInput
236244
| ListScramSecretsCommandInput
237245
| ListTagsForResourceCommandInput
246+
| ListTopicsCommandInput
238247
| ListVpcConnectionsCommandInput
239248
| PutClusterPolicyCommandInput
240249
| RebootBrokerCommandInput
@@ -277,6 +286,8 @@ export type ServiceOutputTypes =
277286
| DescribeConfigurationCommandOutput
278287
| DescribeConfigurationRevisionCommandOutput
279288
| DescribeReplicatorCommandOutput
289+
| DescribeTopicCommandOutput
290+
| DescribeTopicPartitionsCommandOutput
280291
| DescribeVpcConnectionCommandOutput
281292
| GetBootstrapBrokersCommandOutput
282293
| GetClusterPolicyCommandOutput
@@ -293,6 +304,7 @@ export type ServiceOutputTypes =
293304
| ListReplicatorsCommandOutput
294305
| ListScramSecretsCommandOutput
295306
| ListTagsForResourceCommandOutput
307+
| ListTopicsCommandOutput
296308
| ListVpcConnectionsCommandOutput
297309
| PutClusterPolicyCommandOutput
298310
| RebootBrokerCommandOutput
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { Command as $Command } from "@smithy/smithy-client";
4+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
5+
6+
import { commonParams } from "../endpoint/EndpointParameters";
7+
import { KafkaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../KafkaClient";
8+
import { DescribeTopicRequest, DescribeTopicResponse } from "../models/models_0";
9+
import { DescribeTopic } from "../schemas/schemas_0";
10+
11+
/**
12+
* @public
13+
*/
14+
export type { __MetadataBearer };
15+
export { $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link DescribeTopicCommand}.
20+
*/
21+
export interface DescribeTopicCommandInput extends DescribeTopicRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link DescribeTopicCommand}.
26+
*/
27+
export interface DescribeTopicCommandOutput extends DescribeTopicResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p>Returns topic details of this topic on a MSK cluster.</p>
31+
* @example
32+
* Use a bare-bones client and the command you need to make an API call.
33+
* ```javascript
34+
* import { KafkaClient, DescribeTopicCommand } from "@aws-sdk/client-kafka"; // ES Modules import
35+
* // const { KafkaClient, DescribeTopicCommand } = require("@aws-sdk/client-kafka"); // CommonJS import
36+
* // import type { KafkaClientConfig } from "@aws-sdk/client-kafka";
37+
* const config = {}; // type is KafkaClientConfig
38+
* const client = new KafkaClient(config);
39+
* const input = { // DescribeTopicRequest
40+
* ClusterArn: "STRING_VALUE", // required
41+
* TopicName: "STRING_VALUE", // required
42+
* };
43+
* const command = new DescribeTopicCommand(input);
44+
* const response = await client.send(command);
45+
* // { // DescribeTopicResponse
46+
* // TopicArn: "STRING_VALUE",
47+
* // TopicName: "STRING_VALUE",
48+
* // ReplicationFactor: Number("int"),
49+
* // PartitionCount: Number("int"),
50+
* // Configs: "STRING_VALUE",
51+
* // Status: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE",
52+
* // };
53+
*
54+
* ```
55+
*
56+
* @param DescribeTopicCommandInput - {@link DescribeTopicCommandInput}
57+
* @returns {@link DescribeTopicCommandOutput}
58+
* @see {@link DescribeTopicCommandInput} for command's `input` shape.
59+
* @see {@link DescribeTopicCommandOutput} for command's `response` shape.
60+
* @see {@link KafkaClientResolvedConfig | config} for KafkaClient's `config` shape.
61+
*
62+
* @throws {@link BadRequestException} (client fault)
63+
* <p>Returns information about an error.</p>
64+
*
65+
* @throws {@link ForbiddenException} (client fault)
66+
* <p>Returns information about an error.</p>
67+
*
68+
* @throws {@link InternalServerErrorException} (server fault)
69+
* <p>Returns information about an error.</p>
70+
*
71+
* @throws {@link NotFoundException} (client fault)
72+
* <p>Returns information about an error.</p>
73+
*
74+
* @throws {@link UnauthorizedException} (client fault)
75+
* <p>Returns information about an error.</p>
76+
*
77+
* @throws {@link KafkaServiceException}
78+
* <p>Base exception class for all service exceptions from Kafka service.</p>
79+
*
80+
*
81+
* @public
82+
*/
83+
export class DescribeTopicCommand extends $Command
84+
.classBuilder<
85+
DescribeTopicCommandInput,
86+
DescribeTopicCommandOutput,
87+
KafkaClientResolvedConfig,
88+
ServiceInputTypes,
89+
ServiceOutputTypes
90+
>()
91+
.ep(commonParams)
92+
.m(function (this: any, Command: any, cs: any, config: KafkaClientResolvedConfig, o: any) {
93+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
94+
})
95+
.s("Kafka", "DescribeTopic", {})
96+
.n("KafkaClient", "DescribeTopicCommand")
97+
.sc(DescribeTopic)
98+
.build() {
99+
/** @internal type navigation helper, not in runtime. */
100+
protected declare static __types: {
101+
api: {
102+
input: DescribeTopicRequest;
103+
output: DescribeTopicResponse;
104+
};
105+
sdk: {
106+
input: DescribeTopicCommandInput;
107+
output: DescribeTopicCommandOutput;
108+
};
109+
};
110+
}

0 commit comments

Comments
 (0)