Skip to content

Commit de42572

Browse files
author
awstools
committed
feat(client-cloudwatch): Added a new API - DescribeAlarmContributors API, to retrieve alarm contributors in ALARM state. Added support in DescribeAlarmHistory API to query alarm contributor history
1 parent 6553aca commit de42572

File tree

9 files changed

+585
-28
lines changed

9 files changed

+585
-28
lines changed

clients/client-cloudwatch/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,14 @@ DeleteMetricStream
254254

255255
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch/command/DeleteMetricStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch/Interface/DeleteMetricStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch/Interface/DeleteMetricStreamCommandOutput/)
256256

257+
</details>
258+
<details>
259+
<summary>
260+
DescribeAlarmContributors
261+
</summary>
262+
263+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch/command/DescribeAlarmContributorsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch/Interface/DescribeAlarmContributorsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch/Interface/DescribeAlarmContributorsCommandOutput/)
264+
257265
</details>
258266
<details>
259267
<summary>

clients/client-cloudwatch/src/CloudWatch.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ import {
2828
DeleteMetricStreamCommandInput,
2929
DeleteMetricStreamCommandOutput,
3030
} from "./commands/DeleteMetricStreamCommand";
31+
import {
32+
DescribeAlarmContributorsCommand,
33+
DescribeAlarmContributorsCommandInput,
34+
DescribeAlarmContributorsCommandOutput,
35+
} from "./commands/DescribeAlarmContributorsCommand";
3136
import {
3237
DescribeAlarmHistoryCommand,
3338
DescribeAlarmHistoryCommandInput,
@@ -192,6 +197,7 @@ const commands = {
192197
DeleteDashboardsCommand,
193198
DeleteInsightRulesCommand,
194199
DeleteMetricStreamCommand,
200+
DescribeAlarmContributorsCommand,
195201
DescribeAlarmHistoryCommand,
196202
DescribeAlarmsCommand,
197203
DescribeAlarmsForMetricCommand,
@@ -308,6 +314,23 @@ export interface CloudWatch {
308314
cb: (err: any, data?: DeleteMetricStreamCommandOutput) => void
309315
): void;
310316

317+
/**
318+
* @see {@link DescribeAlarmContributorsCommand}
319+
*/
320+
describeAlarmContributors(
321+
args: DescribeAlarmContributorsCommandInput,
322+
options?: __HttpHandlerOptions
323+
): Promise<DescribeAlarmContributorsCommandOutput>;
324+
describeAlarmContributors(
325+
args: DescribeAlarmContributorsCommandInput,
326+
cb: (err: any, data?: DescribeAlarmContributorsCommandOutput) => void
327+
): void;
328+
describeAlarmContributors(
329+
args: DescribeAlarmContributorsCommandInput,
330+
options: __HttpHandlerOptions,
331+
cb: (err: any, data?: DescribeAlarmContributorsCommandOutput) => void
332+
): void;
333+
311334
/**
312335
* @see {@link DescribeAlarmHistoryCommand}
313336
*/

clients/client-cloudwatch/src/CloudWatchClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ import {
6666
import { DeleteDashboardsCommandInput, DeleteDashboardsCommandOutput } from "./commands/DeleteDashboardsCommand";
6767
import { DeleteInsightRulesCommandInput, DeleteInsightRulesCommandOutput } from "./commands/DeleteInsightRulesCommand";
6868
import { DeleteMetricStreamCommandInput, DeleteMetricStreamCommandOutput } from "./commands/DeleteMetricStreamCommand";
69+
import {
70+
DescribeAlarmContributorsCommandInput,
71+
DescribeAlarmContributorsCommandOutput,
72+
} from "./commands/DescribeAlarmContributorsCommand";
6973
import {
7074
DescribeAlarmHistoryCommandInput,
7175
DescribeAlarmHistoryCommandOutput,
@@ -155,6 +159,7 @@ export type ServiceInputTypes =
155159
| DeleteDashboardsCommandInput
156160
| DeleteInsightRulesCommandInput
157161
| DeleteMetricStreamCommandInput
162+
| DescribeAlarmContributorsCommandInput
158163
| DescribeAlarmHistoryCommandInput
159164
| DescribeAlarmsCommandInput
160165
| DescribeAlarmsForMetricCommandInput
@@ -198,6 +203,7 @@ export type ServiceOutputTypes =
198203
| DeleteDashboardsCommandOutput
199204
| DeleteInsightRulesCommandOutput
200205
| DeleteMetricStreamCommandOutput
206+
| DescribeAlarmContributorsCommandOutput
201207
| DescribeAlarmHistoryCommandOutput
202208
| DescribeAlarmsCommandOutput
203209
| DescribeAlarmsForMetricCommandOutput
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 { 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 { CloudWatchClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudWatchClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { DescribeAlarmContributorsInput, DescribeAlarmContributorsOutput } from "../models/models_0";
10+
import { de_DescribeAlarmContributorsCommand, se_DescribeAlarmContributorsCommand } from "../protocols/Aws_query";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link DescribeAlarmContributorsCommand}.
21+
*/
22+
export interface DescribeAlarmContributorsCommandInput extends DescribeAlarmContributorsInput {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link DescribeAlarmContributorsCommand}.
27+
*/
28+
export interface DescribeAlarmContributorsCommandOutput extends DescribeAlarmContributorsOutput, __MetadataBearer {}
29+
30+
/**
31+
* <p>Returns the information of the current alarm contributors that are in <code>ALARM</code> state. This operation returns details about the individual time series that contribute to the alarm's state.</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { CloudWatchClient, DescribeAlarmContributorsCommand } from "@aws-sdk/client-cloudwatch"; // ES Modules import
36+
* // const { CloudWatchClient, DescribeAlarmContributorsCommand } = require("@aws-sdk/client-cloudwatch"); // CommonJS import
37+
* const client = new CloudWatchClient(config);
38+
* const input = { // DescribeAlarmContributorsInput
39+
* AlarmName: "STRING_VALUE", // required
40+
* NextToken: "STRING_VALUE",
41+
* };
42+
* const command = new DescribeAlarmContributorsCommand(input);
43+
* const response = await client.send(command);
44+
* // { // DescribeAlarmContributorsOutput
45+
* // AlarmContributors: [ // AlarmContributors // required
46+
* // { // AlarmContributor
47+
* // ContributorId: "STRING_VALUE", // required
48+
* // ContributorAttributes: { // ContributorAttributes // required
49+
* // "<keys>": "STRING_VALUE",
50+
* // },
51+
* // StateReason: "STRING_VALUE", // required
52+
* // StateTransitionedTimestamp: new Date("TIMESTAMP"),
53+
* // },
54+
* // ],
55+
* // NextToken: "STRING_VALUE",
56+
* // };
57+
*
58+
* ```
59+
*
60+
* @param DescribeAlarmContributorsCommandInput - {@link DescribeAlarmContributorsCommandInput}
61+
* @returns {@link DescribeAlarmContributorsCommandOutput}
62+
* @see {@link DescribeAlarmContributorsCommandInput} for command's `input` shape.
63+
* @see {@link DescribeAlarmContributorsCommandOutput} for command's `response` shape.
64+
* @see {@link CloudWatchClientResolvedConfig | config} for CloudWatchClient's `config` shape.
65+
*
66+
* @throws {@link InvalidNextToken} (client fault)
67+
* <p>The next token specified is invalid.</p>
68+
*
69+
* @throws {@link ResourceNotFoundException} (client fault)
70+
* <p>The named resource does not exist.</p>
71+
*
72+
* @throws {@link CloudWatchServiceException}
73+
* <p>Base exception class for all service exceptions from CloudWatch service.</p>
74+
*
75+
*
76+
* @public
77+
*/
78+
export class DescribeAlarmContributorsCommand extends $Command
79+
.classBuilder<
80+
DescribeAlarmContributorsCommandInput,
81+
DescribeAlarmContributorsCommandOutput,
82+
CloudWatchClientResolvedConfig,
83+
ServiceInputTypes,
84+
ServiceOutputTypes
85+
>()
86+
.ep(commonParams)
87+
.m(function (this: any, Command: any, cs: any, config: CloudWatchClientResolvedConfig, o: any) {
88+
return [
89+
getSerdePlugin(config, this.serialize, this.deserialize),
90+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
91+
];
92+
})
93+
.s("GraniteServiceVersion20100801", "DescribeAlarmContributors", {})
94+
.n("CloudWatchClient", "DescribeAlarmContributorsCommand")
95+
.f(void 0, void 0)
96+
.ser(se_DescribeAlarmContributorsCommand)
97+
.de(de_DescribeAlarmContributorsCommand)
98+
.build() {
99+
/** @internal type navigation helper, not in runtime. */
100+
protected declare static __types: {
101+
api: {
102+
input: DescribeAlarmContributorsInput;
103+
output: DescribeAlarmContributorsOutput;
104+
};
105+
sdk: {
106+
input: DescribeAlarmContributorsCommandInput;
107+
output: DescribeAlarmContributorsCommandOutput;
108+
};
109+
};
110+
}

clients/client-cloudwatch/src/commands/DescribeAlarmHistoryCommand.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ export interface DescribeAlarmHistoryCommandOutput extends DescribeAlarmHistoryO
4444
* const client = new CloudWatchClient(config);
4545
* const input = { // DescribeAlarmHistoryInput
4646
* AlarmName: "STRING_VALUE",
47+
* AlarmContributorId: "STRING_VALUE",
4748
* AlarmTypes: [ // AlarmTypes
4849
* "CompositeAlarm" || "MetricAlarm",
4950
* ],
50-
* HistoryItemType: "ConfigurationUpdate" || "StateUpdate" || "Action",
51+
* HistoryItemType: "ConfigurationUpdate" || "StateUpdate" || "Action" || "AlarmContributorStateUpdate" || "AlarmContributorAction",
5152
* StartDate: new Date("TIMESTAMP"),
5253
* EndDate: new Date("TIMESTAMP"),
5354
* MaxRecords: Number("int"),
@@ -60,11 +61,15 @@ export interface DescribeAlarmHistoryCommandOutput extends DescribeAlarmHistoryO
6061
* // AlarmHistoryItems: [ // AlarmHistoryItems
6162
* // { // AlarmHistoryItem
6263
* // AlarmName: "STRING_VALUE",
64+
* // AlarmContributorId: "STRING_VALUE",
6365
* // AlarmType: "CompositeAlarm" || "MetricAlarm",
6466
* // Timestamp: new Date("TIMESTAMP"),
65-
* // HistoryItemType: "ConfigurationUpdate" || "StateUpdate" || "Action",
67+
* // HistoryItemType: "ConfigurationUpdate" || "StateUpdate" || "Action" || "AlarmContributorStateUpdate" || "AlarmContributorAction",
6668
* // HistorySummary: "STRING_VALUE",
6769
* // HistoryData: "STRING_VALUE",
70+
* // AlarmContributorAttributes: { // ContributorAttributes
71+
* // "<keys>": "STRING_VALUE",
72+
* // },
6873
* // },
6974
* // ],
7075
* // NextToken: "STRING_VALUE",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from "./DeleteAnomalyDetectorCommand";
44
export * from "./DeleteDashboardsCommand";
55
export * from "./DeleteInsightRulesCommand";
66
export * from "./DeleteMetricStreamCommand";
7+
export * from "./DescribeAlarmContributorsCommand";
78
export * from "./DescribeAlarmHistoryCommand";
89
export * from "./DescribeAlarmsCommand";
910
export * from "./DescribeAlarmsForMetricCommand";

0 commit comments

Comments
 (0)