Skip to content

Commit c97217f

Browse files
author
awstools
committed
feat(client-cloudwatch-logs): SDK release to support tagging for destinations and log groups with TagResource. Also supports tag on create with PutDestination.
1 parent 9e340c3 commit c97217f

File tree

13 files changed

+1675
-513
lines changed

13 files changed

+1675
-513
lines changed

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

Lines changed: 140 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ import {
142142
GetQueryResultsCommandInput,
143143
GetQueryResultsCommandOutput,
144144
} from "./commands/GetQueryResultsCommand";
145+
import {
146+
ListTagsForResourceCommand,
147+
ListTagsForResourceCommandInput,
148+
ListTagsForResourceCommandOutput,
149+
} from "./commands/ListTagsForResourceCommand";
145150
import {
146151
ListTagsLogGroupCommand,
147152
ListTagsLogGroupCommandInput,
@@ -190,6 +195,7 @@ import {
190195
import { StartQueryCommand, StartQueryCommandInput, StartQueryCommandOutput } from "./commands/StartQueryCommand";
191196
import { StopQueryCommand, StopQueryCommandInput, StopQueryCommandOutput } from "./commands/StopQueryCommand";
192197
import { TagLogGroupCommand, TagLogGroupCommandInput, TagLogGroupCommandOutput } from "./commands/TagLogGroupCommand";
198+
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
193199
import {
194200
TestMetricFilterCommand,
195201
TestMetricFilterCommandInput,
@@ -200,6 +206,11 @@ import {
200206
UntagLogGroupCommandInput,
201207
UntagLogGroupCommandOutput,
202208
} from "./commands/UntagLogGroupCommand";
209+
import {
210+
UntagResourceCommand,
211+
UntagResourceCommandInput,
212+
UntagResourceCommandOutput,
213+
} from "./commands/UntagResourceCommand";
203214

204215
/**
205216
* <p>You can use Amazon CloudWatch Logs to monitor, store, and access your log files from
@@ -320,12 +331,6 @@ export class CloudWatchLogs extends CloudWatchLogsClient {
320331
* log group to an Amazon S3 bucket. When you perform a <code>CreateExportTask</code>
321332
* operation, you must use credentials that have permission to write to the S3 bucket
322333
* that you specify as the destination.</p>
323-
* <important>
324-
* <p>Exporting log data to Amazon S3 buckets that are encrypted by KMS is not
325-
* supported. Exporting
326-
* log data to Amazon S3 buckets that have S3 Object Lock enabled with a retention period is not supported.</p>
327-
* <p>Exporting to S3 buckets that are encrypted with AES-256 is supported. </p>
328-
* </important>
329334
* <p>This is an asynchronous call. If all the required information is provided, this
330335
* operation initiates an export task and responds with the ID of the task. After the task has started,
331336
* you can use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeExportTasks.html">DescribeExportTasks</a> to get the status of the export task. Each account can
@@ -334,11 +339,8 @@ export class CloudWatchLogs extends CloudWatchLogsClient {
334339
* <p>You can export logs from multiple log groups or multiple time ranges to the same S3
335340
* bucket. To separate out log data for each export task, you can specify a prefix to be used as
336341
* the Amazon S3 key prefix for all exported objects.</p>
337-
*
338-
* <note>
339-
* <p>Time-based sorting on chunks of log data inside an exported file is not guaranteed. You can sort the
340-
* exported log fild data by using Linux utilities.</p>
341-
* </note>
342+
* <p>Exporting to S3 buckets that are encrypted with AES-256 is supported. Exporting to S3 buckets
343+
* encrypted with SSE-KMS is not supported. </p>
342344
*/
343345
public createExportTask(
344346
args: CreateExportTaskCommandInput,
@@ -1271,7 +1273,46 @@ export class CloudWatchLogs extends CloudWatchLogsClient {
12711273
}
12721274

12731275
/**
1274-
* <p>Lists the tags for the specified log group.</p>
1276+
* <p>Displays the tags associated with a CloudWatch Logs resource. Currently, log groups
1277+
* and destinations support tagging.</p>
1278+
*/
1279+
public listTagsForResource(
1280+
args: ListTagsForResourceCommandInput,
1281+
options?: __HttpHandlerOptions
1282+
): Promise<ListTagsForResourceCommandOutput>;
1283+
public listTagsForResource(
1284+
args: ListTagsForResourceCommandInput,
1285+
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
1286+
): void;
1287+
public listTagsForResource(
1288+
args: ListTagsForResourceCommandInput,
1289+
options: __HttpHandlerOptions,
1290+
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
1291+
): void;
1292+
public listTagsForResource(
1293+
args: ListTagsForResourceCommandInput,
1294+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListTagsForResourceCommandOutput) => void),
1295+
cb?: (err: any, data?: ListTagsForResourceCommandOutput) => void
1296+
): Promise<ListTagsForResourceCommandOutput> | void {
1297+
const command = new ListTagsForResourceCommand(args);
1298+
if (typeof optionsOrCb === "function") {
1299+
this.send(command, optionsOrCb);
1300+
} else if (typeof cb === "function") {
1301+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1302+
this.send(command, optionsOrCb || {}, cb);
1303+
} else {
1304+
return this.send(command, optionsOrCb);
1305+
}
1306+
}
1307+
1308+
/**
1309+
* @deprecated
1310+
*
1311+
* <important>
1312+
* <p>The ListTagsLogGroup operation is on the path to deprecation. We recommend that you use
1313+
* <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html">ListTagsForResource</a> instead.</p>
1314+
* </important>
1315+
* <p>Lists the tags for the specified log group.</p>
12751316
*/
12761317
public listTagsLogGroup(
12771318
args: ListTagsLogGroupCommandInput,
@@ -1730,9 +1771,15 @@ export class CloudWatchLogs extends CloudWatchLogsClient {
17301771
}
17311772

17321773
/**
1733-
* <p>Adds or updates the specified tags for the specified log group.</p>
1734-
* <p>To list the tags for a log group, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsLogGroup.html">ListTagsLogGroup</a>.
1735-
* To remove tags, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagLogGroup.html">UntagLogGroup</a>.</p>
1774+
* @deprecated
1775+
*
1776+
* <important>
1777+
* <p>The TagLogGroup operation is on the path to deprecation. We recommend that you use
1778+
* <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html">TagResource</a> instead.</p>
1779+
* </important>
1780+
* <p>Adds or updates the specified tags for the specified log group.</p>
1781+
* <p>To list the tags for a log group, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html">ListTagsForResource</a>.
1782+
* To remove tags, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html">UntagResource</a>.</p>
17361783
* <p>For more information about tags, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html#log-group-tagging">Tag Log Groups in Amazon CloudWatch Logs</a>
17371784
* in the <i>Amazon CloudWatch Logs User Guide</i>.</p>
17381785
* <p>CloudWatch Logs doesn’t support IAM policies that prevent users from assigning specified tags to
@@ -1764,6 +1811,43 @@ export class CloudWatchLogs extends CloudWatchLogsClient {
17641811
}
17651812
}
17661813

1814+
/**
1815+
* <p>Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs resource.
1816+
* Currently, the only CloudWatch Logs resources that
1817+
* can be tagged are log groups and destinations. </p>
1818+
* <p>Tags can help you organize and categorize your resources. You can also use them to scope user
1819+
* permissions by granting a user
1820+
* permission to access or change only resources with certain tag values.</p>
1821+
* <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
1822+
* <p>You can use the <code>TagResource</code> action with a resource that already has tags. If you specify a new tag key for the alarm,
1823+
* this tag is appended to the list of tags associated
1824+
* with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces
1825+
* the previous value for that tag.</p>
1826+
* <p>You can associate as many as 50 tags with a CloudWatch Logs resource.</p>
1827+
*/
1828+
public tagResource(args: TagResourceCommandInput, options?: __HttpHandlerOptions): Promise<TagResourceCommandOutput>;
1829+
public tagResource(args: TagResourceCommandInput, cb: (err: any, data?: TagResourceCommandOutput) => void): void;
1830+
public tagResource(
1831+
args: TagResourceCommandInput,
1832+
options: __HttpHandlerOptions,
1833+
cb: (err: any, data?: TagResourceCommandOutput) => void
1834+
): void;
1835+
public tagResource(
1836+
args: TagResourceCommandInput,
1837+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TagResourceCommandOutput) => void),
1838+
cb?: (err: any, data?: TagResourceCommandOutput) => void
1839+
): Promise<TagResourceCommandOutput> | void {
1840+
const command = new TagResourceCommand(args);
1841+
if (typeof optionsOrCb === "function") {
1842+
this.send(command, optionsOrCb);
1843+
} else if (typeof cb === "function") {
1844+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1845+
this.send(command, optionsOrCb || {}, cb);
1846+
} else {
1847+
return this.send(command, optionsOrCb);
1848+
}
1849+
}
1850+
17671851
/**
17681852
* <p>Tests the filter pattern of a metric filter against a sample of log event messages. You
17691853
* can use this operation to validate the correctness of a metric filter pattern.</p>
@@ -1798,9 +1882,15 @@ export class CloudWatchLogs extends CloudWatchLogsClient {
17981882
}
17991883

18001884
/**
1801-
* <p>Removes the specified tags from the specified log group.</p>
1802-
* <p>To list the tags for a log group, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsLogGroup.html">ListTagsLogGroup</a>.
1803-
* To add tags, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagLogGroup.html">TagLogGroup</a>.</p>
1885+
* @deprecated
1886+
*
1887+
* <important>
1888+
* <p>The UntagLogGroup operation is on the path to deprecation. We recommend that you use
1889+
* <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html">UntagResource</a> instead.</p>
1890+
* </important>
1891+
* <p>Removes the specified tags from the specified log group.</p>
1892+
* <p>To list the tags for a log group, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html">ListTagsForResource</a>.
1893+
* To add tags, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html">TagResource</a>.</p>
18041894
* <p>CloudWatch Logs doesn’t support IAM policies that prevent users from assigning specified tags to
18051895
* log groups using the <code>aws:Resource/<i>key-name</i>
18061896
* </code> or <code>aws:TagKeys</code> condition keys.
@@ -1834,4 +1924,36 @@ export class CloudWatchLogs extends CloudWatchLogsClient {
18341924
return this.send(command, optionsOrCb);
18351925
}
18361926
}
1927+
1928+
/**
1929+
* <p>Removes one or more tags from the specified resource.</p>
1930+
*/
1931+
public untagResource(
1932+
args: UntagResourceCommandInput,
1933+
options?: __HttpHandlerOptions
1934+
): Promise<UntagResourceCommandOutput>;
1935+
public untagResource(
1936+
args: UntagResourceCommandInput,
1937+
cb: (err: any, data?: UntagResourceCommandOutput) => void
1938+
): void;
1939+
public untagResource(
1940+
args: UntagResourceCommandInput,
1941+
options: __HttpHandlerOptions,
1942+
cb: (err: any, data?: UntagResourceCommandOutput) => void
1943+
): void;
1944+
public untagResource(
1945+
args: UntagResourceCommandInput,
1946+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UntagResourceCommandOutput) => void),
1947+
cb?: (err: any, data?: UntagResourceCommandOutput) => void
1948+
): Promise<UntagResourceCommandOutput> | void {
1949+
const command = new UntagResourceCommand(args);
1950+
if (typeof optionsOrCb === "function") {
1951+
this.send(command, optionsOrCb);
1952+
} else if (typeof cb === "function") {
1953+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1954+
this.send(command, optionsOrCb || {}, cb);
1955+
} else {
1956+
return this.send(command, optionsOrCb);
1957+
}
1958+
}
18371959
}

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ import { GetLogEventsCommandInput, GetLogEventsCommandOutput } from "./commands/
105105
import { GetLogGroupFieldsCommandInput, GetLogGroupFieldsCommandOutput } from "./commands/GetLogGroupFieldsCommand";
106106
import { GetLogRecordCommandInput, GetLogRecordCommandOutput } from "./commands/GetLogRecordCommand";
107107
import { GetQueryResultsCommandInput, GetQueryResultsCommandOutput } from "./commands/GetQueryResultsCommand";
108+
import {
109+
ListTagsForResourceCommandInput,
110+
ListTagsForResourceCommandOutput,
111+
} from "./commands/ListTagsForResourceCommand";
108112
import { ListTagsLogGroupCommandInput, ListTagsLogGroupCommandOutput } from "./commands/ListTagsLogGroupCommand";
109113
import { PutDestinationCommandInput, PutDestinationCommandOutput } from "./commands/PutDestinationCommand";
110114
import {
@@ -123,8 +127,10 @@ import {
123127
import { StartQueryCommandInput, StartQueryCommandOutput } from "./commands/StartQueryCommand";
124128
import { StopQueryCommandInput, StopQueryCommandOutput } from "./commands/StopQueryCommand";
125129
import { TagLogGroupCommandInput, TagLogGroupCommandOutput } from "./commands/TagLogGroupCommand";
130+
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
126131
import { TestMetricFilterCommandInput, TestMetricFilterCommandOutput } from "./commands/TestMetricFilterCommand";
127132
import { UntagLogGroupCommandInput, UntagLogGroupCommandOutput } from "./commands/UntagLogGroupCommand";
133+
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
128134
import {
129135
ClientInputEndpointParameters,
130136
ClientResolvedEndpointParameters,
@@ -162,6 +168,7 @@ export type ServiceInputTypes =
162168
| GetLogGroupFieldsCommandInput
163169
| GetLogRecordCommandInput
164170
| GetQueryResultsCommandInput
171+
| ListTagsForResourceCommandInput
165172
| ListTagsLogGroupCommandInput
166173
| PutDestinationCommandInput
167174
| PutDestinationPolicyCommandInput
@@ -174,8 +181,10 @@ export type ServiceInputTypes =
174181
| StartQueryCommandInput
175182
| StopQueryCommandInput
176183
| TagLogGroupCommandInput
184+
| TagResourceCommandInput
177185
| TestMetricFilterCommandInput
178-
| UntagLogGroupCommandInput;
186+
| UntagLogGroupCommandInput
187+
| UntagResourceCommandInput;
179188

180189
export type ServiceOutputTypes =
181190
| AssociateKmsKeyCommandOutput
@@ -206,6 +215,7 @@ export type ServiceOutputTypes =
206215
| GetLogGroupFieldsCommandOutput
207216
| GetLogRecordCommandOutput
208217
| GetQueryResultsCommandOutput
218+
| ListTagsForResourceCommandOutput
209219
| ListTagsLogGroupCommandOutput
210220
| PutDestinationCommandOutput
211221
| PutDestinationPolicyCommandOutput
@@ -218,8 +228,10 @@ export type ServiceOutputTypes =
218228
| StartQueryCommandOutput
219229
| StopQueryCommandOutput
220230
| TagLogGroupCommandOutput
231+
| TagResourceCommandOutput
221232
| TestMetricFilterCommandOutput
222-
| UntagLogGroupCommandOutput;
233+
| UntagLogGroupCommandOutput
234+
| UntagResourceCommandOutput;
223235

224236
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
225237
/**

clients/client-cloudwatch-logs/src/commands/CreateExportTaskCommand.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ export interface CreateExportTaskCommandOutput extends CreateExportTaskResponse,
3333
* log group to an Amazon S3 bucket. When you perform a <code>CreateExportTask</code>
3434
* operation, you must use credentials that have permission to write to the S3 bucket
3535
* that you specify as the destination.</p>
36-
* <important>
37-
* <p>Exporting log data to Amazon S3 buckets that are encrypted by KMS is not
38-
* supported. Exporting
39-
* log data to Amazon S3 buckets that have S3 Object Lock enabled with a retention period is not supported.</p>
40-
* <p>Exporting to S3 buckets that are encrypted with AES-256 is supported. </p>
41-
* </important>
4236
* <p>This is an asynchronous call. If all the required information is provided, this
4337
* operation initiates an export task and responds with the ID of the task. After the task has started,
4438
* you can use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeExportTasks.html">DescribeExportTasks</a> to get the status of the export task. Each account can
@@ -47,11 +41,8 @@ export interface CreateExportTaskCommandOutput extends CreateExportTaskResponse,
4741
* <p>You can export logs from multiple log groups or multiple time ranges to the same S3
4842
* bucket. To separate out log data for each export task, you can specify a prefix to be used as
4943
* the Amazon S3 key prefix for all exported objects.</p>
50-
*
51-
* <note>
52-
* <p>Time-based sorting on chunks of log data inside an exported file is not guaranteed. You can sort the
53-
* exported log fild data by using Linux utilities.</p>
54-
* </note>
44+
* <p>Exporting to S3 buckets that are encrypted with AES-256 is supported. Exporting to S3 buckets
45+
* encrypted with SSE-KMS is not supported. </p>
5546
* @example
5647
* Use a bare-bones client and the command you need to make an API call.
5748
* ```javascript

0 commit comments

Comments
 (0)