Skip to content

Commit a78717e

Browse files
author
awstools
committed
feat(client-cloudwatch-logs): Added APIs to Create, Update, Get, List and Delete LogAnomalyDetectors and List and Update Anomalies in Detector. Added LogGroupClass attribute for LogGroups to classify loggroup as Standard loggroup with all capabilities or InfrequentAccess loggroup with limited capabilities.
1 parent bb577d1 commit a78717e

23 files changed

+4087
-29
lines changed

clients/client-cloudwatch-logs/README.md

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ using your favorite package manager:
5757

5858
The AWS SDK is modulized by clients and commands.
5959
To send a request, you only need to import the `CloudWatchLogsClient` and
60-
the commands you need, for example `ListTagsLogGroupCommand`:
60+
the commands you need, for example `ListAnomaliesCommand`:
6161

6262
```js
6363
// ES5 example
64-
const { CloudWatchLogsClient, ListTagsLogGroupCommand } = require("@aws-sdk/client-cloudwatch-logs");
64+
const { CloudWatchLogsClient, ListAnomaliesCommand } = require("@aws-sdk/client-cloudwatch-logs");
6565
```
6666

6767
```ts
6868
// ES6+ example
69-
import { CloudWatchLogsClient, ListTagsLogGroupCommand } from "@aws-sdk/client-cloudwatch-logs";
69+
import { CloudWatchLogsClient, ListAnomaliesCommand } from "@aws-sdk/client-cloudwatch-logs";
7070
```
7171

7272
### Usage
@@ -85,7 +85,7 @@ const client = new CloudWatchLogsClient({ region: "REGION" });
8585
const params = {
8686
/** input parameters */
8787
};
88-
const command = new ListTagsLogGroupCommand(params);
88+
const command = new ListAnomaliesCommand(params);
8989
```
9090

9191
#### Async/await
@@ -164,15 +164,15 @@ const client = new AWS.CloudWatchLogs({ region: "REGION" });
164164

165165
// async/await.
166166
try {
167-
const data = await client.listTagsLogGroup(params);
167+
const data = await client.listAnomalies(params);
168168
// process data.
169169
} catch (error) {
170170
// error handling.
171171
}
172172

173173
// Promises.
174174
client
175-
.listTagsLogGroup(params)
175+
.listAnomalies(params)
176176
.then((data) => {
177177
// process data.
178178
})
@@ -181,7 +181,7 @@ client
181181
});
182182

183183
// callbacks.
184-
client.listTagsLogGroup(params, (err, data) => {
184+
client.listAnomalies(params, (err, data) => {
185185
// process err and data.
186186
});
187187
```
@@ -268,6 +268,14 @@ CreateExportTask
268268

269269
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/CreateExportTaskCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/CreateExportTaskCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/CreateExportTaskCommandOutput/)
270270

271+
</details>
272+
<details>
273+
<summary>
274+
CreateLogAnomalyDetector
275+
</summary>
276+
277+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/CreateLogAnomalyDetectorCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/CreateLogAnomalyDetectorCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/CreateLogAnomalyDetectorCommandOutput/)
278+
271279
</details>
272280
<details>
273281
<summary>
@@ -340,6 +348,14 @@ DeleteDestination
340348

341349
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/DeleteDestinationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/DeleteDestinationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/DeleteDestinationCommandOutput/)
342350

351+
</details>
352+
<details>
353+
<summary>
354+
DeleteLogAnomalyDetector
355+
</summary>
356+
357+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/DeleteLogAnomalyDetectorCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/DeleteLogAnomalyDetectorCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/DeleteLogAnomalyDetectorCommandOutput/)
358+
343359
</details>
344360
<details>
345361
<summary>
@@ -556,6 +572,14 @@ GetDeliverySource
556572

557573
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/GetDeliverySourceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/GetDeliverySourceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/GetDeliverySourceCommandOutput/)
558574

575+
</details>
576+
<details>
577+
<summary>
578+
GetLogAnomalyDetector
579+
</summary>
580+
581+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/GetLogAnomalyDetectorCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/GetLogAnomalyDetectorCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/GetLogAnomalyDetectorCommandOutput/)
582+
559583
</details>
560584
<details>
561585
<summary>
@@ -588,6 +612,22 @@ GetQueryResults
588612

589613
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/GetQueryResultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/GetQueryResultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/GetQueryResultsCommandOutput/)
590614

615+
</details>
616+
<details>
617+
<summary>
618+
ListAnomalies
619+
</summary>
620+
621+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/ListAnomaliesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/ListAnomaliesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/ListAnomaliesCommandOutput/)
622+
623+
</details>
624+
<details>
625+
<summary>
626+
ListLogAnomalyDetectors
627+
</summary>
628+
629+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/ListLogAnomalyDetectorsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/ListLogAnomalyDetectorsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/ListLogAnomalyDetectorsCommandOutput/)
630+
591631
</details>
592632
<details>
593633
<summary>
@@ -765,3 +805,19 @@ UntagResource
765805
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/UntagResourceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/UntagResourceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/UntagResourceCommandOutput/)
766806

767807
</details>
808+
<details>
809+
<summary>
810+
UpdateAnomaly
811+
</summary>
812+
813+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/UpdateAnomalyCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/UpdateAnomalyCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/UpdateAnomalyCommandOutput/)
814+
815+
</details>
816+
<details>
817+
<summary>
818+
UpdateLogAnomalyDetector
819+
</summary>
820+
821+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/UpdateLogAnomalyDetectorCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/UpdateLogAnomalyDetectorCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cloudwatch-logs/Interface/UpdateLogAnomalyDetectorCommandOutput/)
822+
823+
</details>

clients/client-cloudwatch-logs/src/CloudWatchLogs.ts

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ import {
2323
CreateExportTaskCommandInput,
2424
CreateExportTaskCommandOutput,
2525
} from "./commands/CreateExportTaskCommand";
26+
import {
27+
CreateLogAnomalyDetectorCommand,
28+
CreateLogAnomalyDetectorCommandInput,
29+
CreateLogAnomalyDetectorCommandOutput,
30+
} from "./commands/CreateLogAnomalyDetectorCommand";
2631
import {
2732
CreateLogGroupCommand,
2833
CreateLogGroupCommandInput,
@@ -68,6 +73,11 @@ import {
6873
DeleteDestinationCommandInput,
6974
DeleteDestinationCommandOutput,
7075
} from "./commands/DeleteDestinationCommand";
76+
import {
77+
DeleteLogAnomalyDetectorCommand,
78+
DeleteLogAnomalyDetectorCommandInput,
79+
DeleteLogAnomalyDetectorCommandOutput,
80+
} from "./commands/DeleteLogAnomalyDetectorCommand";
7181
import {
7282
DeleteLogGroupCommand,
7383
DeleteLogGroupCommandInput,
@@ -199,6 +209,11 @@ import {
199209
GetDeliverySourceCommandInput,
200210
GetDeliverySourceCommandOutput,
201211
} from "./commands/GetDeliverySourceCommand";
212+
import {
213+
GetLogAnomalyDetectorCommand,
214+
GetLogAnomalyDetectorCommandInput,
215+
GetLogAnomalyDetectorCommandOutput,
216+
} from "./commands/GetLogAnomalyDetectorCommand";
202217
import {
203218
GetLogEventsCommand,
204219
GetLogEventsCommandInput,
@@ -219,6 +234,16 @@ import {
219234
GetQueryResultsCommandInput,
220235
GetQueryResultsCommandOutput,
221236
} from "./commands/GetQueryResultsCommand";
237+
import {
238+
ListAnomaliesCommand,
239+
ListAnomaliesCommandInput,
240+
ListAnomaliesCommandOutput,
241+
} from "./commands/ListAnomaliesCommand";
242+
import {
243+
ListLogAnomalyDetectorsCommand,
244+
ListLogAnomalyDetectorsCommandInput,
245+
ListLogAnomalyDetectorsCommandOutput,
246+
} from "./commands/ListLogAnomalyDetectorsCommand";
222247
import {
223248
ListTagsForResourceCommand,
224249
ListTagsForResourceCommandInput,
@@ -313,12 +338,23 @@ import {
313338
UntagResourceCommandInput,
314339
UntagResourceCommandOutput,
315340
} from "./commands/UntagResourceCommand";
341+
import {
342+
UpdateAnomalyCommand,
343+
UpdateAnomalyCommandInput,
344+
UpdateAnomalyCommandOutput,
345+
} from "./commands/UpdateAnomalyCommand";
346+
import {
347+
UpdateLogAnomalyDetectorCommand,
348+
UpdateLogAnomalyDetectorCommandInput,
349+
UpdateLogAnomalyDetectorCommandOutput,
350+
} from "./commands/UpdateLogAnomalyDetectorCommand";
316351

317352
const commands = {
318353
AssociateKmsKeyCommand,
319354
CancelExportTaskCommand,
320355
CreateDeliveryCommand,
321356
CreateExportTaskCommand,
357+
CreateLogAnomalyDetectorCommand,
322358
CreateLogGroupCommand,
323359
CreateLogStreamCommand,
324360
DeleteAccountPolicyCommand,
@@ -328,6 +364,7 @@ const commands = {
328364
DeleteDeliveryDestinationPolicyCommand,
329365
DeleteDeliverySourceCommand,
330366
DeleteDestinationCommand,
367+
DeleteLogAnomalyDetectorCommand,
331368
DeleteLogGroupCommand,
332369
DeleteLogStreamCommand,
333370
DeleteMetricFilterCommand,
@@ -355,10 +392,13 @@ const commands = {
355392
GetDeliveryDestinationCommand,
356393
GetDeliveryDestinationPolicyCommand,
357394
GetDeliverySourceCommand,
395+
GetLogAnomalyDetectorCommand,
358396
GetLogEventsCommand,
359397
GetLogGroupFieldsCommand,
360398
GetLogRecordCommand,
361399
GetQueryResultsCommand,
400+
ListAnomaliesCommand,
401+
ListLogAnomalyDetectorsCommand,
362402
ListTagsForResourceCommand,
363403
ListTagsLogGroupCommand,
364404
PutAccountPolicyCommand,
@@ -381,6 +421,8 @@ const commands = {
381421
TestMetricFilterCommand,
382422
UntagLogGroupCommand,
383423
UntagResourceCommand,
424+
UpdateAnomalyCommand,
425+
UpdateLogAnomalyDetectorCommand,
384426
};
385427

386428
export interface CloudWatchLogs {
@@ -446,6 +488,23 @@ export interface CloudWatchLogs {
446488
cb: (err: any, data?: CreateExportTaskCommandOutput) => void
447489
): void;
448490

491+
/**
492+
* @see {@link CreateLogAnomalyDetectorCommand}
493+
*/
494+
createLogAnomalyDetector(
495+
args: CreateLogAnomalyDetectorCommandInput,
496+
options?: __HttpHandlerOptions
497+
): Promise<CreateLogAnomalyDetectorCommandOutput>;
498+
createLogAnomalyDetector(
499+
args: CreateLogAnomalyDetectorCommandInput,
500+
cb: (err: any, data?: CreateLogAnomalyDetectorCommandOutput) => void
501+
): void;
502+
createLogAnomalyDetector(
503+
args: CreateLogAnomalyDetectorCommandInput,
504+
options: __HttpHandlerOptions,
505+
cb: (err: any, data?: CreateLogAnomalyDetectorCommandOutput) => void
506+
): void;
507+
449508
/**
450509
* @see {@link CreateLogGroupCommand}
451510
*/
@@ -590,6 +649,23 @@ export interface CloudWatchLogs {
590649
cb: (err: any, data?: DeleteDestinationCommandOutput) => void
591650
): void;
592651

652+
/**
653+
* @see {@link DeleteLogAnomalyDetectorCommand}
654+
*/
655+
deleteLogAnomalyDetector(
656+
args: DeleteLogAnomalyDetectorCommandInput,
657+
options?: __HttpHandlerOptions
658+
): Promise<DeleteLogAnomalyDetectorCommandOutput>;
659+
deleteLogAnomalyDetector(
660+
args: DeleteLogAnomalyDetectorCommandInput,
661+
cb: (err: any, data?: DeleteLogAnomalyDetectorCommandOutput) => void
662+
): void;
663+
deleteLogAnomalyDetector(
664+
args: DeleteLogAnomalyDetectorCommandInput,
665+
options: __HttpHandlerOptions,
666+
cb: (err: any, data?: DeleteLogAnomalyDetectorCommandOutput) => void
667+
): void;
668+
593669
/**
594670
* @see {@link DeleteLogGroupCommand}
595671
*/
@@ -1031,6 +1107,23 @@ export interface CloudWatchLogs {
10311107
cb: (err: any, data?: GetDeliverySourceCommandOutput) => void
10321108
): void;
10331109

1110+
/**
1111+
* @see {@link GetLogAnomalyDetectorCommand}
1112+
*/
1113+
getLogAnomalyDetector(
1114+
args: GetLogAnomalyDetectorCommandInput,
1115+
options?: __HttpHandlerOptions
1116+
): Promise<GetLogAnomalyDetectorCommandOutput>;
1117+
getLogAnomalyDetector(
1118+
args: GetLogAnomalyDetectorCommandInput,
1119+
cb: (err: any, data?: GetLogAnomalyDetectorCommandOutput) => void
1120+
): void;
1121+
getLogAnomalyDetector(
1122+
args: GetLogAnomalyDetectorCommandInput,
1123+
options: __HttpHandlerOptions,
1124+
cb: (err: any, data?: GetLogAnomalyDetectorCommandOutput) => void
1125+
): void;
1126+
10341127
/**
10351128
* @see {@link GetLogEventsCommand}
10361129
*/
@@ -1084,6 +1177,34 @@ export interface CloudWatchLogs {
10841177
cb: (err: any, data?: GetQueryResultsCommandOutput) => void
10851178
): void;
10861179

1180+
/**
1181+
* @see {@link ListAnomaliesCommand}
1182+
*/
1183+
listAnomalies(args: ListAnomaliesCommandInput, options?: __HttpHandlerOptions): Promise<ListAnomaliesCommandOutput>;
1184+
listAnomalies(args: ListAnomaliesCommandInput, cb: (err: any, data?: ListAnomaliesCommandOutput) => void): void;
1185+
listAnomalies(
1186+
args: ListAnomaliesCommandInput,
1187+
options: __HttpHandlerOptions,
1188+
cb: (err: any, data?: ListAnomaliesCommandOutput) => void
1189+
): void;
1190+
1191+
/**
1192+
* @see {@link ListLogAnomalyDetectorsCommand}
1193+
*/
1194+
listLogAnomalyDetectors(
1195+
args: ListLogAnomalyDetectorsCommandInput,
1196+
options?: __HttpHandlerOptions
1197+
): Promise<ListLogAnomalyDetectorsCommandOutput>;
1198+
listLogAnomalyDetectors(
1199+
args: ListLogAnomalyDetectorsCommandInput,
1200+
cb: (err: any, data?: ListLogAnomalyDetectorsCommandOutput) => void
1201+
): void;
1202+
listLogAnomalyDetectors(
1203+
args: ListLogAnomalyDetectorsCommandInput,
1204+
options: __HttpHandlerOptions,
1205+
cb: (err: any, data?: ListLogAnomalyDetectorsCommandOutput) => void
1206+
): void;
1207+
10871208
/**
10881209
* @see {@link ListTagsForResourceCommand}
10891210
*/
@@ -1409,6 +1530,34 @@ export interface CloudWatchLogs {
14091530
options: __HttpHandlerOptions,
14101531
cb: (err: any, data?: UntagResourceCommandOutput) => void
14111532
): void;
1533+
1534+
/**
1535+
* @see {@link UpdateAnomalyCommand}
1536+
*/
1537+
updateAnomaly(args: UpdateAnomalyCommandInput, options?: __HttpHandlerOptions): Promise<UpdateAnomalyCommandOutput>;
1538+
updateAnomaly(args: UpdateAnomalyCommandInput, cb: (err: any, data?: UpdateAnomalyCommandOutput) => void): void;
1539+
updateAnomaly(
1540+
args: UpdateAnomalyCommandInput,
1541+
options: __HttpHandlerOptions,
1542+
cb: (err: any, data?: UpdateAnomalyCommandOutput) => void
1543+
): void;
1544+
1545+
/**
1546+
* @see {@link UpdateLogAnomalyDetectorCommand}
1547+
*/
1548+
updateLogAnomalyDetector(
1549+
args: UpdateLogAnomalyDetectorCommandInput,
1550+
options?: __HttpHandlerOptions
1551+
): Promise<UpdateLogAnomalyDetectorCommandOutput>;
1552+
updateLogAnomalyDetector(
1553+
args: UpdateLogAnomalyDetectorCommandInput,
1554+
cb: (err: any, data?: UpdateLogAnomalyDetectorCommandOutput) => void
1555+
): void;
1556+
updateLogAnomalyDetector(
1557+
args: UpdateLogAnomalyDetectorCommandInput,
1558+
options: __HttpHandlerOptions,
1559+
cb: (err: any, data?: UpdateLogAnomalyDetectorCommandOutput) => void
1560+
): void;
14121561
}
14131562

14141563
/**

0 commit comments

Comments
 (0)