Skip to content

Commit 329a23a

Browse files
author
awstools
committed
feat(client-synthetics): CloudWatch Synthetics has introduced a new feature to provide customers with an option to delete the underlying resources that Synthetics canary creates when the user chooses to delete the canary.
1 parent 02d4564 commit 329a23a

File tree

5 files changed

+85
-13
lines changed

5 files changed

+85
-13
lines changed

clients/client-synthetics/src/Synthetics.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,14 @@ export class Synthetics extends SyntheticsClient {
114114

115115
/**
116116
* <p>Permanently deletes the specified canary.</p>
117-
* <p>When you delete a canary, resources used and created by the canary are not automatically deleted. After you delete a canary that you do not intend to
117+
* <p>If you specify <code>DeleteLambda</code> to <code>true</code>, CloudWatch Synthetics also deletes
118+
* the Lambda functions and layers that are used by the canary.</p>
119+
* <p>Other esources used and created by the canary are not automatically deleted.
120+
* After you delete a canary that you do not intend to
118121
* use again, you
119122
* should also delete the following:</p>
120123
* <ul>
121124
* <li>
122-
* <p>The Lambda functions and layers used by this canary. These have the prefix
123-
* <code>cwsyn-<i>MyCanaryName</i>
124-
* </code>.</p>
125-
* </li>
126-
* <li>
127125
* <p>The CloudWatch alarms created for this canary. These alarms have a name of
128126
* <code>Synthetics-SharpDrop-Alarm-<i>MyCanaryName</i>
129127
* </code>.</p>

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@ export interface DeleteCanaryCommandOutput extends DeleteCanaryResponse, __Metad
2323

2424
/**
2525
* <p>Permanently deletes the specified canary.</p>
26-
* <p>When you delete a canary, resources used and created by the canary are not automatically deleted. After you delete a canary that you do not intend to
26+
* <p>If you specify <code>DeleteLambda</code> to <code>true</code>, CloudWatch Synthetics also deletes
27+
* the Lambda functions and layers that are used by the canary.</p>
28+
* <p>Other esources used and created by the canary are not automatically deleted.
29+
* After you delete a canary that you do not intend to
2730
* use again, you
2831
* should also delete the following:</p>
2932
* <ul>
3033
* <li>
31-
* <p>The Lambda functions and layers used by this canary. These have the prefix
32-
* <code>cwsyn-<i>MyCanaryName</i>
33-
* </code>.</p>
34-
* </li>
35-
* <li>
3634
* <p>The CloudWatch alarms created for this canary. These alarms have a name of
3735
* <code>Synthetics-SharpDrop-Alarm-<i>MyCanaryName</i>
3836
* </code>.</p>

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,18 @@ export enum CanaryState {
222222
}
223223

224224
export enum CanaryStateReasonCode {
225+
CREATE_FAILED = "CREATE_FAILED",
226+
CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS",
227+
CREATE_PENDING = "CREATE_PENDING",
228+
DELETE_FAILED = "DELETE_FAILED",
229+
DELETE_IN_PROGRESS = "DELETE_IN_PROGRESS",
225230
INVALID_PERMISSIONS = "INVALID_PERMISSIONS",
231+
ROLLBACK_COMPLETE = "ROLLBACK_COMPLETE",
232+
ROLLBACK_FAILED = "ROLLBACK_FAILED",
233+
SYNC_DELETE_IN_PROGRESS = "SYNC_DELETE_IN_PROGRESS",
234+
UPDATE_COMPLETE = "UPDATE_COMPLETE",
235+
UPDATE_IN_PROGRESS = "UPDATE_IN_PROGRESS",
236+
UPDATE_PENDING = "UPDATE_PENDING",
226237
}
227238

228239
/**
@@ -1007,6 +1018,13 @@ export interface DeleteCanaryRequest {
10071018
* <p>The name of the canary that you want to delete. To find the names of your canaries, use <a href="https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_DescribeCanaries.html">DescribeCanaries</a>.</p>
10081019
*/
10091020
Name: string | undefined;
1021+
1022+
/**
1023+
* <p>Specifies whether to also delete the Lambda functions and layers used by this canary. The default
1024+
* is false.</p>
1025+
* <p>Type: Boolean</p>
1026+
*/
1027+
DeleteLambda?: boolean;
10101028
}
10111029

10121030
export namespace DeleteCanaryRequest {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ export const serializeAws_restJson1DeleteCanaryCommand = async (
137137
} else {
138138
throw new Error("No value provided for input HTTP label: Name.");
139139
}
140+
const query: any = {
141+
...(input.DeleteLambda !== undefined && { deleteLambda: input.DeleteLambda.toString() }),
142+
};
140143
let body: any;
141144
return new __HttpRequest({
142145
protocol,
@@ -145,6 +148,7 @@ export const serializeAws_restJson1DeleteCanaryCommand = async (
145148
method: "DELETE",
146149
headers,
147150
path: resolvedPath,
151+
query,
148152
body,
149153
});
150154
};

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

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,50 @@
596596
{
597597
"value": "INVALID_PERMISSIONS",
598598
"name": "INVALID_PERMISSIONS"
599+
},
600+
{
601+
"value": "CREATE_PENDING",
602+
"name": "CREATE_PENDING"
603+
},
604+
{
605+
"value": "CREATE_IN_PROGRESS",
606+
"name": "CREATE_IN_PROGRESS"
607+
},
608+
{
609+
"value": "CREATE_FAILED",
610+
"name": "CREATE_FAILED"
611+
},
612+
{
613+
"value": "UPDATE_PENDING",
614+
"name": "UPDATE_PENDING"
615+
},
616+
{
617+
"value": "UPDATE_IN_PROGRESS",
618+
"name": "UPDATE_IN_PROGRESS"
619+
},
620+
{
621+
"value": "UPDATE_COMPLETE",
622+
"name": "UPDATE_COMPLETE"
623+
},
624+
{
625+
"value": "ROLLBACK_COMPLETE",
626+
"name": "ROLLBACK_COMPLETE"
627+
},
628+
{
629+
"value": "ROLLBACK_FAILED",
630+
"name": "ROLLBACK_FAILED"
631+
},
632+
{
633+
"value": "DELETE_IN_PROGRESS",
634+
"name": "DELETE_IN_PROGRESS"
635+
},
636+
{
637+
"value": "DELETE_FAILED",
638+
"name": "DELETE_FAILED"
639+
},
640+
{
641+
"value": "SYNC_DELETE_IN_PROGRESS",
642+
"name": "SYNC_DELETE_IN_PROGRESS"
599643
}
600644
]
601645
}
@@ -826,7 +870,7 @@
826870
}
827871
],
828872
"traits": {
829-
"smithy.api#documentation": "<p>Permanently deletes the specified canary.</p>\n <p>When you delete a canary, resources used and created by the canary are not automatically deleted. 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 Lambda functions and layers used by this canary. These have the prefix\n <code>cwsyn-<i>MyCanaryName</i>\n </code>.</p>\n </li>\n <li>\n <p>The CloudWatch alarms created for this canary. These alarms have a name of\n <code>Synthetics-SharpDrop-Alarm-<i>MyCanaryName</i>\n </code>.</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>MyCanaryName</i>\n </code>.</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>MyCanaryName</i>\n </code>. </p>\n </li>\n </ul>\n \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>",
873+
"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 esources 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-SharpDrop-Alarm-<i>MyCanaryName</i>\n </code>.</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>MyCanaryName</i>\n </code>.</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>MyCanaryName</i>\n </code>. </p>\n </li>\n </ul>\n \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>",
830874
"smithy.api#http": {
831875
"method": "DELETE",
832876
"uri": "/canary/{Name}",
@@ -844,6 +888,13 @@
844888
"smithy.api#httpLabel": {},
845889
"smithy.api#required": {}
846890
}
891+
},
892+
"DeleteLambda": {
893+
"target": "com.amazonaws.synthetics#boolean",
894+
"traits": {
895+
"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>",
896+
"smithy.api#httpQuery": "deleteLambda"
897+
}
847898
}
848899
}
849900
},
@@ -2067,6 +2118,9 @@
20672118
},
20682119
"com.amazonaws.synthetics#VpcId": {
20692120
"type": "string"
2121+
},
2122+
"com.amazonaws.synthetics#boolean": {
2123+
"type": "boolean"
20702124
}
20712125
}
20722126
}

0 commit comments

Comments
 (0)