Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Mar 28, 2022
1 parent 6d92957 commit 044a3fd
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 36 deletions.
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-storage'
If you are using Gradle without BOM, add this to your dependencies

```Groovy
implementation 'com.google.cloud:google-cloud-storage:2.5.0'
implementation 'com.google.cloud:google-cloud-storage:2.5.1'
```

If you are using SBT, add this to your dependencies

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.5.0"
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.5.1"
```

## Authentication
Expand Down Expand Up @@ -240,9 +240,11 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-storage/tree/
| Change Default Storage Class | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/ChangeDefaultStorageClass.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/ChangeDefaultStorageClass.java) |
| Configure Bucket Cors | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/ConfigureBucketCors.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/ConfigureBucketCors.java) |
| Create Bucket | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucket.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/CreateBucket.java) |
| Create Bucket Pub Sub Notification | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketPubSubNotification.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketPubSubNotification.java) |
| Create Bucket With Storage Class And Location | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithStorageClassAndLocation.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithStorageClassAndLocation.java) |
| Create Bucket With Turbo Replication | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithTurboReplication.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithTurboReplication.java) |
| Delete Bucket | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/DeleteBucket.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/DeleteBucket.java) |
| Delete Bucket Pub Sub Notification | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/DeleteBucketPubSubNotification.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/DeleteBucketPubSubNotification.java) |
| Disable Bucket Versioning | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/DisableBucketVersioning.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/DisableBucketVersioning.java) |
| Disable Default Event Based Hold | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/DisableDefaultEventBasedHold.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/DisableDefaultEventBasedHold.java) |
| Disable Lifecycle Management | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/DisableLifecycleManagement.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/DisableLifecycleManagement.java) |
Expand All @@ -262,10 +264,12 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-storage/tree/
| Get Uniform Bucket Level Access | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/GetUniformBucketLevelAccess.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/GetUniformBucketLevelAccess.java) |
| List Bucket Iam Members | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/ListBucketIamMembers.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/ListBucketIamMembers.java) |
| List Buckets | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/ListBuckets.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/ListBuckets.java) |
| List Pub Sub Notifications | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/ListPubSubNotifications.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/ListPubSubNotifications.java) |
| Lock Retention Policy | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/LockRetentionPolicy.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/LockRetentionPolicy.java) |
| Make Bucket Public | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/MakeBucketPublic.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/MakeBucketPublic.java) |
| Print Bucket Acl | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/PrintBucketAcl.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/PrintBucketAcl.java) |
| Print Bucket Acl Filter By User | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/PrintBucketAclFilterByUser.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/PrintBucketAclFilterByUser.java) |
| Print Pub Sub Notification | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/PrintPubSubNotification.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/PrintPubSubNotification.java) |
| Remove Bucket Cors | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/RemoveBucketCors.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/RemoveBucketCors.java) |
| Remove Bucket Default Kms Key | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/RemoveBucketDefaultKmsKey.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/RemoveBucketDefaultKmsKey.java) |
| Remove Bucket Default Owner | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/RemoveBucketDefaultOwner.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/bucket/RemoveBucketDefaultOwner.java) |
Expand Down
Expand Up @@ -18,24 +18,23 @@

// [START storage_create_bucket_notifications]

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.NotificationInfo;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;


public class CreateBucketPubSubNotification {

public static void createBucketPubSubNotification(String bucketName,
NotificationInfo notificationInfo) {
public static void createBucketPubSubNotification(
String bucketName, NotificationInfo notificationInfo) {
// The ID to give your GCS bucket
// String bucketName = "your-unique-bucket-name";
// The NotificationInfo for the notification you would like to create
// See: https://cloud.google.com/java/docs/reference/google-cloud-notification/latest/com.google.cloud.notification.NotificationInfo
// See:
// https://cloud.google.com/java/docs/reference/google-cloud-notification/latest/com.google.cloud.notification.NotificationInfo
Storage storage = StorageOptions.newBuilder().build().getService();
Notification notification = storage.createNotification(bucketName, notificationInfo);
System.out.println("Successfully created notification for topic " + notification.getTopic());
}
}
// [END storage_create_bucket_notifications]
// [END storage_create_bucket_notifications]
Expand Up @@ -18,11 +18,9 @@

// [START storage_delete_bucket_notification]

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;


public class DeleteBucketPubSubNotification {

public static void deleteBucketPubSubNotification(String bucketName, String notificationId) {
Expand All @@ -39,4 +37,4 @@ public static void deleteBucketPubSubNotification(String bucketName, String noti
}
}
}
// [END storage_delete_bucket_notification]
// [END storage_delete_bucket_notification]
Expand Up @@ -18,13 +18,11 @@

// [START storage_list_bucket_notifications]

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import java.util.List;


public class ListPubSubNotifications {

public static void listPubSubNotifications(String bucketName) {
Expand All @@ -38,4 +36,4 @@ public static void listPubSubNotifications(String bucketName) {
}
}
}
// [END storage_list_bucket_notifications]
// [END storage_list_bucket_notifications]
Expand Up @@ -18,12 +18,9 @@

// [START storage_print_pubsub_bucket_notification]

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.Notification;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import java.util.List;


public class PrintPubSubNotification {

Expand All @@ -39,4 +36,4 @@ public static void printPubSubNotification(String bucketName, String notificatio
"Found notification " + notification.getTopic() + " for bucket " + bucketName);
}
}
// [END storage_print_pubsub_bucket_notification]
// [END storage_print_pubsub_bucket_notification]
Expand Up @@ -84,5 +84,4 @@ public void testCreateBucketPubSubNotification() {
CreateBucketPubSubNotification.createBucketPubSubNotification(bucketName, notificationInfo);
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(TOPIC);
}

}
}
Expand Up @@ -41,10 +41,11 @@ public class DeleteBucketPubSubNotificationTest extends TestBase {
private static final String PROJECT = System.getenv("GOOGLE_CLOUD_PROJECT");
private static final String TOPIC = String.format("projects/%s/topics/new-topic", PROJECT);
private static TopicAdminClient topicAdminClient;
private static final NotificationInfo notificationInfo = NotificationInfo.newBuilder(TOPIC)
.setCustomAttributes(CUSTOM_ATTRIBUTES)
.setPayloadFormat(PAYLOAD_FORMAT)
.build();
private static final NotificationInfo notificationInfo =
NotificationInfo.newBuilder(TOPIC)
.setCustomAttributes(CUSTOM_ATTRIBUTES)
.setPayloadFormat(PAYLOAD_FORMAT)
.build();

@BeforeClass
public static void configureTopicAdminClient() throws IOException {
Expand Down Expand Up @@ -81,10 +82,10 @@ public void testDeleteBucketPubSubNotification() {
assertNotNull("Topic Admin Client did not start up", topicAdminClient);

Notification notification = storage.createNotification(bucketName, notificationInfo);
DeleteBucketPubSubNotification.deleteBucketPubSubNotification(bucketName,
notification.getNotificationId());
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(
"Successfully deleted notification");
DeleteBucketPubSubNotification.deleteBucketPubSubNotification(
bucketName, notification.getNotificationId());
assertThat(stdOut.getCapturedOutputAsUtf8String())
.contains("Successfully deleted notification");
}

@Test
Expand All @@ -96,9 +97,8 @@ public void testNotificationNotFound() {
// Do a delete first.
storage.deleteNotification(bucketName, notification.getNotificationId());
// Now try to delete again.
DeleteBucketPubSubNotification.deleteBucketPubSubNotification(bucketName,
notification.getNotificationId());
DeleteBucketPubSubNotification.deleteBucketPubSubNotification(
bucketName, notification.getNotificationId());
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains("Failed to find notification");
}

}
}
Expand Up @@ -85,5 +85,4 @@ public void testListBucketPubSubNotification() {
ListPubSubNotifications.listPubSubNotifications(bucketName);
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(TOPIC);
}

}
}
Expand Up @@ -85,5 +85,4 @@ public void testPrintBucketPubSubNotification() {
PrintPubSubNotification.printPubSubNotification(bucketName, notification.getNotificationId());
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(TOPIC);
}

}
}

0 comments on commit 044a3fd

Please sign in to comment.