Skip to content

Commit 338d401

Browse files
author
awstools
committed
feat(client-synthetics): Add support to test a canary update by invoking a dry run of a canary. This behavior can be used via the new StartCanaryDryRun API along with new fields in UpdateCanary to apply dry run changes. Also includes changes in GetCanary and GetCanaryRuns to support retrieving dry run configurations.
1 parent d570657 commit 338d401

File tree

14 files changed

+865
-48
lines changed

14 files changed

+865
-48
lines changed

clients/client-synthetics/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,14 @@ StartCanary
353353

354354
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/synthetics/command/StartCanaryCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-synthetics/Interface/StartCanaryCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-synthetics/Interface/StartCanaryCommandOutput/)
355355

356+
</details>
357+
<details>
358+
<summary>
359+
StartCanaryDryRun
360+
</summary>
361+
362+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/synthetics/command/StartCanaryDryRunCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-synthetics/Interface/StartCanaryDryRunCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-synthetics/Interface/StartCanaryDryRunCommandOutput/)
363+
356364
</details>
357365
<details>
358366
<summary>

clients/client-synthetics/src/Synthetics.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ import {
6363
ListTagsForResourceCommandOutput,
6464
} from "./commands/ListTagsForResourceCommand";
6565
import { StartCanaryCommand, StartCanaryCommandInput, StartCanaryCommandOutput } from "./commands/StartCanaryCommand";
66+
import {
67+
StartCanaryDryRunCommand,
68+
StartCanaryDryRunCommandInput,
69+
StartCanaryDryRunCommandOutput,
70+
} from "./commands/StartCanaryDryRunCommand";
6671
import { StopCanaryCommand, StopCanaryCommandInput, StopCanaryCommandOutput } from "./commands/StopCanaryCommand";
6772
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
6873
import {
@@ -95,6 +100,7 @@ const commands = {
95100
ListGroupsCommand,
96101
ListTagsForResourceCommand,
97102
StartCanaryCommand,
103+
StartCanaryDryRunCommand,
98104
StopCanaryCommand,
99105
TagResourceCommand,
100106
UntagResourceCommand,
@@ -341,6 +347,23 @@ export interface Synthetics {
341347
cb: (err: any, data?: StartCanaryCommandOutput) => void
342348
): void;
343349

350+
/**
351+
* @see {@link StartCanaryDryRunCommand}
352+
*/
353+
startCanaryDryRun(
354+
args: StartCanaryDryRunCommandInput,
355+
options?: __HttpHandlerOptions
356+
): Promise<StartCanaryDryRunCommandOutput>;
357+
startCanaryDryRun(
358+
args: StartCanaryDryRunCommandInput,
359+
cb: (err: any, data?: StartCanaryDryRunCommandOutput) => void
360+
): void;
361+
startCanaryDryRun(
362+
args: StartCanaryDryRunCommandInput,
363+
options: __HttpHandlerOptions,
364+
cb: (err: any, data?: StartCanaryDryRunCommandOutput) => void
365+
): void;
366+
344367
/**
345368
* @see {@link StopCanaryCommand}
346369
*/

clients/client-synthetics/src/SyntheticsClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import {
8585
ListTagsForResourceCommandOutput,
8686
} from "./commands/ListTagsForResourceCommand";
8787
import { StartCanaryCommandInput, StartCanaryCommandOutput } from "./commands/StartCanaryCommand";
88+
import { StartCanaryDryRunCommandInput, StartCanaryDryRunCommandOutput } from "./commands/StartCanaryDryRunCommand";
8889
import { StopCanaryCommandInput, StopCanaryCommandOutput } from "./commands/StopCanaryCommand";
8990
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
9091
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
@@ -121,6 +122,7 @@ export type ServiceInputTypes =
121122
| ListGroupsCommandInput
122123
| ListTagsForResourceCommandInput
123124
| StartCanaryCommandInput
125+
| StartCanaryDryRunCommandInput
124126
| StopCanaryCommandInput
125127
| TagResourceCommandInput
126128
| UntagResourceCommandInput
@@ -147,6 +149,7 @@ export type ServiceOutputTypes =
147149
| ListGroupsCommandOutput
148150
| ListTagsForResourceCommandOutput
149151
| StartCanaryCommandOutput
152+
| StartCanaryDryRunCommandOutput
150153
| StopCanaryCommandOutput
151154
| TagResourceCommandOutput
152155
| UntagResourceCommandOutput

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ export interface CreateCanaryCommandOutput extends CreateCanaryResponse, __Metad
164164
* // KmsKeyArn: "STRING_VALUE",
165165
* // },
166166
* // },
167+
* // DryRunConfig: { // DryRunConfigOutput
168+
* // DryRunId: "STRING_VALUE",
169+
* // LastDryRunExecutionStatus: "STRING_VALUE",
170+
* // },
167171
* // },
168172
* // };
169173
*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ export interface DescribeCanariesCommandOutput extends DescribeCanariesResponse,
119119
* // KmsKeyArn: "STRING_VALUE",
120120
* // },
121121
* // },
122+
* // DryRunConfig: { // DryRunConfigOutput
123+
* // DryRunId: "STRING_VALUE",
124+
* // LastDryRunExecutionStatus: "STRING_VALUE",
125+
* // },
122126
* // },
123127
* // ],
124128
* // NextToken: "STRING_VALUE",

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ export interface DescribeCanariesLastRunCommandOutput extends DescribeCanariesLa
6969
* // Completed: new Date("TIMESTAMP"),
7070
* // },
7171
* // ArtifactS3Location: "STRING_VALUE",
72+
* // DryRunConfig: { // CanaryDryRunConfigOutput
73+
* // DryRunId: "STRING_VALUE",
74+
* // },
7275
* // },
7376
* // },
7477
* // ],

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface GetCanaryCommandOutput extends GetCanaryResponse, __MetadataBea
3939
* const client = new SyntheticsClient(config);
4040
* const input = { // GetCanaryRequest
4141
* Name: "STRING_VALUE", // required
42+
* DryRunId: "STRING_VALUE",
4243
* };
4344
* const command = new GetCanaryCommand(input);
4445
* const response = await client.send(command);
@@ -107,6 +108,10 @@ export interface GetCanaryCommandOutput extends GetCanaryResponse, __MetadataBea
107108
* // KmsKeyArn: "STRING_VALUE",
108109
* // },
109110
* // },
111+
* // DryRunConfig: { // DryRunConfigOutput
112+
* // DryRunId: "STRING_VALUE",
113+
* // LastDryRunExecutionStatus: "STRING_VALUE",
114+
* // },
110115
* // },
111116
* // };
112117
*

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export interface GetCanaryRunsCommandOutput extends GetCanaryRunsResponse, __Met
3939
* Name: "STRING_VALUE", // required
4040
* NextToken: "STRING_VALUE",
4141
* MaxResults: Number("int"),
42+
* DryRunId: "STRING_VALUE",
43+
* RunType: "CANARY_RUN" || "DRY_RUN",
4244
* };
4345
* const command = new GetCanaryRunsCommand(input);
4446
* const response = await client.send(command);
@@ -57,6 +59,9 @@ export interface GetCanaryRunsCommandOutput extends GetCanaryRunsResponse, __Met
5759
* // Completed: new Date("TIMESTAMP"),
5860
* // },
5961
* // ArtifactS3Location: "STRING_VALUE",
62+
* // DryRunConfig: { // CanaryDryRunConfigOutput
63+
* // DryRunId: "STRING_VALUE",
64+
* // },
6065
* // },
6166
* // ],
6267
* // NextToken: "STRING_VALUE",
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { StartCanaryDryRunRequest, StartCanaryDryRunResponse } from "../models/models_0";
9+
import { de_StartCanaryDryRunCommand, se_StartCanaryDryRunCommand } from "../protocols/Aws_restJson1";
10+
import { ServiceInputTypes, ServiceOutputTypes, SyntheticsClientResolvedConfig } from "../SyntheticsClient";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link StartCanaryDryRunCommand}.
21+
*/
22+
export interface StartCanaryDryRunCommandInput extends StartCanaryDryRunRequest {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link StartCanaryDryRunCommand}.
27+
*/
28+
export interface StartCanaryDryRunCommandOutput extends StartCanaryDryRunResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p>Use this operation to start a dry run for a canary that has already been created</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { SyntheticsClient, StartCanaryDryRunCommand } from "@aws-sdk/client-synthetics"; // ES Modules import
36+
* // const { SyntheticsClient, StartCanaryDryRunCommand } = require("@aws-sdk/client-synthetics"); // CommonJS import
37+
* const client = new SyntheticsClient(config);
38+
* const input = { // StartCanaryDryRunRequest
39+
* Name: "STRING_VALUE", // required
40+
* Code: { // CanaryCodeInput
41+
* S3Bucket: "STRING_VALUE",
42+
* S3Key: "STRING_VALUE",
43+
* S3Version: "STRING_VALUE",
44+
* ZipFile: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
45+
* Handler: "STRING_VALUE", // required
46+
* },
47+
* RuntimeVersion: "STRING_VALUE",
48+
* RunConfig: { // CanaryRunConfigInput
49+
* TimeoutInSeconds: Number("int"),
50+
* MemoryInMB: Number("int"),
51+
* ActiveTracing: true || false,
52+
* EnvironmentVariables: { // EnvironmentVariablesMap
53+
* "<keys>": "STRING_VALUE",
54+
* },
55+
* },
56+
* VpcConfig: { // VpcConfigInput
57+
* SubnetIds: [ // SubnetIds
58+
* "STRING_VALUE",
59+
* ],
60+
* SecurityGroupIds: [ // SecurityGroupIds
61+
* "STRING_VALUE",
62+
* ],
63+
* Ipv6AllowedForDualStack: true || false,
64+
* },
65+
* ExecutionRoleArn: "STRING_VALUE",
66+
* SuccessRetentionPeriodInDays: Number("int"),
67+
* FailureRetentionPeriodInDays: Number("int"),
68+
* VisualReference: { // VisualReferenceInput
69+
* BaseScreenshots: [ // BaseScreenshots
70+
* { // BaseScreenshot
71+
* ScreenshotName: "STRING_VALUE", // required
72+
* IgnoreCoordinates: [ // BaseScreenshotIgnoreCoordinates
73+
* "STRING_VALUE",
74+
* ],
75+
* },
76+
* ],
77+
* BaseCanaryRunId: "STRING_VALUE", // required
78+
* },
79+
* ArtifactS3Location: "STRING_VALUE",
80+
* ArtifactConfig: { // ArtifactConfigInput
81+
* S3Encryption: { // S3EncryptionConfig
82+
* EncryptionMode: "SSE_S3" || "SSE_KMS",
83+
* KmsKeyArn: "STRING_VALUE",
84+
* },
85+
* },
86+
* ProvisionedResourceCleanup: "AUTOMATIC" || "OFF",
87+
* };
88+
* const command = new StartCanaryDryRunCommand(input);
89+
* const response = await client.send(command);
90+
* // { // StartCanaryDryRunResponse
91+
* // DryRunConfig: { // DryRunConfigOutput
92+
* // DryRunId: "STRING_VALUE",
93+
* // LastDryRunExecutionStatus: "STRING_VALUE",
94+
* // },
95+
* // };
96+
*
97+
* ```
98+
*
99+
* @param StartCanaryDryRunCommandInput - {@link StartCanaryDryRunCommandInput}
100+
* @returns {@link StartCanaryDryRunCommandOutput}
101+
* @see {@link StartCanaryDryRunCommandInput} for command's `input` shape.
102+
* @see {@link StartCanaryDryRunCommandOutput} for command's `response` shape.
103+
* @see {@link SyntheticsClientResolvedConfig | config} for SyntheticsClient's `config` shape.
104+
*
105+
* @throws {@link AccessDeniedException} (client fault)
106+
* <p>You don't have permission to perform this operation on this resource.</p>
107+
*
108+
* @throws {@link ConflictException} (client fault)
109+
* <p>A conflicting operation is already in progress.</p>
110+
*
111+
* @throws {@link InternalServerException} (server fault)
112+
* <p>An unknown internal error occurred.</p>
113+
*
114+
* @throws {@link ResourceNotFoundException} (client fault)
115+
* <p>One of the specified resources was not found.</p>
116+
*
117+
* @throws {@link ValidationException} (client fault)
118+
* <p>A parameter could not be validated.</p>
119+
*
120+
* @throws {@link SyntheticsServiceException}
121+
* <p>Base exception class for all service exceptions from Synthetics service.</p>
122+
*
123+
*
124+
* @public
125+
*/
126+
export class StartCanaryDryRunCommand extends $Command
127+
.classBuilder<
128+
StartCanaryDryRunCommandInput,
129+
StartCanaryDryRunCommandOutput,
130+
SyntheticsClientResolvedConfig,
131+
ServiceInputTypes,
132+
ServiceOutputTypes
133+
>()
134+
.ep(commonParams)
135+
.m(function (this: any, Command: any, cs: any, config: SyntheticsClientResolvedConfig, o: any) {
136+
return [
137+
getSerdePlugin(config, this.serialize, this.deserialize),
138+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
139+
];
140+
})
141+
.s("Synthetics", "StartCanaryDryRun", {})
142+
.n("SyntheticsClient", "StartCanaryDryRunCommand")
143+
.f(void 0, void 0)
144+
.ser(se_StartCanaryDryRunCommand)
145+
.de(de_StartCanaryDryRunCommand)
146+
.build() {
147+
/** @internal type navigation helper, not in runtime. */
148+
protected declare static __types: {
149+
api: {
150+
input: StartCanaryDryRunRequest;
151+
output: StartCanaryDryRunResponse;
152+
};
153+
sdk: {
154+
input: StartCanaryDryRunCommandInput;
155+
output: StartCanaryDryRunCommandOutput;
156+
};
157+
};
158+
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export interface UpdateCanaryCommandOutput extends UpdateCanaryResponse, __Metad
3333
* <p>You can't use this operation to update the tags of an existing canary. To
3434
* change the tags of an existing canary, use
3535
* <a href="https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_TagResource.html">TagResource</a>.</p>
36+
* <note>
37+
* <p>When you use the <code>dryRunId</code> field when updating a canary, the only other field you can provide is the <code>Schedule</code>. Adding any other field will thrown an exception.</p>
38+
* </note>
3639
* @example
3740
* Use a bare-bones client and the command you need to make an API call.
3841
* ```javascript
@@ -92,6 +95,7 @@ export interface UpdateCanaryCommandOutput extends UpdateCanaryResponse, __Metad
9295
* },
9396
* },
9497
* ProvisionedResourceCleanup: "AUTOMATIC" || "OFF",
98+
* DryRunId: "STRING_VALUE",
9599
* };
96100
* const command = new UpdateCanaryCommand(input);
97101
* const response = await client.send(command);
@@ -105,6 +109,9 @@ export interface UpdateCanaryCommandOutput extends UpdateCanaryResponse, __Metad
105109
* @see {@link UpdateCanaryCommandOutput} for command's `response` shape.
106110
* @see {@link SyntheticsClientResolvedConfig | config} for SyntheticsClient's `config` shape.
107111
*
112+
* @throws {@link AccessDeniedException} (client fault)
113+
* <p>You don't have permission to perform this operation on this resource.</p>
114+
*
108115
* @throws {@link ConflictException} (client fault)
109116
* <p>A conflicting operation is already in progress.</p>
110117
*

0 commit comments

Comments
 (0)