Skip to content

Commit 6ed4f9b

Browse files
author
awstools
committed
feat(client-database-migration-service): New api to migrate event subscriptions to event bridge rules
1 parent 0dd0bdd commit 6ed4f9b

File tree

7 files changed

+347
-2
lines changed

7 files changed

+347
-2
lines changed

clients/client-database-migration-service/src/DatabaseMigrationService.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ import {
321321
TestConnectionCommandInput,
322322
TestConnectionCommandOutput,
323323
} from "./commands/TestConnectionCommand";
324+
import {
325+
UpdateSubscriptionsToEventBridgeCommand,
326+
UpdateSubscriptionsToEventBridgeCommandInput,
327+
UpdateSubscriptionsToEventBridgeCommandOutput,
328+
} from "./commands/UpdateSubscriptionsToEventBridgeCommand";
324329
import { DatabaseMigrationServiceClient } from "./DatabaseMigrationServiceClient";
325330

326331
/**
@@ -2558,4 +2563,44 @@ export class DatabaseMigrationService extends DatabaseMigrationServiceClient {
25582563
return this.send(command, optionsOrCb);
25592564
}
25602565
}
2566+
2567+
/**
2568+
* <p>Migrates 10 active and enabled Amazon SNS subscriptions at a time and converts them to corresponding Amazon EventBridge rules.
2569+
* By default, this operation migrates subscriptions only when all your replication instance versions are 3.4.6 or higher.
2570+
* If any replication instances are from versions earlier than 3.4.6, the operation raises an error and tells you
2571+
* to upgrade these instances to version 3.4.6 or higher. To enable migration regardless of version, set the <code>Force</code>
2572+
* option to true. However, if you don't upgrade instances earlier than version 3.4.6, some types of events might not be
2573+
* available when you use Amazon EventBridge.</p>
2574+
* <p>To call this operation, make sure that you have certain permissions added to your user account.
2575+
* For more information, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html#CHAP_Events-migrate-to-eventbridge">Migrating event subscriptions to Amazon EventBridge</a>
2576+
* in the <i>Amazon Web Services Database Migration Service User Guide</i>.</p>
2577+
*/
2578+
public updateSubscriptionsToEventBridge(
2579+
args: UpdateSubscriptionsToEventBridgeCommandInput,
2580+
options?: __HttpHandlerOptions
2581+
): Promise<UpdateSubscriptionsToEventBridgeCommandOutput>;
2582+
public updateSubscriptionsToEventBridge(
2583+
args: UpdateSubscriptionsToEventBridgeCommandInput,
2584+
cb: (err: any, data?: UpdateSubscriptionsToEventBridgeCommandOutput) => void
2585+
): void;
2586+
public updateSubscriptionsToEventBridge(
2587+
args: UpdateSubscriptionsToEventBridgeCommandInput,
2588+
options: __HttpHandlerOptions,
2589+
cb: (err: any, data?: UpdateSubscriptionsToEventBridgeCommandOutput) => void
2590+
): void;
2591+
public updateSubscriptionsToEventBridge(
2592+
args: UpdateSubscriptionsToEventBridgeCommandInput,
2593+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UpdateSubscriptionsToEventBridgeCommandOutput) => void),
2594+
cb?: (err: any, data?: UpdateSubscriptionsToEventBridgeCommandOutput) => void
2595+
): Promise<UpdateSubscriptionsToEventBridgeCommandOutput> | void {
2596+
const command = new UpdateSubscriptionsToEventBridgeCommand(args);
2597+
if (typeof optionsOrCb === "function") {
2598+
this.send(command, optionsOrCb);
2599+
} else if (typeof cb === "function") {
2600+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
2601+
this.send(command, optionsOrCb || {}, cb);
2602+
} else {
2603+
return this.send(command, optionsOrCb);
2604+
}
2605+
}
25612606
}

clients/client-database-migration-service/src/DatabaseMigrationServiceClient.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ import {
270270
StopReplicationTaskCommandOutput,
271271
} from "./commands/StopReplicationTaskCommand";
272272
import { TestConnectionCommandInput, TestConnectionCommandOutput } from "./commands/TestConnectionCommand";
273+
import {
274+
UpdateSubscriptionsToEventBridgeCommandInput,
275+
UpdateSubscriptionsToEventBridgeCommandOutput,
276+
} from "./commands/UpdateSubscriptionsToEventBridgeCommand";
273277
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
274278

275279
export type ServiceInputTypes =
@@ -336,7 +340,8 @@ export type ServiceInputTypes =
336340
| StartReplicationTaskAssessmentRunCommandInput
337341
| StartReplicationTaskCommandInput
338342
| StopReplicationTaskCommandInput
339-
| TestConnectionCommandInput;
343+
| TestConnectionCommandInput
344+
| UpdateSubscriptionsToEventBridgeCommandInput;
340345

341346
export type ServiceOutputTypes =
342347
| AddTagsToResourceCommandOutput
@@ -402,7 +407,8 @@ export type ServiceOutputTypes =
402407
| StartReplicationTaskAssessmentRunCommandOutput
403408
| StartReplicationTaskCommandOutput
404409
| StopReplicationTaskCommandOutput
405-
| TestConnectionCommandOutput;
410+
| TestConnectionCommandOutput
411+
| UpdateSubscriptionsToEventBridgeCommandOutput;
406412

407413
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
408414
/**
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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 {
16+
DatabaseMigrationServiceClientResolvedConfig,
17+
ServiceInputTypes,
18+
ServiceOutputTypes,
19+
} from "../DatabaseMigrationServiceClient";
20+
import { UpdateSubscriptionsToEventBridgeMessage, UpdateSubscriptionsToEventBridgeResponse } from "../models/models_0";
21+
import {
22+
deserializeAws_json1_1UpdateSubscriptionsToEventBridgeCommand,
23+
serializeAws_json1_1UpdateSubscriptionsToEventBridgeCommand,
24+
} from "../protocols/Aws_json1_1";
25+
26+
export interface UpdateSubscriptionsToEventBridgeCommandInput extends UpdateSubscriptionsToEventBridgeMessage {}
27+
export interface UpdateSubscriptionsToEventBridgeCommandOutput
28+
extends UpdateSubscriptionsToEventBridgeResponse,
29+
__MetadataBearer {}
30+
31+
/**
32+
* <p>Migrates 10 active and enabled Amazon SNS subscriptions at a time and converts them to corresponding Amazon EventBridge rules.
33+
* By default, this operation migrates subscriptions only when all your replication instance versions are 3.4.6 or higher.
34+
* If any replication instances are from versions earlier than 3.4.6, the operation raises an error and tells you
35+
* to upgrade these instances to version 3.4.6 or higher. To enable migration regardless of version, set the <code>Force</code>
36+
* option to true. However, if you don't upgrade instances earlier than version 3.4.6, some types of events might not be
37+
* available when you use Amazon EventBridge.</p>
38+
* <p>To call this operation, make sure that you have certain permissions added to your user account.
39+
* For more information, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html#CHAP_Events-migrate-to-eventbridge">Migrating event subscriptions to Amazon EventBridge</a>
40+
* in the <i>Amazon Web Services Database Migration Service User Guide</i>.</p>
41+
* @example
42+
* Use a bare-bones client and the command you need to make an API call.
43+
* ```javascript
44+
* import { DatabaseMigrationServiceClient, UpdateSubscriptionsToEventBridgeCommand } from "@aws-sdk/client-database-migration-service"; // ES Modules import
45+
* // const { DatabaseMigrationServiceClient, UpdateSubscriptionsToEventBridgeCommand } = require("@aws-sdk/client-database-migration-service"); // CommonJS import
46+
* const client = new DatabaseMigrationServiceClient(config);
47+
* const command = new UpdateSubscriptionsToEventBridgeCommand(input);
48+
* const response = await client.send(command);
49+
* ```
50+
*
51+
* @see {@link UpdateSubscriptionsToEventBridgeCommandInput} for command's `input` shape.
52+
* @see {@link UpdateSubscriptionsToEventBridgeCommandOutput} for command's `response` shape.
53+
* @see {@link DatabaseMigrationServiceClientResolvedConfig | config} for DatabaseMigrationServiceClient's `config` shape.
54+
*
55+
*/
56+
export class UpdateSubscriptionsToEventBridgeCommand extends $Command<
57+
UpdateSubscriptionsToEventBridgeCommandInput,
58+
UpdateSubscriptionsToEventBridgeCommandOutput,
59+
DatabaseMigrationServiceClientResolvedConfig
60+
> {
61+
// Start section: command_properties
62+
// End section: command_properties
63+
64+
constructor(readonly input: UpdateSubscriptionsToEventBridgeCommandInput) {
65+
// Start section: command_constructor
66+
super();
67+
// End section: command_constructor
68+
}
69+
70+
/**
71+
* @internal
72+
*/
73+
resolveMiddleware(
74+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
75+
configuration: DatabaseMigrationServiceClientResolvedConfig,
76+
options?: __HttpHandlerOptions
77+
): Handler<UpdateSubscriptionsToEventBridgeCommandInput, UpdateSubscriptionsToEventBridgeCommandOutput> {
78+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
79+
80+
const stack = clientStack.concat(this.middlewareStack);
81+
82+
const { logger } = configuration;
83+
const clientName = "DatabaseMigrationServiceClient";
84+
const commandName = "UpdateSubscriptionsToEventBridgeCommand";
85+
const handlerExecutionContext: HandlerExecutionContext = {
86+
logger,
87+
clientName,
88+
commandName,
89+
inputFilterSensitiveLog: UpdateSubscriptionsToEventBridgeMessage.filterSensitiveLog,
90+
outputFilterSensitiveLog: UpdateSubscriptionsToEventBridgeResponse.filterSensitiveLog,
91+
};
92+
const { requestHandler } = configuration;
93+
return stack.resolve(
94+
(request: FinalizeHandlerArguments<any>) =>
95+
requestHandler.handle(request.request as __HttpRequest, options || {}),
96+
handlerExecutionContext
97+
);
98+
}
99+
100+
private serialize(
101+
input: UpdateSubscriptionsToEventBridgeCommandInput,
102+
context: __SerdeContext
103+
): Promise<__HttpRequest> {
104+
return serializeAws_json1_1UpdateSubscriptionsToEventBridgeCommand(input, context);
105+
}
106+
107+
private deserialize(
108+
output: __HttpResponse,
109+
context: __SerdeContext
110+
): Promise<UpdateSubscriptionsToEventBridgeCommandOutput> {
111+
return deserializeAws_json1_1UpdateSubscriptionsToEventBridgeCommand(output, context);
112+
}
113+
114+
// Start section: command_body_extra
115+
// End section: command_body_extra
116+
}

clients/client-database-migration-service/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ export * from "./StartReplicationTaskAssessmentRunCommand";
6363
export * from "./StartReplicationTaskCommand";
6464
export * from "./StopReplicationTaskCommand";
6565
export * from "./TestConnectionCommand";
66+
export * from "./UpdateSubscriptionsToEventBridgeCommand";

clients/client-database-migration-service/src/models/models_0.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10443,3 +10443,45 @@ export namespace TestConnectionResponse {
1044310443
...obj,
1044410444
});
1044510445
}
10446+
10447+
/**
10448+
* <p></p>
10449+
*/
10450+
export interface UpdateSubscriptionsToEventBridgeMessage {
10451+
/**
10452+
* <p>When set to true, this operation migrates DMS subscriptions for Amazon SNS
10453+
* notifications no matter what your replication instance version is. If not set or set to
10454+
* false, this operation runs only when all your replication instances are from DMS
10455+
* version 3.4.6 or higher.
10456+
* </p>
10457+
*/
10458+
ForceMove?: boolean;
10459+
}
10460+
10461+
export namespace UpdateSubscriptionsToEventBridgeMessage {
10462+
/**
10463+
* @internal
10464+
*/
10465+
export const filterSensitiveLog = (obj: UpdateSubscriptionsToEventBridgeMessage): any => ({
10466+
...obj,
10467+
});
10468+
}
10469+
10470+
/**
10471+
* <p></p>
10472+
*/
10473+
export interface UpdateSubscriptionsToEventBridgeResponse {
10474+
/**
10475+
* <p>A string that indicates how many event subscriptions were migrated and how many remain to be migrated.</p>
10476+
*/
10477+
Result?: string;
10478+
}
10479+
10480+
export namespace UpdateSubscriptionsToEventBridgeResponse {
10481+
/**
10482+
* @internal
10483+
*/
10484+
export const filterSensitiveLog = (obj: UpdateSubscriptionsToEventBridgeResponse): any => ({
10485+
...obj,
10486+
});
10487+
}

clients/client-database-migration-service/src/protocols/Aws_json1_1.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ import {
235235
StopReplicationTaskCommandOutput,
236236
} from "../commands/StopReplicationTaskCommand";
237237
import { TestConnectionCommandInput, TestConnectionCommandOutput } from "../commands/TestConnectionCommand";
238+
import {
239+
UpdateSubscriptionsToEventBridgeCommandInput,
240+
UpdateSubscriptionsToEventBridgeCommandOutput,
241+
} from "../commands/UpdateSubscriptionsToEventBridgeCommand";
238242
import { DatabaseMigrationServiceServiceException as __BaseException } from "../models/DatabaseMigrationServiceServiceException";
239243
import {
240244
AccessDeniedFault,
@@ -446,6 +450,8 @@ import {
446450
Tag,
447451
TestConnectionMessage,
448452
TestConnectionResponse,
453+
UpdateSubscriptionsToEventBridgeMessage,
454+
UpdateSubscriptionsToEventBridgeResponse,
449455
UpgradeDependencyFailureFault,
450456
VpcSecurityGroupMembership,
451457
} from "../models/models_0";
@@ -1281,6 +1287,19 @@ export const serializeAws_json1_1TestConnectionCommand = async (
12811287
return buildHttpRpcRequest(context, headers, "/", undefined, body);
12821288
};
12831289

1290+
export const serializeAws_json1_1UpdateSubscriptionsToEventBridgeCommand = async (
1291+
input: UpdateSubscriptionsToEventBridgeCommandInput,
1292+
context: __SerdeContext
1293+
): Promise<__HttpRequest> => {
1294+
const headers: __HeaderBag = {
1295+
"content-type": "application/x-amz-json-1.1",
1296+
"x-amz-target": "AmazonDMSv20160101.UpdateSubscriptionsToEventBridge",
1297+
};
1298+
let body: any;
1299+
body = JSON.stringify(serializeAws_json1_1UpdateSubscriptionsToEventBridgeMessage(input, context));
1300+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
1301+
};
1302+
12841303
export const deserializeAws_json1_1AddTagsToResourceCommand = async (
12851304
output: __HttpResponse,
12861305
context: __SerdeContext
@@ -4421,6 +4440,53 @@ const deserializeAws_json1_1TestConnectionCommandError = async (
44214440
}
44224441
};
44234442

4443+
export const deserializeAws_json1_1UpdateSubscriptionsToEventBridgeCommand = async (
4444+
output: __HttpResponse,
4445+
context: __SerdeContext
4446+
): Promise<UpdateSubscriptionsToEventBridgeCommandOutput> => {
4447+
if (output.statusCode >= 300) {
4448+
return deserializeAws_json1_1UpdateSubscriptionsToEventBridgeCommandError(output, context);
4449+
}
4450+
const data: any = await parseBody(output.body, context);
4451+
let contents: any = {};
4452+
contents = deserializeAws_json1_1UpdateSubscriptionsToEventBridgeResponse(data, context);
4453+
const response: UpdateSubscriptionsToEventBridgeCommandOutput = {
4454+
$metadata: deserializeMetadata(output),
4455+
...contents,
4456+
};
4457+
return Promise.resolve(response);
4458+
};
4459+
4460+
const deserializeAws_json1_1UpdateSubscriptionsToEventBridgeCommandError = async (
4461+
output: __HttpResponse,
4462+
context: __SerdeContext
4463+
): Promise<UpdateSubscriptionsToEventBridgeCommandOutput> => {
4464+
const parsedOutput: any = {
4465+
...output,
4466+
body: await parseBody(output.body, context),
4467+
};
4468+
let response: __BaseException;
4469+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4470+
switch (errorCode) {
4471+
case "AccessDeniedFault":
4472+
case "com.amazonaws.databasemigrationservice#AccessDeniedFault":
4473+
throw await deserializeAws_json1_1AccessDeniedFaultResponse(parsedOutput, context);
4474+
case "InvalidResourceStateFault":
4475+
case "com.amazonaws.databasemigrationservice#InvalidResourceStateFault":
4476+
throw await deserializeAws_json1_1InvalidResourceStateFaultResponse(parsedOutput, context);
4477+
default:
4478+
const parsedBody = parsedOutput.body;
4479+
const $metadata = deserializeMetadata(output);
4480+
const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4481+
response = new __BaseException({
4482+
name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4483+
$fault: "client",
4484+
$metadata,
4485+
});
4486+
throw __decorateServiceException(response, parsedBody);
4487+
}
4488+
};
4489+
44244490
const deserializeAws_json1_1AccessDeniedFaultResponse = async (
44254491
parsedOutput: any,
44264492
context: __SerdeContext
@@ -6463,6 +6529,15 @@ const serializeAws_json1_1TestConnectionMessage = (input: TestConnectionMessage,
64636529
};
64646530
};
64656531

6532+
const serializeAws_json1_1UpdateSubscriptionsToEventBridgeMessage = (
6533+
input: UpdateSubscriptionsToEventBridgeMessage,
6534+
context: __SerdeContext
6535+
): any => {
6536+
return {
6537+
...(input.ForceMove !== undefined && input.ForceMove !== null && { ForceMove: input.ForceMove }),
6538+
};
6539+
};
6540+
64666541
const serializeAws_json1_1VpcSecurityGroupIdList = (input: string[], context: __SerdeContext): any => {
64676542
return input
64686543
.filter((e: any) => e != null)
@@ -8988,6 +9063,15 @@ const deserializeAws_json1_1TestConnectionResponse = (output: any, context: __Se
89889063
} as any;
89899064
};
89909065

9066+
const deserializeAws_json1_1UpdateSubscriptionsToEventBridgeResponse = (
9067+
output: any,
9068+
context: __SerdeContext
9069+
): UpdateSubscriptionsToEventBridgeResponse => {
9070+
return {
9071+
Result: __expectString(output.Result),
9072+
} as any;
9073+
};
9074+
89919075
const deserializeAws_json1_1UpgradeDependencyFailureFault = (
89929076
output: any,
89939077
context: __SerdeContext

0 commit comments

Comments
 (0)