Skip to content

Commit b06511c

Browse files
author
awstools
committed
feat(client-synthetics): Add support to toggle if a canary will automatically delete provisioned canary resources such as Lambda functions and layers when a canary is deleted. This behavior can be controlled via the new ProvisionedResourceCleanup property exposed in the CreateCanary and UpdateCanary APIs.
1 parent ef8b258 commit b06511c

File tree

8 files changed

+101
-8
lines changed

8 files changed

+101
-8
lines changed

clients/client-synthetics/src/commands/CreateCanaryCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export interface CreateCanaryCommandOutput extends CreateCanaryResponse, __Metad
8585
* ResourcesToReplicateTags: [ // ResourceList
8686
* "lambda-function",
8787
* ],
88+
* ProvisionedResourceCleanup: "AUTOMATIC" || "OFF",
8889
* Tags: { // TagMap
8990
* "<keys>": "STRING_VALUE",
9091
* },
@@ -151,6 +152,7 @@ export interface CreateCanaryCommandOutput extends CreateCanaryResponse, __Metad
151152
* // ],
152153
* // BaseCanaryRunId: "STRING_VALUE",
153154
* // },
155+
* // ProvisionedResourceCleanup: "AUTOMATIC" || "OFF",
154156
* // Tags: { // TagMap
155157
* // "<keys>": "STRING_VALUE",
156158
* // },

clients/client-synthetics/src/commands/DeleteCanaryCommand.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export interface DeleteCanaryCommandOutput extends DeleteCanaryResponse, __Metad
2929

3030
/**
3131
* <p>Permanently deletes the specified canary.</p>
32-
* <p>If you specify <code>DeleteLambda</code> to <code>true</code>, CloudWatch Synthetics also deletes
32+
* <p>If the canary's <code>ProvisionedResourceCleanup</code> field is set to <code>AUTOMATIC</code>
33+
* or you specify <code>DeleteLambda</code> in this operation as <code>true</code>, CloudWatch Synthetics also deletes
3334
* the Lambda functions and layers that are used by the canary.</p>
3435
* <p>Other resources used and created by the canary are not automatically deleted.
35-
* After you delete a canary that you do not intend to
36-
* use again, you
36+
* After you delete a canary, you
3737
* should also delete the following:</p>
3838
* <ul>
3939
* <li>

clients/client-synthetics/src/commands/DescribeCanariesCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export interface DescribeCanariesCommandOutput extends DescribeCanariesResponse,
108108
* // ],
109109
* // BaseCanaryRunId: "STRING_VALUE",
110110
* // },
111+
* // ProvisionedResourceCleanup: "AUTOMATIC" || "OFF",
111112
* // Tags: { // TagMap
112113
* // "<keys>": "STRING_VALUE",
113114
* // },

clients/client-synthetics/src/commands/GetCanaryCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export interface GetCanaryCommandOutput extends GetCanaryResponse, __MetadataBea
9696
* // ],
9797
* // BaseCanaryRunId: "STRING_VALUE",
9898
* // },
99+
* // ProvisionedResourceCleanup: "AUTOMATIC" || "OFF",
99100
* // Tags: { // TagMap
100101
* // "<keys>": "STRING_VALUE",
101102
* // },

clients/client-synthetics/src/commands/UpdateCanaryCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export interface UpdateCanaryCommandOutput extends UpdateCanaryResponse, __Metad
9090
* KmsKeyArn: "STRING_VALUE",
9191
* },
9292
* },
93+
* ProvisionedResourceCleanup: "AUTOMATIC" || "OFF",
9394
* };
9495
* const command = new UpdateCanaryCommand(input);
9596
* const response = await client.send(command);

clients/client-synthetics/src/models/models_0.ts

+52-2
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,21 @@ export interface CanaryCodeOutput {
275275
Handler?: string;
276276
}
277277

278+
/**
279+
* @public
280+
* @enum
281+
*/
282+
export const ProvisionedResourceCleanupSetting = {
283+
AUTOMATIC: "AUTOMATIC",
284+
OFF: "OFF",
285+
} as const;
286+
287+
/**
288+
* @public
289+
*/
290+
export type ProvisionedResourceCleanupSetting =
291+
(typeof ProvisionedResourceCleanupSetting)[keyof typeof ProvisionedResourceCleanupSetting];
292+
278293
/**
279294
* <p>A structure that contains information about a canary run.</p>
280295
* @public
@@ -588,6 +603,17 @@ export interface Canary {
588603
*/
589604
VisualReference?: VisualReferenceOutput;
590605

606+
/**
607+
* <p>Specifies whether to also delete the Lambda functions and layers used by this canary
608+
* when the canary is deleted. If it is <code>AUTOMATIC</code>, the Lambda functions and layers will be deleted
609+
* when the canary is deleted.</p>
610+
* <p>If the value of this parameter is <code>OFF</code>, then the value of the <code>DeleteLambda</code> parameter
611+
* of the <a href="https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_DeleteCanary.html">DeleteCanary</a> operation
612+
* determines whether the Lambda functions and layers will be deleted.</p>
613+
* @public
614+
*/
615+
ProvisionedResourceCleanup?: ProvisionedResourceCleanupSetting;
616+
591617
/**
592618
* <p>The list of key-value pairs that are associated with the canary.</p>
593619
* @public
@@ -1054,11 +1080,22 @@ export interface CreateCanaryRequest {
10541080
* <p>To have the tags that you apply to this canary also be applied to the Lambda function that
10551081
* the canary uses, specify this parameter with the value <code>lambda-function</code>.</p>
10561082
* <p>If you specify this parameter and don't specify any tags in the <code>Tags</code>
1057-
* parameter, the canary creation fails.</p>
1083+
* parameter, the canary creation fails.</p>
10581084
* @public
10591085
*/
10601086
ResourcesToReplicateTags?: ResourceToTag[];
10611087

1088+
/**
1089+
* <p>Specifies whether to also delete the Lambda functions and layers used by this canary
1090+
* when the canary is deleted. If you omit this parameter, the default of <code>AUTOMATIC</code> is used, which means
1091+
* that the Lambda functions and layers will be deleted when the canary is deleted.</p>
1092+
* <p>If the value of this parameter is <code>OFF</code>, then the value of the <code>DeleteLambda</code> parameter
1093+
* of the <a href="https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_DeleteCanary.html">DeleteCanary</a> operation
1094+
* determines whether the Lambda functions and layers will be deleted.</p>
1095+
* @public
1096+
*/
1097+
ProvisionedResourceCleanup?: ProvisionedResourceCleanupSetting;
1098+
10621099
/**
10631100
* <p>A list of key-value pairs to associate with the canary.
10641101
* You can associate as many as 50 tags with a canary.</p>
@@ -1201,7 +1238,10 @@ export interface DeleteCanaryRequest {
12011238

12021239
/**
12031240
* <p>Specifies whether to also delete the Lambda functions and layers used by this canary. The default
1204-
* is false.</p>
1241+
* is <code>false</code>.</p>
1242+
* <p>Your setting for this parameter is used only if the canary doesn't have <code>AUTOMATIC</code> for its
1243+
* <code>ProvisionedResourceCleanup</code> field. If that field is set to <code>AUTOMATIC</code>, then the
1244+
* Lambda functions and layers will be deleted when this canary is deleted. </p>
12051245
* <p>Type: Boolean</p>
12061246
* @public
12071247
*/
@@ -2037,6 +2077,16 @@ export interface UpdateCanaryRequest {
20372077
* @public
20382078
*/
20392079
ArtifactConfig?: ArtifactConfigInput;
2080+
2081+
/**
2082+
* <p>Specifies whether to also delete the Lambda functions and layers used by this canary
2083+
* when the canary is deleted.</p>
2084+
* <p>If the value of this parameter is <code>OFF</code>, then the value of the <code>DeleteLambda</code> parameter
2085+
* of the <a href="https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_DeleteCanary.html">DeleteCanary</a> operation
2086+
* determines whether the Lambda functions and layers will be deleted.</p>
2087+
* @public
2088+
*/
2089+
ProvisionedResourceCleanup?: ProvisionedResourceCleanupSetting;
20402090
}
20412091

20422092
/**

clients/client-synthetics/src/protocols/Aws_restJson1.ts

+3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export const se_CreateCanaryCommand = async (
134134
ExecutionRoleArn: [],
135135
FailureRetentionPeriodInDays: [],
136136
Name: [],
137+
ProvisionedResourceCleanup: [],
137138
ResourcesToReplicateTags: (_) => _json(_),
138139
RunConfig: (_) => _json(_),
139140
RuntimeVersion: [],
@@ -537,6 +538,7 @@ export const se_UpdateCanaryCommand = async (
537538
Code: (_) => se_CanaryCodeInput(_, context),
538539
ExecutionRoleArn: [],
539540
FailureRetentionPeriodInDays: [],
541+
ProvisionedResourceCleanup: [],
540542
RunConfig: (_) => _json(_),
541543
RuntimeVersion: [],
542544
Schedule: (_) => _json(_),
@@ -1290,6 +1292,7 @@ const de_Canary = (output: any, context: __SerdeContext): Canary => {
12901292
FailureRetentionPeriodInDays: __expectInt32,
12911293
Id: __expectString,
12921294
Name: __expectString,
1295+
ProvisionedResourceCleanup: __expectString,
12931296
RunConfig: _json,
12941297
RuntimeVersion: __expectString,
12951298
Schedule: _json,

codegen/sdk-codegen/aws-models/synthetics.json

+38-3
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@
284284
"smithy.api#documentation": "<p>If this canary performs visual monitoring by comparing screenshots, this structure contains the ID of the canary run to use as the baseline for screenshots, and the coordinates\n of any parts of the screen to ignore during the visual monitoring comparison.</p>"
285285
}
286286
},
287+
"ProvisionedResourceCleanup": {
288+
"target": "com.amazonaws.synthetics#ProvisionedResourceCleanupSetting",
289+
"traits": {
290+
"smithy.api#documentation": "<p>Specifies whether to also delete the Lambda functions and layers used by this canary\n when the canary is deleted. If it is <code>AUTOMATIC</code>, the Lambda functions and layers will be deleted\n when the canary is deleted.</p>\n <p>If the value of this parameter is <code>OFF</code>, then the value of the <code>DeleteLambda</code> parameter\n of the <a href=\"https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_DeleteCanary.html\">DeleteCanary</a> operation\n determines whether the Lambda functions and layers will be deleted.</p>"
291+
}
292+
},
287293
"Tags": {
288294
"target": "com.amazonaws.synthetics#TagMap",
289295
"traits": {
@@ -946,7 +952,13 @@
946952
"ResourcesToReplicateTags": {
947953
"target": "com.amazonaws.synthetics#ResourceList",
948954
"traits": {
949-
"smithy.api#documentation": "<p>To have the tags that you apply to this canary also be applied to the Lambda function that\n the canary uses, specify this parameter with the value <code>lambda-function</code>.</p>\n <p>If you specify this parameter and don't specify any tags in the <code>Tags</code>\n parameter, the canary creation fails.</p>"
955+
"smithy.api#documentation": "<p>To have the tags that you apply to this canary also be applied to the Lambda function that\n the canary uses, specify this parameter with the value <code>lambda-function</code>.</p>\n <p>If you specify this parameter and don't specify any tags in the <code>Tags</code>\n parameter, the canary creation fails.</p>"
956+
}
957+
},
958+
"ProvisionedResourceCleanup": {
959+
"target": "com.amazonaws.synthetics#ProvisionedResourceCleanupSetting",
960+
"traits": {
961+
"smithy.api#documentation": "<p>Specifies whether to also delete the Lambda functions and layers used by this canary\n when the canary is deleted. If you omit this parameter, the default of <code>AUTOMATIC</code> is used, which means\n that the Lambda functions and layers will be deleted when the canary is deleted.</p>\n <p>If the value of this parameter is <code>OFF</code>, then the value of the <code>DeleteLambda</code> parameter\n of the <a href=\"https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_DeleteCanary.html\">DeleteCanary</a> operation\n determines whether the Lambda functions and layers will be deleted.</p>"
950962
}
951963
},
952964
"Tags": {
@@ -1069,7 +1081,7 @@
10691081
}
10701082
],
10711083
"traits": {
1072-
"smithy.api#documentation": "<p>Permanently deletes the specified canary.</p>\n <p>If you specify <code>DeleteLambda</code> to <code>true</code>, CloudWatch Synthetics also deletes\n the Lambda functions and layers that are used by the canary.</p>\n <p>Other resources used and created by the canary are not automatically deleted. \n After you delete a canary that you do not intend to\n use again, you\n should also delete the following:</p>\n <ul>\n <li>\n <p>The CloudWatch alarms created for this canary. These alarms have a name of\n <code>Synthetics-Alarm-<i>first-198-characters-of-canary-name</i>-<i>canaryId</i>-<i>alarm number</i>\n </code>\n </p>\n </li>\n <li>\n <p>Amazon S3 objects and buckets, such as the canary's artifact location.</p>\n </li>\n <li>\n <p>IAM roles created for the canary. If they were created in the console, these roles\n have the name <code>\n role/service-role/CloudWatchSyntheticsRole-<i>First-21-Characters-of-CanaryName</i>\n </code>\n </p>\n </li>\n <li>\n <p>CloudWatch Logs log groups created for the canary. These logs groups have the name\n <code>/aws/lambda/cwsyn-<i>First-21-Characters-of-CanaryName</i>\n </code>\n </p>\n </li>\n </ul>\n <p>Before you delete a canary, you might want to use <code>GetCanary</code> to display\n the information about this canary. Make\n note of the information returned by this operation so that you can delete these resources\n after you delete the canary.</p>",
1084+
"smithy.api#documentation": "<p>Permanently deletes the specified canary.</p>\n <p>If the canary's <code>ProvisionedResourceCleanup</code> field is set to <code>AUTOMATIC</code> \n or you specify <code>DeleteLambda</code> in this operation as <code>true</code>, CloudWatch Synthetics also deletes\n the Lambda functions and layers that are used by the canary.</p>\n <p>Other resources used and created by the canary are not automatically deleted. \n After you delete a canary, you\n should also delete the following:</p>\n <ul>\n <li>\n <p>The CloudWatch alarms created for this canary. These alarms have a name of\n <code>Synthetics-Alarm-<i>first-198-characters-of-canary-name</i>-<i>canaryId</i>-<i>alarm number</i>\n </code>\n </p>\n </li>\n <li>\n <p>Amazon S3 objects and buckets, such as the canary's artifact location.</p>\n </li>\n <li>\n <p>IAM roles created for the canary. If they were created in the console, these roles\n have the name <code>\n role/service-role/CloudWatchSyntheticsRole-<i>First-21-Characters-of-CanaryName</i>\n </code>\n </p>\n </li>\n <li>\n <p>CloudWatch Logs log groups created for the canary. These logs groups have the name\n <code>/aws/lambda/cwsyn-<i>First-21-Characters-of-CanaryName</i>\n </code>\n </p>\n </li>\n </ul>\n <p>Before you delete a canary, you might want to use <code>GetCanary</code> to display\n the information about this canary. Make\n note of the information returned by this operation so that you can delete these resources\n after you delete the canary.</p>",
10731085
"smithy.api#http": {
10741086
"method": "DELETE",
10751087
"uri": "/canary/{Name}",
@@ -1092,7 +1104,7 @@
10921104
"target": "com.amazonaws.synthetics#boolean",
10931105
"traits": {
10941106
"smithy.api#default": false,
1095-
"smithy.api#documentation": "<p>Specifies whether to also delete the Lambda functions and layers used by this canary. The default\n is false.</p>\n <p>Type: Boolean</p>",
1107+
"smithy.api#documentation": "<p>Specifies whether to also delete the Lambda functions and layers used by this canary. The default\n is <code>false</code>.</p>\n <p>Your setting for this parameter is used only if the canary doesn't have <code>AUTOMATIC</code> for its \n <code>ProvisionedResourceCleanup</code> field. If that field is set to <code>AUTOMATIC</code>, then the \n Lambda functions and layers will be deleted when this canary is deleted. </p>\n <p>Type: Boolean</p>",
10961108
"smithy.api#httpQuery": "deleteLambda"
10971109
}
10981110
}
@@ -2242,6 +2254,23 @@
22422254
"smithy.api#pattern": "^.+$"
22432255
}
22442256
},
2257+
"com.amazonaws.synthetics#ProvisionedResourceCleanupSetting": {
2258+
"type": "enum",
2259+
"members": {
2260+
"AUTOMATIC": {
2261+
"target": "smithy.api#Unit",
2262+
"traits": {
2263+
"smithy.api#enumValue": "AUTOMATIC"
2264+
}
2265+
},
2266+
"OFF": {
2267+
"target": "smithy.api#Unit",
2268+
"traits": {
2269+
"smithy.api#enumValue": "OFF"
2270+
}
2271+
}
2272+
}
2273+
},
22452274
"com.amazonaws.synthetics#RequestEntityTooLargeException": {
22462275
"type": "structure",
22472276
"members": {
@@ -3914,6 +3943,12 @@
39143943
"traits": {
39153944
"smithy.api#documentation": "<p>A structure that contains the configuration for canary artifacts, \n including the encryption-at-rest settings for artifacts that \n the canary uploads to Amazon S3.</p>"
39163945
}
3946+
},
3947+
"ProvisionedResourceCleanup": {
3948+
"target": "com.amazonaws.synthetics#ProvisionedResourceCleanupSetting",
3949+
"traits": {
3950+
"smithy.api#documentation": "<p>Specifies whether to also delete the Lambda functions and layers used by this canary\n when the canary is deleted.</p>\n <p>If the value of this parameter is <code>OFF</code>, then the value of the <code>DeleteLambda</code> parameter\n of the <a href=\"https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_DeleteCanary.html\">DeleteCanary</a> operation\n determines whether the Lambda functions and layers will be deleted.</p>"
3951+
}
39173952
}
39183953
},
39193954
"traits": {

0 commit comments

Comments
 (0)