Skip to content

Commit 5e37998

Browse files
author
awstools
committed
feat(client-synthetics): This release introduces Group feature, which enables users to group cross-region canaries.
1 parent 8ed0e09 commit 5e37998

26 files changed

+3676
-275
lines changed

clients/client-synthetics/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ using your favorite package manager:
4242

4343
The AWS SDK is modulized by clients and commands.
4444
To send a request, you only need to import the `SyntheticsClient` and
45-
the commands you need, for example `CreateCanaryCommand`:
45+
the commands you need, for example `AssociateResourceCommand`:
4646

4747
```js
4848
// ES5 example
49-
const { SyntheticsClient, CreateCanaryCommand } = require("@aws-sdk/client-synthetics");
49+
const { SyntheticsClient, AssociateResourceCommand } = require("@aws-sdk/client-synthetics");
5050
```
5151

5252
```ts
5353
// ES6+ example
54-
import { SyntheticsClient, CreateCanaryCommand } from "@aws-sdk/client-synthetics";
54+
import { SyntheticsClient, AssociateResourceCommand } from "@aws-sdk/client-synthetics";
5555
```
5656

5757
### Usage
@@ -70,7 +70,7 @@ const client = new SyntheticsClient({ region: "REGION" });
7070
const params = {
7171
/** input parameters */
7272
};
73-
const command = new CreateCanaryCommand(params);
73+
const command = new AssociateResourceCommand(params);
7474
```
7575

7676
#### Async/await
@@ -149,15 +149,15 @@ const client = new AWS.Synthetics({ region: "REGION" });
149149

150150
// async/await.
151151
try {
152-
const data = await client.createCanary(params);
152+
const data = await client.associateResource(params);
153153
// process data.
154154
} catch (error) {
155155
// error handling.
156156
}
157157

158158
// Promises.
159159
client
160-
.createCanary(params)
160+
.associateResource(params)
161161
.then((data) => {
162162
// process data.
163163
})
@@ -166,7 +166,7 @@ client
166166
});
167167

168168
// callbacks.
169-
client.createCanary(params, (err, data) => {
169+
client.associateResource(params, (err, data) => {
170170
// process err and data.
171171
});
172172
```

clients/client-synthetics/src/Synthetics.ts

Lines changed: 290 additions & 11 deletions
Large diffs are not rendered by default.

clients/client-synthetics/src/SyntheticsClient.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ import {
5353
UserAgent as __UserAgent,
5454
} from "@aws-sdk/types";
5555

56+
import { AssociateResourceCommandInput, AssociateResourceCommandOutput } from "./commands/AssociateResourceCommand";
5657
import { CreateCanaryCommandInput, CreateCanaryCommandOutput } from "./commands/CreateCanaryCommand";
58+
import { CreateGroupCommandInput, CreateGroupCommandOutput } from "./commands/CreateGroupCommand";
5759
import { DeleteCanaryCommandInput, DeleteCanaryCommandOutput } from "./commands/DeleteCanaryCommand";
60+
import { DeleteGroupCommandInput, DeleteGroupCommandOutput } from "./commands/DeleteGroupCommand";
5861
import { DescribeCanariesCommandInput, DescribeCanariesCommandOutput } from "./commands/DescribeCanariesCommand";
5962
import {
6063
DescribeCanariesLastRunCommandInput,
@@ -64,8 +67,19 @@ import {
6467
DescribeRuntimeVersionsCommandInput,
6568
DescribeRuntimeVersionsCommandOutput,
6669
} from "./commands/DescribeRuntimeVersionsCommand";
70+
import {
71+
DisassociateResourceCommandInput,
72+
DisassociateResourceCommandOutput,
73+
} from "./commands/DisassociateResourceCommand";
6774
import { GetCanaryCommandInput, GetCanaryCommandOutput } from "./commands/GetCanaryCommand";
6875
import { GetCanaryRunsCommandInput, GetCanaryRunsCommandOutput } from "./commands/GetCanaryRunsCommand";
76+
import { GetGroupCommandInput, GetGroupCommandOutput } from "./commands/GetGroupCommand";
77+
import {
78+
ListAssociatedGroupsCommandInput,
79+
ListAssociatedGroupsCommandOutput,
80+
} from "./commands/ListAssociatedGroupsCommand";
81+
import { ListGroupResourcesCommandInput, ListGroupResourcesCommandOutput } from "./commands/ListGroupResourcesCommand";
82+
import { ListGroupsCommandInput, ListGroupsCommandOutput } from "./commands/ListGroupsCommand";
6983
import {
7084
ListTagsForResourceCommandInput,
7185
ListTagsForResourceCommandOutput,
@@ -78,13 +92,21 @@ import { UpdateCanaryCommandInput, UpdateCanaryCommandOutput } from "./commands/
7892
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
7993

8094
export type ServiceInputTypes =
95+
| AssociateResourceCommandInput
8196
| CreateCanaryCommandInput
97+
| CreateGroupCommandInput
8298
| DeleteCanaryCommandInput
99+
| DeleteGroupCommandInput
83100
| DescribeCanariesCommandInput
84101
| DescribeCanariesLastRunCommandInput
85102
| DescribeRuntimeVersionsCommandInput
103+
| DisassociateResourceCommandInput
86104
| GetCanaryCommandInput
87105
| GetCanaryRunsCommandInput
106+
| GetGroupCommandInput
107+
| ListAssociatedGroupsCommandInput
108+
| ListGroupResourcesCommandInput
109+
| ListGroupsCommandInput
88110
| ListTagsForResourceCommandInput
89111
| StartCanaryCommandInput
90112
| StopCanaryCommandInput
@@ -93,13 +115,21 @@ export type ServiceInputTypes =
93115
| UpdateCanaryCommandInput;
94116

95117
export type ServiceOutputTypes =
118+
| AssociateResourceCommandOutput
96119
| CreateCanaryCommandOutput
120+
| CreateGroupCommandOutput
97121
| DeleteCanaryCommandOutput
122+
| DeleteGroupCommandOutput
98123
| DescribeCanariesCommandOutput
99124
| DescribeCanariesLastRunCommandOutput
100125
| DescribeRuntimeVersionsCommandOutput
126+
| DisassociateResourceCommandOutput
101127
| GetCanaryCommandOutput
102128
| GetCanaryRunsCommandOutput
129+
| GetGroupCommandOutput
130+
| ListAssociatedGroupsCommandOutput
131+
| ListGroupResourcesCommandOutput
132+
| ListGroupsCommandOutput
103133
| ListTagsForResourceCommandOutput
104134
| StartCanaryCommandOutput
105135
| StopCanaryCommandOutput
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { AssociateResourceRequest, AssociateResourceResponse } from "../models/models_0";
16+
import {
17+
deserializeAws_restJson1AssociateResourceCommand,
18+
serializeAws_restJson1AssociateResourceCommand,
19+
} from "../protocols/Aws_restJson1";
20+
import { ServiceInputTypes, ServiceOutputTypes, SyntheticsClientResolvedConfig } from "../SyntheticsClient";
21+
22+
export interface AssociateResourceCommandInput extends AssociateResourceRequest {}
23+
export interface AssociateResourceCommandOutput extends AssociateResourceResponse, __MetadataBearer {}
24+
25+
/**
26+
* <p>Associates a canary with a group. Using groups can help you with
27+
* managing and automating your canaries, and you can also view aggregated run results and statistics
28+
* for all canaries in a group. </p>
29+
* <p>You must run this operation in the Region where the canary exists.</p>
30+
* @example
31+
* Use a bare-bones client and the command you need to make an API call.
32+
* ```javascript
33+
* import { SyntheticsClient, AssociateResourceCommand } from "@aws-sdk/client-synthetics"; // ES Modules import
34+
* // const { SyntheticsClient, AssociateResourceCommand } = require("@aws-sdk/client-synthetics"); // CommonJS import
35+
* const client = new SyntheticsClient(config);
36+
* const command = new AssociateResourceCommand(input);
37+
* const response = await client.send(command);
38+
* ```
39+
*
40+
* @see {@link AssociateResourceCommandInput} for command's `input` shape.
41+
* @see {@link AssociateResourceCommandOutput} for command's `response` shape.
42+
* @see {@link SyntheticsClientResolvedConfig | config} for SyntheticsClient's `config` shape.
43+
*
44+
*/
45+
export class AssociateResourceCommand extends $Command<
46+
AssociateResourceCommandInput,
47+
AssociateResourceCommandOutput,
48+
SyntheticsClientResolvedConfig
49+
> {
50+
// Start section: command_properties
51+
// End section: command_properties
52+
53+
constructor(readonly input: AssociateResourceCommandInput) {
54+
// Start section: command_constructor
55+
super();
56+
// End section: command_constructor
57+
}
58+
59+
/**
60+
* @internal
61+
*/
62+
resolveMiddleware(
63+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
64+
configuration: SyntheticsClientResolvedConfig,
65+
options?: __HttpHandlerOptions
66+
): Handler<AssociateResourceCommandInput, AssociateResourceCommandOutput> {
67+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
68+
69+
const stack = clientStack.concat(this.middlewareStack);
70+
71+
const { logger } = configuration;
72+
const clientName = "SyntheticsClient";
73+
const commandName = "AssociateResourceCommand";
74+
const handlerExecutionContext: HandlerExecutionContext = {
75+
logger,
76+
clientName,
77+
commandName,
78+
inputFilterSensitiveLog: AssociateResourceRequest.filterSensitiveLog,
79+
outputFilterSensitiveLog: AssociateResourceResponse.filterSensitiveLog,
80+
};
81+
const { requestHandler } = configuration;
82+
return stack.resolve(
83+
(request: FinalizeHandlerArguments<any>) =>
84+
requestHandler.handle(request.request as __HttpRequest, options || {}),
85+
handlerExecutionContext
86+
);
87+
}
88+
89+
private serialize(input: AssociateResourceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
90+
return serializeAws_restJson1AssociateResourceCommand(input, context);
91+
}
92+
93+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<AssociateResourceCommandOutput> {
94+
return deserializeAws_restJson1AssociateResourceCommand(output, context);
95+
}
96+
97+
// Start section: command_body_extra
98+
// End section: command_body_extra
99+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface CreateCanaryCommandOutput extends CreateCanaryResponse, __Metad
3030
* <p>Do not use <code>CreateCanary</code> to modify an existing canary. Use <a href="https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_UpdateCanary.html">UpdateCanary</a> instead.</p>
3131
* <p>To create canaries, you must have the <code>CloudWatchSyntheticsFullAccess</code> policy.
3232
* If you are creating a new IAM role for the canary, you also need the
33-
* the <code>iam:CreateRole</code>, <code>iam:CreatePolicy</code> and
33+
* <code>iam:CreateRole</code>, <code>iam:CreatePolicy</code> and
3434
* <code>iam:AttachRolePolicy</code> permissions. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Roles">Necessary
3535
* Roles and Permissions</a>.</p>
3636
* <p>Do not include secrets or proprietary information in your canary names. The canary name
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { CreateGroupRequest, CreateGroupResponse } from "../models/models_0";
16+
import {
17+
deserializeAws_restJson1CreateGroupCommand,
18+
serializeAws_restJson1CreateGroupCommand,
19+
} from "../protocols/Aws_restJson1";
20+
import { ServiceInputTypes, ServiceOutputTypes, SyntheticsClientResolvedConfig } from "../SyntheticsClient";
21+
22+
export interface CreateGroupCommandInput extends CreateGroupRequest {}
23+
export interface CreateGroupCommandOutput extends CreateGroupResponse, __MetadataBearer {}
24+
25+
/**
26+
* <p>Creates a group which you can use to associate canaries with each other, including cross-Region
27+
* canaries. Using groups can help you with
28+
* managing and automating your canaries, and you can also view aggregated run results and statistics
29+
* for all canaries in a group. </p>
30+
* <p>Groups are global resources. When you create a group, it is replicated across Amazon Web Services Regions, and
31+
* you can view it and add canaries to it from any Region.
32+
* Although the group ARN format reflects the Region name where it was created, a group is not constrained to any Region.
33+
* This means that you can put canaries from multiple Regions into the same group, and then use
34+
* that group to view and manage all of those canaries in a single view.</p>
35+
* <p>Groups are supported in all Regions except the Regions that are disabled by default. For more information
36+
* about these Regions, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande-manage.html#rande-manage-enable">Enabling a Region</a>.</p>
37+
* <p>Each group can contain as many as 10 canaries. You can have as many as 20 groups in your account. Any single canary
38+
* can be a member of up to 10 groups.</p>
39+
* @example
40+
* Use a bare-bones client and the command you need to make an API call.
41+
* ```javascript
42+
* import { SyntheticsClient, CreateGroupCommand } from "@aws-sdk/client-synthetics"; // ES Modules import
43+
* // const { SyntheticsClient, CreateGroupCommand } = require("@aws-sdk/client-synthetics"); // CommonJS import
44+
* const client = new SyntheticsClient(config);
45+
* const command = new CreateGroupCommand(input);
46+
* const response = await client.send(command);
47+
* ```
48+
*
49+
* @see {@link CreateGroupCommandInput} for command's `input` shape.
50+
* @see {@link CreateGroupCommandOutput} for command's `response` shape.
51+
* @see {@link SyntheticsClientResolvedConfig | config} for SyntheticsClient's `config` shape.
52+
*
53+
*/
54+
export class CreateGroupCommand extends $Command<
55+
CreateGroupCommandInput,
56+
CreateGroupCommandOutput,
57+
SyntheticsClientResolvedConfig
58+
> {
59+
// Start section: command_properties
60+
// End section: command_properties
61+
62+
constructor(readonly input: CreateGroupCommandInput) {
63+
// Start section: command_constructor
64+
super();
65+
// End section: command_constructor
66+
}
67+
68+
/**
69+
* @internal
70+
*/
71+
resolveMiddleware(
72+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
73+
configuration: SyntheticsClientResolvedConfig,
74+
options?: __HttpHandlerOptions
75+
): Handler<CreateGroupCommandInput, CreateGroupCommandOutput> {
76+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
77+
78+
const stack = clientStack.concat(this.middlewareStack);
79+
80+
const { logger } = configuration;
81+
const clientName = "SyntheticsClient";
82+
const commandName = "CreateGroupCommand";
83+
const handlerExecutionContext: HandlerExecutionContext = {
84+
logger,
85+
clientName,
86+
commandName,
87+
inputFilterSensitiveLog: CreateGroupRequest.filterSensitiveLog,
88+
outputFilterSensitiveLog: CreateGroupResponse.filterSensitiveLog,
89+
};
90+
const { requestHandler } = configuration;
91+
return stack.resolve(
92+
(request: FinalizeHandlerArguments<any>) =>
93+
requestHandler.handle(request.request as __HttpRequest, options || {}),
94+
handlerExecutionContext
95+
);
96+
}
97+
98+
private serialize(input: CreateGroupCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
99+
return serializeAws_restJson1CreateGroupCommand(input, context);
100+
}
101+
102+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<CreateGroupCommandOutput> {
103+
return deserializeAws_restJson1CreateGroupCommand(output, context);
104+
}
105+
106+
// Start section: command_body_extra
107+
// End section: command_body_extra
108+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface DeleteCanaryCommandOutput extends DeleteCanaryResponse, __Metad
2626
* <p>Permanently deletes the specified canary.</p>
2727
* <p>If you specify <code>DeleteLambda</code> to <code>true</code>, CloudWatch Synthetics also deletes
2828
* the Lambda functions and layers that are used by the canary.</p>
29-
* <p>Other esources used and created by the canary are not automatically deleted.
29+
* <p>Other resources used and created by the canary are not automatically deleted.
3030
* After you delete a canary that you do not intend to
3131
* use again, you
3232
* should also delete the following:</p>

0 commit comments

Comments
 (0)