Skip to content

Commit f2d4554

Browse files
author
awstools
committed
feat(client-cloudwatch-logs): Add ClientToken to QueryDefinition CFN Handler in CWL
1 parent 24d8dfe commit f2d4554

File tree

8 files changed

+53
-11
lines changed

8 files changed

+53
-11
lines changed

clients/client-cloudwatch-logs/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@
5555
"@smithy/util-defaults-mode-node": "^2.0.10",
5656
"@smithy/util-retry": "^2.0.0",
5757
"@smithy/util-utf8": "^2.0.0",
58-
"tslib": "^2.5.0"
58+
"tslib": "^2.5.0",
59+
"uuid": "^8.3.2"
5960
},
6061
"devDependencies": {
6162
"@smithy/service-client-documentation-generator": "^2.0.0",
6263
"@tsconfig/node14": "1.0.3",
6364
"@types/node": "^14.14.31",
65+
"@types/uuid": "^8.3.0",
6466
"concurrently": "7.0.0",
6567
"downlevel-dts": "0.10.1",
6668
"rimraf": "3.0.2",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface CreateLogGroupCommandOutput extends __MetadataBearer {}
3636

3737
/**
3838
* @public
39-
* <p>Creates a log group with the specified name. You can create up to 20,000 log groups per account.</p>
39+
* <p>Creates a log group with the specified name. You can create up to 1,000,000 log groups per Region per account.</p>
4040
* <p>You must use the following guidelines when naming a log group:</p>
4141
* <ul>
4242
* <li>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ export interface PutMetricFilterCommandOutput extends __MetadataBearer {}
5050
* found for
5151
* a dimension is treated as a separate metric and accrues charges as a separate custom metric.
5252
* </p>
53-
* <p>CloudWatch Logs disables a metric filter if it generates 1,000 different name/value pairs for
54-
* your specified dimensions within a certain amount of time. This helps to prevent accidental
55-
* high charges.</p>
53+
* <p>CloudWatch Logs might disable a metric filter if it generates 1,000 different name/value pairs for
54+
* your specified dimensions within one hour.</p>
5655
* <p>You can also set up a billing alarm to alert you if your charges are higher than
5756
* expected. For more information,
5857
* see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html">

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export interface PutQueryDefinitionCommandOutput extends PutQueryDefinitionRespo
6060
* "STRING_VALUE",
6161
* ],
6262
* queryString: "STRING_VALUE", // required
63+
* clientToken: "STRING_VALUE",
6364
* };
6465
* const command = new PutQueryDefinitionCommand(input);
6566
* const response = await client.send(command);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export interface PutRetentionPolicyCommandOutput extends __MetadataBearer {}
5050
* retention setting until 72 hours after the previous retention period ends. Alternatively,
5151
* wait to change the retention setting until you confirm that the earlier log events are
5252
* deleted. </p>
53+
* <p>When log events reach their retention setting they are marked for deletion. After
54+
* they are marked for deletion, they do not add to your archival storage costs anymore, even if
55+
* they are not actually deleted until later. These log events marked for deletion are also not
56+
* included when you use an API to retrieve the <code>storedBytes</code> value to see how many bytes a log group is storing.</p>
5357
* </note>
5458
* @example
5559
* Use a bare-bones client and the command you need to make an API call.

clients/client-cloudwatch-logs/src/models/models_0.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,6 +2882,13 @@ export interface PutQueryDefinitionRequest {
28822882
* For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html">CloudWatch Logs Insights Query Syntax</a>.</p>
28832883
*/
28842884
queryString: string | undefined;
2885+
2886+
/**
2887+
* @public
2888+
* <p>Used as an idempotency token, to avoid returning an exception if the service receives the same request twice because of a network
2889+
* error.</p>
2890+
*/
2891+
clientToken?: string;
28852892
}
28862893

28872894
/**

clients/client-cloudwatch-logs/src/protocols/Aws_json1_1.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
ResponseMetadata as __ResponseMetadata,
1818
SerdeContext as __SerdeContext,
1919
} from "@smithy/types";
20+
import { v4 as generateIdempotencyToken } from "uuid";
2021

2122
import { AssociateKmsKeyCommandInput, AssociateKmsKeyCommandOutput } from "../commands/AssociateKmsKeyCommand";
2223
import { CancelExportTaskCommandInput, CancelExportTaskCommandOutput } from "../commands/CancelExportTaskCommand";
@@ -725,7 +726,7 @@ export const se_PutQueryDefinitionCommand = async (
725726
): Promise<__HttpRequest> => {
726727
const headers: __HeaderBag = sharedHeaders("PutQueryDefinition");
727728
let body: any;
728-
body = JSON.stringify(_json(input));
729+
body = JSON.stringify(se_PutQueryDefinitionRequest(input, context));
729730
return buildHttpRpcRequest(context, headers, "/", undefined, body);
730731
};
731732

@@ -3844,7 +3845,18 @@ const se_PutMetricFilterRequest = (input: PutMetricFilterRequest, context: __Ser
38443845
});
38453846
};
38463847

3847-
// se_PutQueryDefinitionRequest omitted.
3848+
/**
3849+
* serializeAws_json1_1PutQueryDefinitionRequest
3850+
*/
3851+
const se_PutQueryDefinitionRequest = (input: PutQueryDefinitionRequest, context: __SerdeContext): any => {
3852+
return take(input, {
3853+
clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
3854+
logGroupNames: _json,
3855+
name: [],
3856+
queryDefinitionId: [],
3857+
queryString: [],
3858+
});
3859+
};
38483860

38493861
// se_PutResourcePolicyRequest omitted.
38503862

codegen/sdk-codegen/aws-models/cloudwatch-logs.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@
219219
"smithy.api#input": {}
220220
}
221221
},
222+
"com.amazonaws.cloudwatchlogs#ClientToken": {
223+
"type": "string",
224+
"traits": {
225+
"smithy.api#length": {
226+
"min": 36,
227+
"max": 128
228+
},
229+
"smithy.api#pattern": "^\\S{36,128}$"
230+
}
231+
},
222232
"com.amazonaws.cloudwatchlogs#CreateExportTask": {
223233
"type": "operation",
224234
"input": {
@@ -345,7 +355,7 @@
345355
}
346356
],
347357
"traits": {
348-
"smithy.api#documentation": "<p>Creates a log group with the specified name. You can create up to 20,000 log groups per account.</p>\n <p>You must use the following guidelines when naming a log group:</p>\n <ul>\n <li>\n <p>Log group names must be unique within a Region for an Amazon Web Services\n account.</p>\n </li>\n <li>\n <p>Log group names can be between 1 and 512 characters long.</p>\n </li>\n <li>\n <p>Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), \n '/' (forward slash), '.' (period), and '#' (number sign)</p>\n </li>\n </ul>\n <p>When you create a log group, by default the log events in the log group do not expire.\n To set a retention policy so that events expire and are deleted after a specified time, use\n <a href=\"https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutRetentionPolicy.html\">PutRetentionPolicy</a>.</p>\n <p>If you associate an KMS key with the log group, ingested data is\n encrypted using the KMS key. This association is stored as long as the data\n encrypted with the KMS key is still within CloudWatch Logs. This enables\n CloudWatch Logs to decrypt this data whenever it is requested.</p>\n <p>If you attempt to associate a KMS key with the log group but the KMS key does not exist or the KMS key is disabled, you receive an\n <code>InvalidParameterException</code> error. </p>\n <important>\n <p>CloudWatch Logs supports only symmetric KMS keys. Do not associate an\n asymmetric KMS key with your log group. For more information, see <a href=\"https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html\">Using\n Symmetric and Asymmetric Keys</a>.</p>\n </important>"
358+
"smithy.api#documentation": "<p>Creates a log group with the specified name. You can create up to 1,000,000 log groups per Region per account.</p>\n <p>You must use the following guidelines when naming a log group:</p>\n <ul>\n <li>\n <p>Log group names must be unique within a Region for an Amazon Web Services\n account.</p>\n </li>\n <li>\n <p>Log group names can be between 1 and 512 characters long.</p>\n </li>\n <li>\n <p>Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), \n '/' (forward slash), '.' (period), and '#' (number sign)</p>\n </li>\n </ul>\n <p>When you create a log group, by default the log events in the log group do not expire.\n To set a retention policy so that events expire and are deleted after a specified time, use\n <a href=\"https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutRetentionPolicy.html\">PutRetentionPolicy</a>.</p>\n <p>If you associate an KMS key with the log group, ingested data is\n encrypted using the KMS key. This association is stored as long as the data\n encrypted with the KMS key is still within CloudWatch Logs. This enables\n CloudWatch Logs to decrypt this data whenever it is requested.</p>\n <p>If you attempt to associate a KMS key with the log group but the KMS key does not exist or the KMS key is disabled, you receive an\n <code>InvalidParameterException</code> error. </p>\n <important>\n <p>CloudWatch Logs supports only symmetric KMS keys. Do not associate an\n asymmetric KMS key with your log group. For more information, see <a href=\"https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html\">Using\n Symmetric and Asymmetric Keys</a>.</p>\n </important>"
349359
}
350360
},
351361
"com.amazonaws.cloudwatchlogs#CreateLogGroupRequest": {
@@ -5009,7 +5019,7 @@
50095019
}
50105020
],
50115021
"traits": {
5012-
"smithy.api#documentation": "<p>Creates or updates a metric filter and associates it with the specified log group. With\n metric filters, you can configure rules to extract metric data from log events ingested\n through <a href=\"https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html\">PutLogEvents</a>.</p>\n <p>The maximum number of metric filters that can be associated with a log group is\n 100.</p>\n <p>When you create a metric filter, you can also optionally assign a unit and dimensions\n to the metric that is created.</p>\n <important>\n <p>Metrics extracted from log events are charged as custom metrics.\n To prevent unexpected high charges, do not specify high-cardinality fields such as \n <code>IPAddress</code> or <code>requestID</code> as dimensions. Each different value \n found for \n a dimension is treated as a separate metric and accrues charges as a separate custom metric.\n </p>\n <p>CloudWatch Logs disables a metric filter if it generates 1,000 different name/value pairs for\n your specified dimensions within a certain amount of time. This helps to prevent accidental\n high charges.</p>\n <p>You can also set up a billing alarm to alert you if your charges are higher than \n expected. For more information, \n see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html\">\n Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges</a>.\n </p>\n </important>"
5022+
"smithy.api#documentation": "<p>Creates or updates a metric filter and associates it with the specified log group. With\n metric filters, you can configure rules to extract metric data from log events ingested\n through <a href=\"https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html\">PutLogEvents</a>.</p>\n <p>The maximum number of metric filters that can be associated with a log group is\n 100.</p>\n <p>When you create a metric filter, you can also optionally assign a unit and dimensions\n to the metric that is created.</p>\n <important>\n <p>Metrics extracted from log events are charged as custom metrics.\n To prevent unexpected high charges, do not specify high-cardinality fields such as \n <code>IPAddress</code> or <code>requestID</code> as dimensions. Each different value \n found for \n a dimension is treated as a separate metric and accrues charges as a separate custom metric.\n </p>\n <p>CloudWatch Logs might disable a metric filter if it generates 1,000 different name/value pairs for\n your specified dimensions within one hour.</p>\n <p>You can also set up a billing alarm to alert you if your charges are higher than \n expected. For more information, \n see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html\">\n Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges</a>.\n </p>\n </important>"
50135023
}
50145024
},
50155025
"com.amazonaws.cloudwatchlogs#PutMetricFilterRequest": {
@@ -5102,6 +5112,13 @@
51025112
"smithy.api#documentation": "<p>The query string to use for this definition. \n For more information, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html\">CloudWatch Logs Insights Query Syntax</a>.</p>",
51035113
"smithy.api#required": {}
51045114
}
5115+
},
5116+
"clientToken": {
5117+
"target": "com.amazonaws.cloudwatchlogs#ClientToken",
5118+
"traits": {
5119+
"smithy.api#documentation": "<p>Used as an idempotency token, to avoid returning an exception if the service receives the same request twice because of a network\n error.</p>",
5120+
"smithy.api#idempotencyToken": {}
5121+
}
51055122
}
51065123
},
51075124
"traits": {
@@ -5202,7 +5219,7 @@
52025219
}
52035220
],
52045221
"traits": {
5205-
"smithy.api#documentation": "<p>Sets the retention of the specified log group. With a retention policy, you can\n configure the number of days for which to retain log events in the specified log\n group.</p>\n <note>\n <p>CloudWatch Logs doesn’t immediately delete log events when they reach their retention\n setting. It typically takes up to 72 hours after that before log events are deleted, but in\n rare situations might take longer.</p>\n <p>To illustrate, imagine that you change a log group to have a longer retention setting\n when it contains log events that are past the expiration date, but haven’t been deleted.\n Those log events will take up to 72 hours to be deleted after the new retention date is\n reached. To make sure that log data is deleted permanently, keep a log group at its lower\n retention setting until 72 hours after the previous retention period ends. Alternatively,\n wait to change the retention setting until you confirm that the earlier log events are\n deleted. </p>\n </note>"
5222+
"smithy.api#documentation": "<p>Sets the retention of the specified log group. With a retention policy, you can\n configure the number of days for which to retain log events in the specified log\n group.</p>\n <note>\n <p>CloudWatch Logs doesn’t immediately delete log events when they reach their retention\n setting. It typically takes up to 72 hours after that before log events are deleted, but in\n rare situations might take longer.</p>\n <p>To illustrate, imagine that you change a log group to have a longer retention setting\n when it contains log events that are past the expiration date, but haven’t been deleted.\n Those log events will take up to 72 hours to be deleted after the new retention date is\n reached. To make sure that log data is deleted permanently, keep a log group at its lower\n retention setting until 72 hours after the previous retention period ends. Alternatively,\n wait to change the retention setting until you confirm that the earlier log events are\n deleted. </p>\n <p>When log events reach their retention setting they are marked for deletion. After\n they are marked for deletion, they do not add to your archival storage costs anymore, even if \n they are not actually deleted until later. These log events marked for deletion are also not \n included when you use an API to retrieve the <code>storedBytes</code> value to see how many bytes a log group is storing.</p>\n </note>"
52065223
}
52075224
},
52085225
"com.amazonaws.cloudwatchlogs#PutRetentionPolicyRequest": {
@@ -6504,4 +6521,4 @@
65046521
"type": "string"
65056522
}
65066523
}
6507-
}
6524+
}

0 commit comments

Comments
 (0)