Skip to content

Commit

Permalink
feat(client-synthetics): CloudWatch Synthetics has introduced a new f…
Browse files Browse the repository at this point in the history
…eature to provide customers with an option to delete the underlying resources that Synthetics canary creates when the user chooses to delete the canary.
  • Loading branch information
awstools committed May 2, 2022
1 parent 02d4564 commit 329a23a
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 13 deletions.
10 changes: 4 additions & 6 deletions clients/client-synthetics/src/Synthetics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,14 @@ export class Synthetics extends SyntheticsClient {

/**
* <p>Permanently deletes the specified canary.</p>
* <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
* <p>If you specify <code>DeleteLambda</code> to <code>true</code>, CloudWatch Synthetics also deletes
* the Lambda functions and layers that are used by the canary.</p>
* <p>Other esources used and created by the canary are not automatically deleted.
* After you delete a canary that you do not intend to
* use again, you
* should also delete the following:</p>
* <ul>
* <li>
* <p>The Lambda functions and layers used by this canary. These have the prefix
* <code>cwsyn-<i>MyCanaryName</i>
* </code>.</p>
* </li>
* <li>
* <p>The CloudWatch alarms created for this canary. These alarms have a name of
* <code>Synthetics-SharpDrop-Alarm-<i>MyCanaryName</i>
* </code>.</p>
Expand Down
10 changes: 4 additions & 6 deletions clients/client-synthetics/src/commands/DeleteCanaryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ export interface DeleteCanaryCommandOutput extends DeleteCanaryResponse, __Metad

/**
* <p>Permanently deletes the specified canary.</p>
* <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
* <p>If you specify <code>DeleteLambda</code> to <code>true</code>, CloudWatch Synthetics also deletes
* the Lambda functions and layers that are used by the canary.</p>
* <p>Other esources used and created by the canary are not automatically deleted.
* After you delete a canary that you do not intend to
* use again, you
* should also delete the following:</p>
* <ul>
* <li>
* <p>The Lambda functions and layers used by this canary. These have the prefix
* <code>cwsyn-<i>MyCanaryName</i>
* </code>.</p>
* </li>
* <li>
* <p>The CloudWatch alarms created for this canary. These alarms have a name of
* <code>Synthetics-SharpDrop-Alarm-<i>MyCanaryName</i>
* </code>.</p>
Expand Down
18 changes: 18 additions & 0 deletions clients/client-synthetics/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,18 @@ export enum CanaryState {
}

export enum CanaryStateReasonCode {
CREATE_FAILED = "CREATE_FAILED",
CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS",
CREATE_PENDING = "CREATE_PENDING",
DELETE_FAILED = "DELETE_FAILED",
DELETE_IN_PROGRESS = "DELETE_IN_PROGRESS",
INVALID_PERMISSIONS = "INVALID_PERMISSIONS",
ROLLBACK_COMPLETE = "ROLLBACK_COMPLETE",
ROLLBACK_FAILED = "ROLLBACK_FAILED",
SYNC_DELETE_IN_PROGRESS = "SYNC_DELETE_IN_PROGRESS",
UPDATE_COMPLETE = "UPDATE_COMPLETE",
UPDATE_IN_PROGRESS = "UPDATE_IN_PROGRESS",
UPDATE_PENDING = "UPDATE_PENDING",
}

/**
Expand Down Expand Up @@ -1007,6 +1018,13 @@ export interface DeleteCanaryRequest {
* <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>
*/
Name: string | undefined;

/**
* <p>Specifies whether to also delete the Lambda functions and layers used by this canary. The default
* is false.</p>
* <p>Type: Boolean</p>
*/
DeleteLambda?: boolean;
}

export namespace DeleteCanaryRequest {
Expand Down
4 changes: 4 additions & 0 deletions clients/client-synthetics/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ export const serializeAws_restJson1DeleteCanaryCommand = async (
} else {
throw new Error("No value provided for input HTTP label: Name.");
}
const query: any = {
...(input.DeleteLambda !== undefined && { deleteLambda: input.DeleteLambda.toString() }),
};
let body: any;
return new __HttpRequest({
protocol,
Expand All @@ -145,6 +148,7 @@ export const serializeAws_restJson1DeleteCanaryCommand = async (
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
Expand Down
56 changes: 55 additions & 1 deletion codegen/sdk-codegen/aws-models/synthetics.json
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,50 @@
{
"value": "INVALID_PERMISSIONS",
"name": "INVALID_PERMISSIONS"
},
{
"value": "CREATE_PENDING",
"name": "CREATE_PENDING"
},
{
"value": "CREATE_IN_PROGRESS",
"name": "CREATE_IN_PROGRESS"
},
{
"value": "CREATE_FAILED",
"name": "CREATE_FAILED"
},
{
"value": "UPDATE_PENDING",
"name": "UPDATE_PENDING"
},
{
"value": "UPDATE_IN_PROGRESS",
"name": "UPDATE_IN_PROGRESS"
},
{
"value": "UPDATE_COMPLETE",
"name": "UPDATE_COMPLETE"
},
{
"value": "ROLLBACK_COMPLETE",
"name": "ROLLBACK_COMPLETE"
},
{
"value": "ROLLBACK_FAILED",
"name": "ROLLBACK_FAILED"
},
{
"value": "DELETE_IN_PROGRESS",
"name": "DELETE_IN_PROGRESS"
},
{
"value": "DELETE_FAILED",
"name": "DELETE_FAILED"
},
{
"value": "SYNC_DELETE_IN_PROGRESS",
"name": "SYNC_DELETE_IN_PROGRESS"
}
]
}
Expand Down Expand Up @@ -826,7 +870,7 @@
}
],
"traits": {
"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>",
"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>",
"smithy.api#http": {
"method": "DELETE",
"uri": "/canary/{Name}",
Expand All @@ -844,6 +888,13 @@
"smithy.api#httpLabel": {},
"smithy.api#required": {}
}
},
"DeleteLambda": {
"target": "com.amazonaws.synthetics#boolean",
"traits": {
"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>",
"smithy.api#httpQuery": "deleteLambda"
}
}
}
},
Expand Down Expand Up @@ -2067,6 +2118,9 @@
},
"com.amazonaws.synthetics#VpcId": {
"type": "string"
},
"com.amazonaws.synthetics#boolean": {
"type": "boolean"
}
}
}

0 comments on commit 329a23a

Please sign in to comment.