Skip to content

Commit 0415fbd

Browse files
authored
Merge pull request #1070 from joviegas/release
Merging RDS pre-signed URL customization for StartDBInstanceAutomated…
2 parents 178ce1e + 6a38b83 commit 0415fbd

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.services.rds.internal;
17+
18+
import software.amazon.awssdk.annotations.SdkInternalApi;
19+
import software.amazon.awssdk.http.SdkHttpFullRequest;
20+
import software.amazon.awssdk.services.rds.model.StartDbInstanceAutomatedBackupsReplicationRequest;
21+
import software.amazon.awssdk.services.rds.transform.StartDbInstanceAutomatedBackupsReplicationRequestMarshaller;
22+
23+
/**
24+
* Handler for pre-signing {@link StartDbInstanceAutomatedBackupsReplicationRequest}.
25+
*/
26+
@SdkInternalApi
27+
public final class StartDbInstanceAutomatedBackupsReplicationPresignInterceptor extends
28+
RdsPresignInterceptor<StartDbInstanceAutomatedBackupsReplicationRequest> {
29+
30+
public static final StartDbInstanceAutomatedBackupsReplicationRequestMarshaller MARSHALLER =
31+
new StartDbInstanceAutomatedBackupsReplicationRequestMarshaller(PROTOCOL_FACTORY);
32+
33+
public StartDbInstanceAutomatedBackupsReplicationPresignInterceptor() {
34+
super(StartDbInstanceAutomatedBackupsReplicationRequest.class);
35+
}
36+
37+
@Override
38+
protected PresignableRequest adaptRequest(final StartDbInstanceAutomatedBackupsReplicationRequest originalRequest) {
39+
return new PresignableRequest() {
40+
@Override
41+
public String getSourceRegion() {
42+
return originalRequest.sourceRegion();
43+
}
44+
45+
@Override
46+
public SdkHttpFullRequest marshall() {
47+
return MARSHALLER.marshall(originalRequest);
48+
}
49+
};
50+
}
51+
}

services/rds/src/main/resources/codegen-resources/customization.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@
4343
}
4444
}
4545
]
46+
},
47+
"StartDBInstanceAutomatedBackupsReplicationMessage" : {
48+
"inject" : [
49+
{
50+
// This is for enabling automatic request presigning only; it should not be marshalled
51+
"SourceRegion" : {
52+
"shape" : "String",
53+
"documentation" : "If PreSignedUrl is not specified, this is the region where the source snapshot is located. A PreSignedUrl will be generated automatically by the SDK."
54+
}
55+
}
56+
]
4657
}
4758
},
4859
"blacklistedSimpleMethods" : ["failoverDBCluster"],
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
software.amazon.awssdk.services.rds.internal.CopyDbClusterSnapshotPresignInterceptor
22
software.amazon.awssdk.services.rds.internal.CopyDbSnapshotPresignInterceptor
33
software.amazon.awssdk.services.rds.internal.CreateDbClusterPresignInterceptor
4-
software.amazon.awssdk.services.rds.internal.CreateDbInstanceReadReplicaPresignInterceptor
4+
software.amazon.awssdk.services.rds.internal.CreateDbInstanceReadReplicaPresignInterceptor
5+
software.amazon.awssdk.services.rds.internal.StartDbInstanceAutomatedBackupsReplicationPresignInterceptor

services/rds/src/test/java/software/amazon/awssdk/services/rds/internal/PresignRequestWireMockTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,10 @@ public void verifyMethodCallSendsPresignedUrl(Runnable methodCall, String action
9898
assertThat(lastRequestBody).contains("PreSignedUrl=https%3A%2F%2Frds.us-west-2.amazonaws.com%3FAction%3D" + actionName
9999
+ "%26Version%3D2014-10-31%26DestinationRegion%3Dus-east-1%26");
100100
}
101+
102+
@Test
103+
public void startDBInstanceAutomatedBackupsReplicationWithSourceRegionSendsPresignedUrl() {
104+
verifyMethodCallSendsPresignedUrl(() -> client.startDBInstanceAutomatedBackupsReplication(r -> r.sourceRegion("us-west-2")),
105+
"StartDBInstanceAutomatedBackupsReplication");
106+
}
101107
}

0 commit comments

Comments
 (0)