Skip to content

Commit

Permalink
feat(client-synthetics): This release introduces two features. The fi…
Browse files Browse the repository at this point in the history
…rst is tag replication, which allows for the propagation of canary tags onto Synthetics related resources, such as Lambda functions. The second is a limit increase in canary name length, which has now been increased from 21 to 255 characters.
  • Loading branch information
awstools committed Sep 12, 2024
1 parent d4befea commit 9d8cf33
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 13 deletions.
3 changes: 3 additions & 0 deletions clients/client-synthetics/src/commands/CreateCanaryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export interface CreateCanaryCommandOutput extends CreateCanaryResponse, __Metad
* "STRING_VALUE",
* ],
* },
* ResourcesToReplicateTags: [ // ResourceList
* "lambda-function",
* ],
* Tags: { // TagMap
* "<keys>": "STRING_VALUE",
* },
Expand Down
15 changes: 9 additions & 6 deletions clients/client-synthetics/src/commands/DeleteCanaryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,25 @@ export interface DeleteCanaryCommandOutput extends DeleteCanaryResponse, __Metad
* <ul>
* <li>
* <p>The CloudWatch alarms created for this canary. These alarms have a name of
* <code>Synthetics-SharpDrop-Alarm-<i>MyCanaryName</i>
* </code>.</p>
* <code>Synthetics-Alarm-<i>first-198-characters-of-canary-name</i>-<i>canaryId</i>-<i>alarm number</i>
* </code>
* </p>
* </li>
* <li>
* <p>Amazon S3 objects and buckets, such as the canary's artifact location.</p>
* </li>
* <li>
* <p>IAM roles created for the canary. If they were created in the console, these roles
* have the name <code>
* role/service-role/CloudWatchSyntheticsRole-<i>MyCanaryName</i>
* </code>.</p>
* role/service-role/CloudWatchSyntheticsRole-<i>First-21-Characters-of-CanaryName</i>
* </code>
* </p>
* </li>
* <li>
* <p>CloudWatch Logs log groups created for the canary. These logs groups have the name
* <code>/aws/lambda/cwsyn-<i>MyCanaryName</i>
* </code>. </p>
* <code>/aws/lambda/cwsyn-<i>First-21-Characters-of-CanaryName</i>
* </code>
* </p>
* </li>
* </ul>
* <p>Before you delete a canary, you might want to use <code>GetCanary</code> to display
Expand Down
43 changes: 42 additions & 1 deletion clients/client-synthetics/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,23 @@ export interface CanaryLastRun {
* script is stored in an S3 bucket, the bucket name, key, and version are also included. If
* the script was passed into the canary directly, the script code is contained in the value
* of <code>Zipfile</code>. </p>
* <p>If you are uploading your canary scripts with an Amazon S3 bucket, your zip file should include your
* script in a certain folder structure.</p>
* <ul>
* <li>
* <p>For Node.js canaries, the folder structure must be <code>nodejs/node_modules/<i>myCanaryFilename.js</i>
* </code>
* For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html#CloudWatch_Synthetics_Canaries_package">Packaging your Node.js canary files</a>
* </p>
* </li>
* <li>
* <p>For Python canaries, the folder structure must be <code>python/<i>myCanaryFilename.p</i>
* </code> or <code>python/<i>myFolder/myCanaryFilename.py</i>
* </code>
* For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Python.html#CloudWatch_Synthetics_Canaries_WritingCanary_Python_package">Packaging your Python canary files</a>
* </p>
* </li>
* </ul>
* @public
*/
export interface CanaryCodeInput {
Expand Down Expand Up @@ -872,6 +889,19 @@ export interface CanaryScheduleInput {
DurationInSeconds?: number;
}

/**
* @public
* @enum
*/
export const ResourceToTag = {
LAMBDA_FUNCTION: "lambda-function",
} as const;

/**
* @public
*/
export type ResourceToTag = (typeof ResourceToTag)[keyof typeof ResourceToTag];

/**
* <p>If this canary is to test an endpoint in a VPC, this structure contains
* information about the subnets and security groups of the VPC endpoint.
Expand Down Expand Up @@ -1020,13 +1050,24 @@ export interface CreateCanaryRequest {
*/
VpcConfig?: VpcConfigInput;

/**
* <p>To have the tags that you apply to this canary also be applied to the Lambda function that
* the canary uses, specify this parameter with the value <code>lambda-function</code>.</p>
* <p>If you specify this parameter and don't specify any tags in the <code>Tags</code>
* parameter, the canary creation fails.</p>
* @public
*/
ResourcesToReplicateTags?: ResourceToTag[];

/**
* <p>A list of key-value pairs to associate with the canary.
* You can associate as many as 50 tags with a canary.</p>
* <p>Tags can help you organize and categorize your
* resources. You can also use them to scope user permissions, by
* granting a user permission to access or change only the resources that have
* certain tag values.</p>
* <p>To have the tags that you apply to this canary also be applied to the Lambda function that
* the canary uses, specify this parameter with the value <code>lambda-function</code>.</p>
* @public
*/
Tags?: Record<string, string>;
Expand Down Expand Up @@ -1203,7 +1244,7 @@ export interface DescribeCanariesRequest {

/**
* <p>Specify this parameter to limit how many canaries are returned each time you use
* the <code>DescribeCanaries</code> operation. If you omit this parameter, the default of 100 is used.</p>
* the <code>DescribeCanaries</code> operation. If you omit this parameter, the default of 20 is used.</p>
* @public
*/
MaxResults?: number;
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 @@ -79,6 +79,7 @@ import {
NotFoundException,
RequestEntityTooLargeException,
ResourceNotFoundException,
ResourceToTag,
RuntimeVersion,
S3EncryptionConfig,
ServiceQuotaExceededException,
Expand Down Expand Up @@ -133,6 +134,7 @@ export const se_CreateCanaryCommand = async (
ExecutionRoleArn: [],
FailureRetentionPeriodInDays: [],
Name: [],
ResourcesToReplicateTags: (_) => _json(_),
RunConfig: (_) => _json(_),
RuntimeVersion: [],
Schedule: (_) => _json(_),
Expand Down Expand Up @@ -1232,6 +1234,8 @@ const se_CanaryCodeInput = (input: CanaryCodeInput, context: __SerdeContext): an

// se_EnvironmentVariablesMap omitted.

// se_ResourceList omitted.

// se_S3EncryptionConfig omitted.

// se_SecurityGroupIds omitted.
Expand Down
41 changes: 35 additions & 6 deletions codegen/sdk-codegen/aws-models/synthetics.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
"min": 1,
"max": 2048
},
"smithy.api#pattern": "^arn:(aws[a-zA-Z-]*)?:synthetics:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:canary:[0-9a-z_\\-]{1,21}$"
"smithy.api#pattern": "^arn:(aws[a-zA-Z-]*)?:synthetics:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:canary:[0-9a-z_\\-]{1,255}$"
}
},
"com.amazonaws.synthetics#CanaryCodeInput": {
Expand Down Expand Up @@ -347,7 +347,7 @@
}
},
"traits": {
"smithy.api#documentation": "<p>Use this structure to input your script code for the canary. This structure contains the\n Lambda handler with the location where the canary should start running the script. If the\n script is stored in an S3 bucket, the bucket name, key, and version are also included. If\n the script was passed into the canary directly, the script code is contained in the value\n of <code>Zipfile</code>. </p>"
"smithy.api#documentation": "<p>Use this structure to input your script code for the canary. This structure contains the\n Lambda handler with the location where the canary should start running the script. If the\n script is stored in an S3 bucket, the bucket name, key, and version are also included. If\n the script was passed into the canary directly, the script code is contained in the value\n of <code>Zipfile</code>. </p>\n <p>If you are uploading your canary scripts with an Amazon S3 bucket, your zip file should include your \n script in a certain folder structure.</p>\n <ul>\n <li>\n <p>For Node.js canaries, the folder structure must be <code>nodejs/node_modules/<i>myCanaryFilename.js</i>\n </code>\n For more information, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html#CloudWatch_Synthetics_Canaries_package\">Packaging your Node.js canary files</a>\n </p>\n </li>\n <li>\n <p>For Python canaries, the folder structure must be <code>python/<i>myCanaryFilename.p</i>\n </code> or <code>python/<i>myFolder/myCanaryFilename.py</i>\n </code>\n For more information, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Python.html#CloudWatch_Synthetics_Canaries_WritingCanary_Python_package\">Packaging your Python canary files</a>\n </p>\n </li>\n </ul>"
}
},
"com.amazonaws.synthetics#CanaryCodeOutput": {
Expand Down Expand Up @@ -395,7 +395,7 @@
"traits": {
"smithy.api#length": {
"min": 1,
"max": 21
"max": 255
},
"smithy.api#pattern": "^[0-9a-z_\\-]+$"
}
Expand Down Expand Up @@ -943,10 +943,16 @@
"smithy.api#documentation": "<p>If this canary is to test an endpoint in a VPC, this structure contains\n information about the subnet and security groups of the VPC endpoint. \n For more information, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_VPC.html\">\n Running a Canary in a VPC</a>.</p>"
}
},
"ResourcesToReplicateTags": {
"target": "com.amazonaws.synthetics#ResourceList",
"traits": {
"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>"
}
},
"Tags": {
"target": "com.amazonaws.synthetics#TagMap",
"traits": {
"smithy.api#documentation": "<p>A list of key-value pairs to associate with the canary. \n You can associate as many as 50 tags with a canary.</p>\n <p>Tags can help you organize and categorize your\n resources. You can also use them to scope user permissions, by \n granting a user permission to access or change only the resources that have\n certain tag values.</p>"
"smithy.api#documentation": "<p>A list of key-value pairs to associate with the canary. \n You can associate as many as 50 tags with a canary.</p>\n <p>Tags can help you organize and categorize your\n resources. You can also use them to scope user permissions, by \n granting a user permission to access or change only the resources that have\n certain tag values.</p>\n <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>"
}
},
"ArtifactConfig": {
Expand Down Expand Up @@ -1063,7 +1069,7 @@
}
],
"traits": {
"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-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 <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 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>",
"smithy.api#http": {
"method": "DELETE",
"uri": "/canary/{Name}",
Expand Down Expand Up @@ -1298,7 +1304,7 @@
"MaxResults": {
"target": "com.amazonaws.synthetics#MaxCanaryResults",
"traits": {
"smithy.api#documentation": "<p>Specify this parameter to limit how many canaries are returned each time you use\n the <code>DescribeCanaries</code> operation. If you omit this parameter, the default of 100 is used.</p>"
"smithy.api#documentation": "<p>Specify this parameter to limit how many canaries are returned each time you use\n the <code>DescribeCanaries</code> operation. If you omit this parameter, the default of 20 is used.</p>"
}
},
"Names": {
Expand Down Expand Up @@ -2259,6 +2265,18 @@
"smithy.api#pattern": "^arn:(aws[a-zA-Z-]*)?:synthetics:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:(canary|group):[0-9a-z_\\-]+$"
}
},
"com.amazonaws.synthetics#ResourceList": {
"type": "list",
"member": {
"target": "com.amazonaws.synthetics#ResourceToTag"
},
"traits": {
"smithy.api#length": {
"min": 1,
"max": 1
}
}
},
"com.amazonaws.synthetics#ResourceNotFoundException": {
"type": "structure",
"members": {
Expand All @@ -2272,6 +2290,17 @@
"smithy.api#httpError": 404
}
},
"com.amazonaws.synthetics#ResourceToTag": {
"type": "enum",
"members": {
"LAMBDA_FUNCTION": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#enumValue": "lambda-function"
}
}
}
},
"com.amazonaws.synthetics#RoleArn": {
"type": "string",
"traits": {
Expand Down

0 comments on commit 9d8cf33

Please sign in to comment.