Skip to content

Commit db87eef

Browse files
authored
chore(clients): support cross-region-copying in DocDB and Neptune (#1985)
1 parent 7fa4eaf commit db87eef

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed

Diff for: clients/client-docdb/commands/CopyDBClusterSnapshotCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
deserializeAws_queryCopyDBClusterSnapshotCommand,
55
serializeAws_queryCopyDBClusterSnapshotCommand,
66
} from "../protocols/Aws_query";
7+
import { getCrossRegionPresignedUrlPlugin } from "@aws-sdk/middleware-sdk-rds";
78
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
89
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
910
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -57,6 +58,7 @@ export class CopyDBClusterSnapshotCommand extends $Command<
5758
options?: __HttpHandlerOptions
5859
): Handler<CopyDBClusterSnapshotCommandInput, CopyDBClusterSnapshotCommandOutput> {
5960
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
61+
this.middlewareStack.use(getCrossRegionPresignedUrlPlugin(configuration));
6062

6163
const stack = clientStack.concat(this.middlewareStack);
6264

Diff for: clients/client-docdb/commands/CreateDBClusterCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
deserializeAws_queryCreateDBClusterCommand,
55
serializeAws_queryCreateDBClusterCommand,
66
} from "../protocols/Aws_query";
7+
import { getCrossRegionPresignedUrlPlugin } from "@aws-sdk/middleware-sdk-rds";
78
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
89
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
910
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -46,6 +47,7 @@ export class CreateDBClusterCommand extends $Command<
4647
options?: __HttpHandlerOptions
4748
): Handler<CreateDBClusterCommandInput, CreateDBClusterCommandOutput> {
4849
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
50+
this.middlewareStack.use(getCrossRegionPresignedUrlPlugin(configuration));
4951

5052
const stack = clientStack.concat(this.middlewareStack);
5153

Diff for: clients/client-neptune/commands/CopyDBClusterSnapshotCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
deserializeAws_queryCopyDBClusterSnapshotCommand,
55
serializeAws_queryCopyDBClusterSnapshotCommand,
66
} from "../protocols/Aws_query";
7+
import { getCrossRegionPresignedUrlPlugin } from "@aws-sdk/middleware-sdk-rds";
78
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
89
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
910
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -49,6 +50,7 @@ export class CopyDBClusterSnapshotCommand extends $Command<
4950
options?: __HttpHandlerOptions
5051
): Handler<CopyDBClusterSnapshotCommandInput, CopyDBClusterSnapshotCommandOutput> {
5152
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
53+
this.middlewareStack.use(getCrossRegionPresignedUrlPlugin(configuration));
5254

5355
const stack = clientStack.concat(this.middlewareStack);
5456

Diff for: clients/client-neptune/commands/CreateDBClusterCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
deserializeAws_queryCreateDBClusterCommand,
55
serializeAws_queryCreateDBClusterCommand,
66
} from "../protocols/Aws_query";
7+
import { getCrossRegionPresignedUrlPlugin } from "@aws-sdk/middleware-sdk-rds";
78
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
89
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
910
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -52,6 +53,7 @@ export class CreateDBClusterCommand extends $Command<
5253
options?: __HttpHandlerOptions
5354
): Handler<CreateDBClusterCommandInput, CreateDBClusterCommandOutput> {
5455
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
56+
this.middlewareStack.use(getCrossRegionPresignedUrlPlugin(configuration));
5557

5658
const stack = clientStack.concat(this.middlewareStack);
5759

Diff for: clients/client-rds/commands/StartDBInstanceAutomatedBackupsReplicationCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
deserializeAws_queryStartDBInstanceAutomatedBackupsReplicationCommand,
88
serializeAws_queryStartDBInstanceAutomatedBackupsReplicationCommand,
99
} from "../protocols/Aws_query";
10+
import { getCrossRegionPresignedUrlPlugin } from "@aws-sdk/middleware-sdk-rds";
1011
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
1112
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
1213
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -56,6 +57,7 @@ export class StartDBInstanceAutomatedBackupsReplicationCommand extends $Command<
5657
StartDBInstanceAutomatedBackupsReplicationCommandOutput
5758
> {
5859
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
60+
this.middlewareStack.use(getCrossRegionPresignedUrlPlugin(configuration));
5961

6062
const stack = clientStack.concat(this.middlewareStack);
6163

Diff for: codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddCrossRegionCopyingPlugin.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@
2828
import software.amazon.smithy.utils.SetUtils;
2929

3030
public class AddCrossRegionCopyingPlugin implements TypeScriptIntegration {
31+
private static final Set<String> SHARED_PRESIGNED_URL_OPERATIONS = SetUtils.of(
32+
"CopyDBClusterSnapshot",
33+
"CreateDBCluster"
34+
);
3135
private static final Set<String> RDS_PRESIGNED_URL_OPERATIONS = SetUtils.of(
3236
"CopyDBSnapshot",
3337
"CreateDBInstanceReadReplica",
34-
"CreateDBCluster",
35-
"CopyDBClusterSnapshot"
38+
"StartDBInstanceAutomatedBackupsReplication"
3639
);
3740

3841
@Override
@@ -43,6 +46,12 @@ public List<RuntimeClientPlugin> getClientPlugins() {
4346
HAS_MIDDLEWARE)
4447
.operationPredicate((m, s, o) -> RDS_PRESIGNED_URL_OPERATIONS.contains(o.getId().getName())
4548
&& testServiceId(s, "RDS"))
49+
.build(),
50+
RuntimeClientPlugin.builder()
51+
.withConventions(AwsDependency.RDS_MIDDLEWARE.dependency, "CrossRegionPresignedUrl",
52+
HAS_MIDDLEWARE)
53+
.operationPredicate((m, s, o) -> SHARED_PRESIGNED_URL_OPERATIONS.contains(o.getId().getName())
54+
&& (testServiceId(s, "RDS") || testServiceId(s, "DocDB") || testServiceId(s, "Neptune")))
4655
.build()
4756
);
4857
}

0 commit comments

Comments
 (0)