diff --git a/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcDpSample.java b/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcDpSample.java index 649b873142..2c49be36b2 100644 --- a/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcDpSample.java +++ b/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcDpSample.java @@ -26,6 +26,8 @@ public class QuickstartGrpcDpSample { public static void main(String... args) throws Exception { + // Create an instance of options which will use the Google Cloud Storage gRPC API for all + // operations StorageOptions options = StorageOptions.grpc().setAttemptDirectPath(true).build(); // Instantiates a client in a try-with-resource to automatically cleanup underlying resources @@ -33,7 +35,7 @@ public static void main(String... args) throws Exception { // The name for the new bucket String bucketName = args[0]; // "my-new-bucket"; - // Creates the new bucket + // Creates the new bucket using a request to the gRPC API Bucket bucket = storage.create(BucketInfo.of(bucketName)); System.out.printf("Bucket %s created.%n", bucket.getName()); diff --git a/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcSample.java b/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcSample.java index c53b7fa4f9..84c737ba97 100644 --- a/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcSample.java +++ b/samples/snippets/src/main/java/com/example/storage/QuickstartGrpcSample.java @@ -26,6 +26,8 @@ public class QuickstartGrpcSample { public static void main(String... args) throws Exception { + // Create an instance of options which will use the Google Cloud Storage gRPC API for all + // operations StorageOptions options = StorageOptions.grpc().build(); // Instantiates a client in a try-with-resource to automatically cleanup underlying resources @@ -33,7 +35,7 @@ public static void main(String... args) throws Exception { // The name for the new bucket String bucketName = args[0]; // "my-new-bucket"; - // Creates the new bucket + // Creates the new bucket using a request to the gRPC API Bucket bucket = storage.create(BucketInfo.of(bucketName)); System.out.printf("Bucket %s created.%n", bucket.getName()); diff --git a/samples/snippets/src/test/java/com/example/storage/QuickstartSampleIT.java b/samples/snippets/src/test/java/com/example/storage/QuickstartSampleIT.java index c4a50ef72a..0fb5c0581c 100644 --- a/samples/snippets/src/test/java/com/example/storage/QuickstartSampleIT.java +++ b/samples/snippets/src/test/java/com/example/storage/QuickstartSampleIT.java @@ -38,14 +38,14 @@ public class QuickstartSampleIT { private String bucketName; - private static final void deleteBucket(String bucketName) { + private static void deleteBucket(String bucketName) { Storage storage = StorageOptions.getDefaultInstance().getService(); storage.delete(bucketName); } @Before public void setUp() { - bucketName = "my-new-bucket-" + UUID.randomUUID().toString(); + bucketName = "my-new-bucket-" + UUID.randomUUID(); } @After