Skip to content

Commit

Permalink
Run formatter on checkstyle failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-munro committed Jul 19, 2022
1 parent 9ca8c2c commit 32c68ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
Expand Up @@ -28,7 +28,11 @@
public class CreateBucketDualRegion {

public static void createBucketDualRegion(
String projectId, String bucketName, String location, String firstRegion, String secondRegion) {
String projectId,
String bucketName,
String location,
String firstRegion,
String secondRegion) {
// The ID of your GCP project.
// String projectId = "your-project-id";

Expand All @@ -47,24 +51,28 @@ public static void createBucketDualRegion(
// See this documentation for other valid locations and regions:
// https://cloud.google.com/storage/docs/locations


Storage storage = StorageOptions.newBuilder().setProjectId(projectId).build().getService();

CustomPlacementConfig config = CustomPlacementConfig.newBuilder()
.setDataLocations(Arrays.asList(firstRegion, secondRegion))
.build();
CustomPlacementConfig config =
CustomPlacementConfig.newBuilder()
.setDataLocations(Arrays.asList(firstRegion, secondRegion))
.build();

BucketInfo bucketInfo = BucketInfo.newBuilder(bucketName)
.setLocation(location)
.setCustomPlacementConfig(config)
.build();
BucketInfo bucketInfo =
BucketInfo.newBuilder(bucketName)
.setLocation(location)
.setCustomPlacementConfig(config)
.build();

Bucket bucket =
storage.create(bucketInfo);
Bucket bucket = storage.create(bucketInfo);

System.out.println(
"Created bucket " + bucket.getName() + " in location " + bucket.getLocation()
+ " with regions " + bucket.getCustomPlacementConfig().getDataLocations().toString());
"Created bucket "
+ bucket.getName()
+ " in location "
+ bucket.getLocation()
+ " with regions "
+ bucket.getCustomPlacementConfig().getDataLocations().toString());
}
}
// [END storage_create_bucket_dual_region]
Expand Up @@ -31,7 +31,8 @@ public class CreateBucketDualRegionTest extends TestBase {
public void testCreateBucketDualRegion() {
assertNotNull("Unable to determine Project ID", PROJECT_ID);
String newBucket = RemoteStorageHelper.generateBucketName();
CreateBucketDualRegion.createBucketDualRegion(PROJECT_ID, newBucket, "US", "US-EAST1", "US-WEST1");
CreateBucketDualRegion.createBucketDualRegion(
PROJECT_ID, newBucket, "US", "US-EAST1", "US-WEST1");
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains("US-WEST1");
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains("US-EAST1");
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains("Created bucket");
Expand Down

0 comments on commit 32c68ed

Please sign in to comment.