Skip to content

Commit 7d3c34b

Browse files
dbbackuprestore: add examples (#301)
1 parent 2e39086 commit 7d3c34b

File tree

7 files changed

+351
-24
lines changed

7 files changed

+351
-24
lines changed

dbbackuprestore/dbbackuprestore-aws/src/main/java/com/salesforce/multicloudj/dbbackuprestore/aws/AwsDBBackupRestore.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ public AwsDBBackupRestore() {
6060
public AwsDBBackupRestore(Builder builder) {
6161
super(builder);
6262
this.backupClient = builder.backupClient;
63-
64-
// Build the DynamoDB table ARN
65-
// Format: arn:aws:dynamodb:{region}:{account-id}:table/{table-name}
66-
// Since we don't have account ID readily available, we'll construct a partial ARN
67-
// that AWS Backup API can work with, or get it from the table description
68-
this.tableArn = builder.tableArn != null ? builder.tableArn : String.format("arn:aws:dynamodb:%s:*:table/%s", builder.getRegion(), builder.getResourceName());
63+
this.tableArn = builder.getResourceName();
6964
}
7065

7166
@Override
@@ -250,17 +245,6 @@ public Builder withBackupClient(software.amazon.awssdk.services.backup.BackupCli
250245
return this;
251246
}
252247

253-
/**
254-
* Sets the DynamoDB table ARN.
255-
*
256-
* @param tableArn the table ARN
257-
* @return this builder
258-
*/
259-
public Builder withTableArn(String tableArn) {
260-
this.tableArn = tableArn;
261-
return this;
262-
}
263-
264248
@Override
265249
protected Builder self() {
266250
return this;
@@ -272,7 +256,7 @@ public AwsDBBackupRestore build() {
272256
throw new IllegalArgumentException("Region is required");
273257
}
274258
if (StringUtils.isBlank(resourceName)) {
275-
throw new IllegalArgumentException("Collection name is required");
259+
throw new IllegalArgumentException("Table ARN is required");
276260
}
277261

278262
// Create backup client if not provided

dbbackuprestore/dbbackuprestore-aws/src/test/java/com/salesforce/multicloudj/dbbackuprestore/aws/AwsDBBackupRestoreIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public AbstractDBBackupRestore createDBBackupRestoreDriver() {
4646
return new AwsDBBackupRestore.Builder()
4747
.withBackupClient(backupClient)
4848
.withRegion("us-west-2")
49-
.withResourceName("docstore-test-1")
50-
.withTableArn("arn:aws:dynamodb:us-west-2:654654370895:table/docstore-test-1")
49+
.withResourceName("arn:aws:dynamodb:us-west-2:654654370895:table/docstore-test-1")
5150
.build();
5251
}
5352

dbbackuprestore/dbbackuprestore-aws/src/test/java/com/salesforce/multicloudj/dbbackuprestore/aws/AwsDBBackupRestoreTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ void setUp() {
5959
dbBackupRestore = new AwsDBBackupRestore.Builder()
6060
.withBackupClient(mockBackupClient)
6161
.withRegion("us-west-2")
62-
.withResourceName("test-table")
63-
.withTableArn(TABLE_ARN)
62+
.withResourceName(TABLE_ARN)
6463
.build();
6564
}
6665

dbbackuprestore/dbbackuprestore-client/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
</execution>
7676
</executions>
7777
</plugin>
78-
<!-- Disabled delombok by setting phase to 'none' to avoid duplicate class issues
7978
<plugin>
8079
<groupId>org.projectlombok</groupId>
8180
<artifactId>lombok-maven-plugin</artifactId>
@@ -94,7 +93,6 @@
9493
<addOutputDirectory>false</addOutputDirectory>
9594
</configuration>
9695
</plugin>
97-
-->
9896
</plugins>
9997
</build>
10098
</project>

examples/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
<groupId>com.salesforce.multicloudj</groupId>
3939
<artifactId>pubsub-client</artifactId>
4040
</dependency>
41+
<dependency>
42+
<groupId>com.salesforce.multicloudj</groupId>
43+
<artifactId>dbbackuprestore-client</artifactId>
44+
</dependency>
4145
<dependency>
4246
<groupId>com.salesforce.multicloudj</groupId>
4347
<artifactId>iam-client</artifactId>
@@ -77,6 +81,21 @@
7781
<artifactId>docstore-aws</artifactId>
7882
<version>${project.version}</version>
7983
</dependency>
84+
<dependency>
85+
<groupId>com.salesforce.multicloudj</groupId>
86+
<artifactId>dbbackuprestore-aws</artifactId>
87+
<version>${project.version}</version>
88+
</dependency>
89+
<dependency>
90+
<groupId>com.salesforce.multicloudj</groupId>
91+
<artifactId>dbbackuprestore-gcp-firestore</artifactId>
92+
<version>${project.version}</version>
93+
</dependency>
94+
<dependency>
95+
<groupId>com.salesforce.multicloudj</groupId>
96+
<artifactId>dbbackuprestore-ali</artifactId>
97+
<version>${project.version}</version>
98+
</dependency>
8099
<dependency>
81100
<groupId>com.salesforce.multicloudj</groupId>
82101
<artifactId>iam-aws</artifactId>

0 commit comments

Comments
 (0)