diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index 9351fdfb9a..3473042c08 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -13,4 +13,4 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
- digest: sha256:387835a1375a0049ec44e02542c844302854c732d8291bdf8e472c0ff70a8f67
+ digest: sha256:df8d7b2cc0dbc65871e7edd86601901a0612b272fa3f7f0eb590c5c53aa5f92e
diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml
index 1bb1823276..f5fc7d5169 100644
--- a/.github/workflows/approve-readme.yaml
+++ b/.github/workflows/approve-readme.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme'
steps:
- - uses: actions/github-script@v5
+ - uses: actions/github-script@v6
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: |
diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml
index 18e23230d9..7a106d007e 100644
--- a/.github/workflows/auto-release.yaml
+++ b/.github/workflows/auto-release.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
if: contains(github.head_ref, 'release-please')
steps:
- - uses: actions/github-script@v5
+ - uses: actions/github-script@v6
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
debug: true
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 6b5e56aaac..83ef7f9c2c 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -27,8 +27,8 @@ jobs:
matrix:
java: [8, 11, 17]
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{matrix.java}}
@@ -39,8 +39,8 @@ jobs:
windows:
runs-on: windows-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 8
@@ -54,8 +54,8 @@ jobs:
matrix:
java: [8, 11, 17]
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{matrix.java}}
@@ -64,8 +64,8 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
@@ -76,8 +76,8 @@ jobs:
clirr:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 8
diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml
index d5d964df15..912ed8b2b0 100644
--- a/.github/workflows/samples.yaml
+++ b/.github/workflows/samples.yaml
@@ -20,9 +20,10 @@ jobs:
checkstyle:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v1
+ - uses: actions/checkout@v3
+ - uses: actions/setup-java@v3
with:
+ distribution: zulu
java-version: 8
- name: Run checkstyle
run: mvn -P lint --quiet --batch-mode checkstyle:check
diff --git a/.kokoro/build.bat b/.kokoro/build.bat
index cc602c9eba..067cf4a4c4 100644
--- a/.kokoro/build.bat
+++ b/.kokoro/build.bat
@@ -1,18 +1,18 @@
+:: Copyright 2022 Google LLC
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+:: Github action job to test core java library features on
+:: downstream client libraries before they are released.
:: See documentation in type-shell-output.bat
-# Copyright 2022 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# Github action job to test core java library features on
-# downstream client libraries before they are released.
"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh
diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg
index f68661e897..b5afa5400f 100644
--- a/.kokoro/nightly/samples.cfg
+++ b/.kokoro/nightly/samples.cfg
@@ -37,7 +37,9 @@ env_vars: {
value: "true"
}
+# This service account we want to be any valid account not used for
+# GOOGLE_APPLICATION_CREDENTIALS in the tests
env_vars: {
key: "IT_SERVICE_ACCOUNT_EMAIL"
- value: "java-docs-samples-testing@java-docs-samples-testing.iam.gserviceaccount.com"
+ value: "samples@java-docs-samples-testing.iam.gserviceaccount.com"
}
diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg
index 74bcff8aea..f89752c6c0 100644
--- a/.kokoro/presubmit/samples.cfg
+++ b/.kokoro/presubmit/samples.cfg
@@ -32,7 +32,9 @@ env_vars: {
value: "java-docs-samples-service-account"
}
+# This service account we want to be any valid account not used for
+# GOOGLE_APPLICATION_CREDENTIALS in the tests
env_vars: {
key: "IT_SERVICE_ACCOUNT_EMAIL"
- value: "java-docs-samples-testing@java-docs-samples-testing.iam.gserviceaccount.com"
+ value: "samples@java-docs-samples-testing.iam.gserviceaccount.com"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cf2142ad2..25079b251a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+### [2.4.5](https://github.com/googleapis/java-storage/compare/v2.4.4...v2.4.5) (2022-03-04)
+
+
+### Documentation
+
+* Adding Samples for Adding/Removing File Owners ([#1273](https://github.com/googleapis/java-storage/issues/1273)) ([6fad19c](https://github.com/googleapis/java-storage/commit/6fad19c184d108f30c85f62426d254a9f0ff715d))
+
+
+### Dependencies
+
+* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.8.0 ([#1284](https://github.com/googleapis/java-storage/issues/1284)) ([0f71ae4](https://github.com/googleapis/java-storage/commit/0f71ae41fbabf6a3f38674a2f68fb55bd9809595))
+* update kms.version to v0.95.1 ([#1287](https://github.com/googleapis/java-storage/issues/1287)) ([8334d3c](https://github.com/googleapis/java-storage/commit/8334d3cb1f527b00ee8f19583dcf112f4f1b08ac))
+
### [2.4.4](https://github.com/googleapis/java-storage/compare/v2.4.3...v2.4.4) (2022-02-28)
diff --git a/README.md b/README.md
index 8d6a4f59eb..8e2c18d695 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
com.google.cloud
libraries-bom
- 24.3.0
+ 24.4.0
pom
import
@@ -41,7 +41,7 @@ If you are using Maven without BOM, add this to your dependencies:
com.google.cloud
google-cloud-storage
- 2.4.2
+ 2.4.4
```
@@ -49,20 +49,20 @@ If you are using Maven without BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies
```Groovy
-implementation platform('com.google.cloud:libraries-bom:24.3.0')
+implementation platform('com.google.cloud:libraries-bom:24.4.0')
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.4.3'
+implementation 'com.google.cloud:google-cloud-storage:2.4.4'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.4.3"
+libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.4.4"
```
## Authentication
@@ -235,6 +235,8 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-storage/tree/
| 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) |
| 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) |
| Remove Bucket Owner | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/bucket/RemoveBucketOwner.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/RemoveBucketOwner.java) |
+| Add File Owner | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/AddFileOwner.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/object/AddFileOwner.java) |
+| Remove File Owner | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/RemoveFileOwner.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/object/RemoveFileOwner.java) |
diff --git a/gapic-google-cloud-storage-v2/pom.xml b/gapic-google-cloud-storage-v2/pom.xml
index 9d6987dc19..dbfe2151c4 100644
--- a/gapic-google-cloud-storage-v2/pom.xml
+++ b/gapic-google-cloud-storage-v2/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
gapic-google-cloud-storage-v2
- 2.4.4-alpha
+ 2.4.5-alpha
gapic-google-cloud-storage-v2
GRPC library for gapic-google-cloud-storage-v2
com.google.cloud
google-cloud-storage-parent
- 2.4.4
+ 2.4.5
diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
index 8c7a3116a2..35383c9741 100644
--- a/google-cloud-storage/pom.xml
+++ b/google-cloud-storage/pom.xml
@@ -2,7 +2,7 @@
4.0.0
google-cloud-storage
- 2.4.4
+ 2.4.5
jar
Google Cloud Storage
https://github.com/googleapis/java-storage
@@ -12,11 +12,11 @@
com.google.cloud
google-cloud-storage-parent
- 2.4.4
+ 2.4.5
google-cloud-storage
- 0.95.0
+ 0.95.1
diff --git a/grpc-google-cloud-storage-v2/pom.xml b/grpc-google-cloud-storage-v2/pom.xml
index 69fcc834a7..d657335b5d 100644
--- a/grpc-google-cloud-storage-v2/pom.xml
+++ b/grpc-google-cloud-storage-v2/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
grpc-google-cloud-storage-v2
- 2.4.4-alpha
+ 2.4.5-alpha
grpc-google-cloud-storage-v2
GRPC library for grpc-google-cloud-storage-v2
com.google.cloud
google-cloud-storage-parent
- 2.4.4
+ 2.4.5
diff --git a/pom.xml b/pom.xml
index 3424a272be..8ec0f816b3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.google.cloud
google-cloud-storage-parent
pom
- 2.4.4
+ 2.4.5
Storage Parent
https://github.com/googleapis/java-storage
@@ -54,7 +54,7 @@
UTF-8
github
google-cloud-storage-parent
- 2.7.0
+ 2.8.0
@@ -70,7 +70,7 @@
com.google.cloud
google-cloud-storage
- 2.4.4
+ 2.4.5
com.google.apis
@@ -105,17 +105,17 @@
com.google.api.grpc
proto-google-cloud-storage-v2
- 2.4.4-alpha
+ 2.4.5-alpha
com.google.api.grpc
grpc-google-cloud-storage-v2
- 2.4.4-alpha
+ 2.4.5-alpha
com.google.api.grpc
gapic-google-cloud-storage-v2
- 2.4.4-alpha
+ 2.4.5-alpha
com.google.cloud
diff --git a/proto-google-cloud-storage-v2/pom.xml b/proto-google-cloud-storage-v2/pom.xml
index a34c0ec1ff..dc02f02f99 100644
--- a/proto-google-cloud-storage-v2/pom.xml
+++ b/proto-google-cloud-storage-v2/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
proto-google-cloud-storage-v2
- 2.4.4-alpha
+ 2.4.5-alpha
proto-google-cloud-storage-v2
PROTO library for proto-google-cloud-storage-v2
com.google.cloud
google-cloud-storage-parent
- 2.4.4
+ 2.4.5
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index e2310773c1..2d36756f59 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -29,7 +29,7 @@
com.google.cloud
google-cloud-storage
- 2.4.2
+ 2.4.4
diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml
index f6e2666175..dfc49ae240 100644
--- a/samples/snapshot/pom.xml
+++ b/samples/snapshot/pom.xml
@@ -28,7 +28,7 @@
com.google.cloud
google-cloud-storage
- 2.4.2
+ 2.4.4
diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml
index 48d260d9b0..6e973edde8 100644
--- a/samples/snippets/pom.xml
+++ b/samples/snippets/pom.xml
@@ -30,7 +30,7 @@
com.google.cloud
libraries-bom
- 24.3.0
+ 24.4.0
pom
import
diff --git a/samples/snippets/src/main/java/com/example/storage/object/AddFileOwner.java b/samples/snippets/src/main/java/com/example/storage/object/AddFileOwner.java
new file mode 100644
index 0000000000..cf870eb0d3
--- /dev/null
+++ b/samples/snippets/src/main/java/com/example/storage/object/AddFileOwner.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.storage.object;
+
+// [START storage_add_file_owner]
+
+import com.google.cloud.storage.Acl;
+import com.google.cloud.storage.Acl.Role;
+import com.google.cloud.storage.Acl.User;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.StorageOptions;
+
+public class AddFileOwner {
+
+ public static void addFileOwner(String bucketName, String userEmail, String blobName) {
+
+ // The ID to give your GCS bucket
+ // String bucketName = "your-unique-bucket-name";
+
+ // Email of the user you wish to add as a file owner
+ // String userEmail = "someuser@domain.com"
+
+ // The name of the blob/file that you wish to modify permissions on
+ // String blobName = "your-blob-name";
+
+ Storage storage = StorageOptions.newBuilder().build().getService();
+ Blob blob = storage.get(BlobId.of(bucketName, blobName));
+ Acl newOwner = Acl.of(new User(userEmail), Role.OWNER);
+
+ blob.createAcl(newOwner);
+ System.out.println(
+ "Added user "
+ + userEmail
+ + " as an owner on file "
+ + blobName
+ + " in bucket "
+ + bucketName);
+ }
+}
+// [END storage_add_file_owner]
diff --git a/samples/snippets/src/main/java/com/example/storage/object/RemoveFileOwner.java b/samples/snippets/src/main/java/com/example/storage/object/RemoveFileOwner.java
new file mode 100644
index 0000000000..54a8d89c69
--- /dev/null
+++ b/samples/snippets/src/main/java/com/example/storage/object/RemoveFileOwner.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.storage.object;
+
+// [START storage_remove_file_owner]
+
+import com.google.cloud.storage.Acl.User;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.StorageOptions;
+
+public class RemoveFileOwner {
+
+ public static void removeFileOwner(String bucketName, String userEmail, String blobName) {
+
+ // The ID to give your GCS bucket
+ // String bucketName = "your-unique-bucket-name";
+
+ // Email of the user you wish to remove as a file owner
+ // String userEmail = "someuser@domain.com"
+
+ // The name of the blob/file that you wish to modify permissions on
+ // String blobName = "your-blob-name";
+
+ Storage storage = StorageOptions.newBuilder().build().getService();
+ Blob blob = storage.get(BlobId.of(bucketName, blobName));
+ User ownerToRemove = new User(userEmail);
+
+ boolean success = blob.deleteAcl(ownerToRemove);
+ if (success) {
+ System.out.println(
+ "Removed user "
+ + userEmail
+ + " as an owner on file "
+ + blobName
+ + " in bucket "
+ + bucketName);
+ } else {
+ System.out.println("User " + userEmail + " was not found");
+ }
+ }
+}
+// [END storage_remove_file_owner]
diff --git a/samples/snippets/src/test/java/com/example/storage/object/AddFileOwnerTest.java b/samples/snippets/src/test/java/com/example/storage/object/AddFileOwnerTest.java
new file mode 100644
index 0000000000..2ce6f7800e
--- /dev/null
+++ b/samples/snippets/src/test/java/com/example/storage/object/AddFileOwnerTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.storage.object;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertNotNull;
+
+import com.example.storage.TestBase;
+import com.google.cloud.storage.Acl.User;
+import org.junit.Test;
+
+public class AddFileOwnerTest extends TestBase {
+
+ public static final String IT_SERVICE_ACCOUNT_EMAIL = System.getenv("IT_SERVICE_ACCOUNT_EMAIL");
+
+ @Test
+ public void testAddFileOwner() {
+ // Check for user email before the actual test.
+ assertNotNull("Unable to determine user email", IT_SERVICE_ACCOUNT_EMAIL);
+
+ // Add Ownership to the file.
+ AddFileOwner.addFileOwner(bucketName, IT_SERVICE_ACCOUNT_EMAIL, blobName);
+ assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(IT_SERVICE_ACCOUNT_EMAIL);
+ assertThat(blob.getAcl(new User(IT_SERVICE_ACCOUNT_EMAIL))).isNotNull();
+ }
+}
diff --git a/samples/snippets/src/test/java/com/example/storage/object/RemoveFileOwnerTest.java b/samples/snippets/src/test/java/com/example/storage/object/RemoveFileOwnerTest.java
new file mode 100644
index 0000000000..4d49ed4a01
--- /dev/null
+++ b/samples/snippets/src/test/java/com/example/storage/object/RemoveFileOwnerTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.storage.object;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertNotNull;
+
+import com.example.storage.TestBase;
+import com.google.cloud.storage.Acl;
+import com.google.cloud.storage.Acl.Role;
+import com.google.cloud.storage.Acl.User;
+import org.junit.Test;
+
+public class RemoveFileOwnerTest extends TestBase {
+
+ public static final String IT_SERVICE_ACCOUNT_EMAIL = System.getenv("IT_SERVICE_ACCOUNT_EMAIL");
+
+ @Test
+ public void testRemoveFileOwner() {
+ // Check for user email before the actual test.
+ assertNotNull("Unable to determine user email", IT_SERVICE_ACCOUNT_EMAIL);
+
+ // Add User as Owner
+ Acl newFileOwner = Acl.of(new User(IT_SERVICE_ACCOUNT_EMAIL), Role.OWNER);
+ blob.createAcl(newFileOwner);
+
+ // Remove User as owner
+ RemoveFileOwner.removeFileOwner(bucketName, IT_SERVICE_ACCOUNT_EMAIL, blobName);
+ assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(IT_SERVICE_ACCOUNT_EMAIL);
+ assertThat(stdOut.getCapturedOutputAsUtf8String()).contains("Removed user");
+ assertThat(blob.getAcl(new User(IT_SERVICE_ACCOUNT_EMAIL))).isNull();
+ }
+
+ @Test
+ public void testUserNotFound() {
+ // Check for user email before the actual test.
+ assertNotNull("Unable to determine user email", IT_SERVICE_ACCOUNT_EMAIL);
+
+ // Remove User without Owner Permissions
+ RemoveFileOwner.removeFileOwner(bucketName, IT_SERVICE_ACCOUNT_EMAIL, blobName);
+ assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(IT_SERVICE_ACCOUNT_EMAIL);
+ assertThat(stdOut.getCapturedOutputAsUtf8String()).contains("was not found");
+ }
+}
diff --git a/versions.txt b/versions.txt
index bcd5d18acc..c6385dfddb 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,7 +1,7 @@
# Format:
# module:released-version:current-version
-google-cloud-storage:2.4.4:2.4.4
-gapic-google-cloud-storage-v2:2.4.4-alpha:2.4.4-alpha
-grpc-google-cloud-storage-v2:2.4.4-alpha:2.4.4-alpha
-proto-google-cloud-storage-v2:2.4.4-alpha:2.4.4-alpha
+google-cloud-storage:2.4.5:2.4.5
+gapic-google-cloud-storage-v2:2.4.5-alpha:2.4.5-alpha
+grpc-google-cloud-storage-v2:2.4.5-alpha:2.4.5-alpha
+proto-google-cloud-storage-v2:2.4.5-alpha:2.4.5-alpha