From ba76e7a425ba011526d9e85e70bf97c7376a887a Mon Sep 17 00:00:00 2001
From: "release-please[bot]"
<55107282+release-please[bot]@users.noreply.github.com>
Date: Fri, 9 Jun 2023 10:47:44 -0400
Subject: [PATCH 01/15] chore(main): release 2.22.5-SNAPSHOT (#2056)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
---
gapic-google-cloud-storage-v2/pom.xml | 4 ++--
google-cloud-storage-bom/pom.xml | 10 +++++-----
google-cloud-storage/pom.xml | 4 ++--
grpc-google-cloud-storage-v2/pom.xml | 4 ++--
pom.xml | 10 +++++-----
proto-google-cloud-storage-v2/pom.xml | 4 ++--
samples/snapshot/pom.xml | 2 +-
versions.txt | 8 ++++----
8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/gapic-google-cloud-storage-v2/pom.xml b/gapic-google-cloud-storage-v2/pom.xml
index 481ed13b27..e8aa83e0f1 100644
--- a/gapic-google-cloud-storage-v2/pom.xml
+++ b/gapic-google-cloud-storage-v2/pom.xml
@@ -4,13 +4,13 @@
4.0.0com.google.api.grpcgapic-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTgapic-google-cloud-storage-v2GRPC library for gapic-google-cloud-storage-v2com.google.cloudgoogle-cloud-storage-parent
- 2.22.4
+ 2.22.5-SNAPSHOT
diff --git a/google-cloud-storage-bom/pom.xml b/google-cloud-storage-bom/pom.xml
index 7c8cfa7a51..356eca8e26 100644
--- a/google-cloud-storage-bom/pom.xml
+++ b/google-cloud-storage-bom/pom.xml
@@ -19,7 +19,7 @@
4.0.0com.google.cloudgoogle-cloud-storage-bom
- 2.22.4
+ 2.22.5-SNAPSHOTpomcom.google.cloud
@@ -69,22 +69,22 @@
com.google.cloudgoogle-cloud-storage
- 2.22.4
+ 2.22.5-SNAPSHOTcom.google.api.grpcgapic-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTcom.google.api.grpcgrpc-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTcom.google.api.grpcproto-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOT
diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
index f33742167c..825810ef27 100644
--- a/google-cloud-storage/pom.xml
+++ b/google-cloud-storage/pom.xml
@@ -2,7 +2,7 @@
4.0.0google-cloud-storage
- 2.22.4
+ 2.22.5-SNAPSHOTjarGoogle Cloud Storagehttps://github.com/googleapis/java-storage
@@ -12,7 +12,7 @@
com.google.cloudgoogle-cloud-storage-parent
- 2.22.4
+ 2.22.5-SNAPSHOTgoogle-cloud-storage
diff --git a/grpc-google-cloud-storage-v2/pom.xml b/grpc-google-cloud-storage-v2/pom.xml
index 6f7566757e..1a6e14178f 100644
--- a/grpc-google-cloud-storage-v2/pom.xml
+++ b/grpc-google-cloud-storage-v2/pom.xml
@@ -4,13 +4,13 @@
4.0.0com.google.api.grpcgrpc-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTgrpc-google-cloud-storage-v2GRPC library for grpc-google-cloud-storage-v2com.google.cloudgoogle-cloud-storage-parent
- 2.22.4
+ 2.22.5-SNAPSHOT
diff --git a/pom.xml b/pom.xml
index f219d8441a..c5c6b54852 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.google.cloudgoogle-cloud-storage-parentpom
- 2.22.4
+ 2.22.5-SNAPSHOTStorage Parenthttps://github.com/googleapis/java-storage
@@ -70,7 +70,7 @@
com.google.cloudgoogle-cloud-storage
- 2.22.4
+ 2.22.5-SNAPSHOTcom.google.apis
@@ -111,17 +111,17 @@
com.google.api.grpcproto-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTcom.google.api.grpcgrpc-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTcom.google.api.grpcgapic-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTcom.google.cloud
diff --git a/proto-google-cloud-storage-v2/pom.xml b/proto-google-cloud-storage-v2/pom.xml
index 5ea0d78d04..dc5d1647b8 100644
--- a/proto-google-cloud-storage-v2/pom.xml
+++ b/proto-google-cloud-storage-v2/pom.xml
@@ -4,13 +4,13 @@
4.0.0com.google.api.grpcproto-google-cloud-storage-v2
- 2.22.4-alpha
+ 2.22.5-alpha-SNAPSHOTproto-google-cloud-storage-v2PROTO library for proto-google-cloud-storage-v2com.google.cloudgoogle-cloud-storage-parent
- 2.22.4
+ 2.22.5-SNAPSHOT
diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml
index 4972a97043..84146d2a0e 100644
--- a/samples/snapshot/pom.xml
+++ b/samples/snapshot/pom.xml
@@ -28,7 +28,7 @@
com.google.cloudgoogle-cloud-storage
- 2.22.4
+ 2.22.5-SNAPSHOT
diff --git a/versions.txt b/versions.txt
index 1328807ea6..84a23716b7 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,7 +1,7 @@
# Format:
# module:released-version:current-version
-google-cloud-storage:2.22.4:2.22.4
-gapic-google-cloud-storage-v2:2.22.4-alpha:2.22.4-alpha
-grpc-google-cloud-storage-v2:2.22.4-alpha:2.22.4-alpha
-proto-google-cloud-storage-v2:2.22.4-alpha:2.22.4-alpha
+google-cloud-storage:2.22.4:2.22.5-SNAPSHOT
+gapic-google-cloud-storage-v2:2.22.4-alpha:2.22.5-alpha-SNAPSHOT
+grpc-google-cloud-storage-v2:2.22.4-alpha:2.22.5-alpha-SNAPSHOT
+proto-google-cloud-storage-v2:2.22.4-alpha:2.22.5-alpha-SNAPSHOT
From 29bf80da94258d43d15e449f4d736b510d8c899c Mon Sep 17 00:00:00 2001
From: Mend Renovate
Date: Mon, 12 Jun 2023 17:33:07 +0200
Subject: [PATCH 02/15] chore(deps): update dependency
com.google.cloud:google-cloud-storage to v2.22.4 (#2057)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* chore(deps): update dependency com.google.cloud:google-cloud-storage to v2.22.4
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
---------
Co-authored-by: Owl Bot
---
README.md | 8 ++++----
samples/install-without-bom/pom.xml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index af4fd1c4de..699cb55fbd 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ If you are using Maven without the BOM, add this to your dependencies:
com.google.cloudgoogle-cloud-storage
- 2.22.3
+ 2.22.4
```
@@ -57,13 +57,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.22.3'
+implementation 'com.google.cloud:google-cloud-storage:2.22.4'
```
If you are using SBT, add this to your dependencies:
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.22.3"
+libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.22.4"
```
@@ -426,7 +426,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-storage/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-storage.svg
-[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.22.3
+[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.22.4
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index cc9e1e719a..0e4b6ed0ff 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -30,7 +30,7 @@
com.google.cloudgoogle-cloud-storage
- 2.22.3
+ 2.22.4
From 01cc33ad5ddc3baf4fc03cb1f409b8df5c2a5a22 Mon Sep 17 00:00:00 2001
From: Mend Renovate
Date: Mon, 12 Jun 2023 18:04:28 +0200
Subject: [PATCH 03/15] test(deps): update cross product test dependencies
(#2058)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* test(deps): update cross product test dependencies
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
---------
Co-authored-by: Owl Bot
---
google-cloud-storage/pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
index 825810ef27..0054cd41a2 100644
--- a/google-cloud-storage/pom.xml
+++ b/google-cloud-storage/pom.xml
@@ -173,13 +173,13 @@
com.google.api.grpcproto-google-cloud-kms-v1
- 0.112.0
+ 0.113.0testcom.google.cloudgoogle-cloud-kms
- 2.21.0
+ 2.22.0test
From ebe389c65150cab8d5e468dd6bbe4055df623b70 Mon Sep 17 00:00:00 2001
From: Mend Renovate
Date: Tue, 13 Jun 2023 17:08:13 +0200
Subject: [PATCH 04/15] test(deps): update cross product test dependencies
(#2061)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[](https://renovatebot.com)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-pubsub](https://togithub.com/googleapis/java-pubsub) | `1.123.13` -> `1.123.14` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) |
| [com.google.api.grpc:proto-google-cloud-pubsub-v1](https://togithub.com/googleapis/java-pubsub/proto-google-cloud-pubsub-v1) ([source](https://togithub.com/googleapis/java-pubsub)) | `1.105.13` -> `1.105.14` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) |
---
### Release Notes
googleapis/java-pubsub
### [`v1.123.14`](https://togithub.com/googleapis/java-pubsub/blob/HEAD/CHANGELOG.md#112314-httpsgithubcomgoogleapisjava-pubsubcomparev112313v112314-2023-06-12)
[Compare Source](https://togithub.com/googleapis/java-pubsub/compare/v1.123.13...v1.123.14)
##### Dependencies
- Update dependency com.google.cloud:google-cloud-core to v2.19.0 ([#1604](https://togithub.com/googleapis/java-pubsub/issues/1604)) ([7ac609e](https://togithub.com/googleapis/java-pubsub/commit/7ac609e44c20db73460fe39919439c3a2b597454))
- Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.11.0 ([#1605](https://togithub.com/googleapis/java-pubsub/issues/1605)) ([077ac04](https://togithub.com/googleapis/java-pubsub/commit/077ac04214be23f6693734c157925a5607ada869))
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
â™» **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired.
---
- [ ] If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-storage).
---
google-cloud-storage/pom.xml | 2 +-
pom.xml | 2 +-
samples/install-without-bom/pom.xml | 2 +-
samples/native-image-sample/pom.xml | 2 +-
samples/snapshot/pom.xml | 2 +-
samples/snippets/pom.xml | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
index 0054cd41a2..aa16af16d1 100644
--- a/google-cloud-storage/pom.xml
+++ b/google-cloud-storage/pom.xml
@@ -16,7 +16,7 @@
google-cloud-storage
- 1.105.13
+ 1.105.145.9.3
diff --git a/pom.xml b/pom.xml
index c5c6b54852..b744479106 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,7 +80,7 @@
com.google.cloudgoogle-cloud-pubsub
- 1.123.13
+ 1.123.14test
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index 0e4b6ed0ff..6ad8b2bbb0 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -61,7 +61,7 @@
com.google.cloudgoogle-cloud-pubsub
- 1.123.13
+ 1.123.14test
diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml
index 30a696b6d7..db4429ec91 100644
--- a/samples/native-image-sample/pom.xml
+++ b/samples/native-image-sample/pom.xml
@@ -61,7 +61,7 @@
com.google.cloudgoogle-cloud-pubsub
- 1.123.13
+ 1.123.14test
diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml
index 84146d2a0e..df4f78504c 100644
--- a/samples/snapshot/pom.xml
+++ b/samples/snapshot/pom.xml
@@ -52,7 +52,7 @@
com.google.cloudgoogle-cloud-pubsub
- 1.123.13
+ 1.123.14test
diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml
index 6f9ab79386..57af5c9f26 100644
--- a/samples/snippets/pom.xml
+++ b/samples/snippets/pom.xml
@@ -72,7 +72,7 @@
com.google.cloudgoogle-cloud-pubsub
- 1.123.13
+ 1.123.14test
From c57464c6ce11b7d9283c2c9938c6149d0afdce99 Mon Sep 17 00:00:00 2001
From: Mend Renovate
Date: Wed, 14 Jun 2023 21:36:43 +0200
Subject: [PATCH 05/15] chore(deps): update dependency
com.google.cloud:libraries-bom to v26.17.0 (#2065)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* chore(deps): update dependency com.google.cloud:libraries-bom to v26.17.0
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
---------
Co-authored-by: Owl Bot
---
README.md | 4 ++--
samples/native-image-sample/pom.xml | 2 +-
samples/snippets/pom.xml | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 699cb55fbd..1b1d586b02 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.cloudlibraries-bom
- 26.16.0
+ 26.17.0pomimport
@@ -50,7 +50,7 @@ If you are using Maven without the 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:26.16.0')
+implementation platform('com.google.cloud:libraries-bom:26.17.0')
implementation 'com.google.cloud:google-cloud-storage'
```
diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml
index db4429ec91..af1943d5c9 100644
--- a/samples/native-image-sample/pom.xml
+++ b/samples/native-image-sample/pom.xml
@@ -29,7 +29,7 @@
com.google.cloudlibraries-bom
- 26.16.0
+ 26.17.0pomimport
diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml
index 57af5c9f26..95f581a758 100644
--- a/samples/snippets/pom.xml
+++ b/samples/snippets/pom.xml
@@ -31,7 +31,7 @@
com.google.cloudlibraries-bom
- 26.16.0
+ 26.17.0pomimport
From e48862ab5d9a044d9b5d4c9e8465ff7d6d35efe4 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 16 Jun 2023 11:07:56 -0400
Subject: [PATCH 06/15] chore: Update `dependabot.yml` template (#1813) (#2073)
* chore: Update `dependabot.yml` template not to touch pip dependencies
Source-Link: https://github.com/googleapis/synthtool/commit/f961eb0fe51109238128055897ccba1b70dbd804
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:af2eda87a54601ae7b7b2be5055c17b43ac98a7805b586772db314de8a7d4a1d
Co-authored-by: Owl Bot
---
.github/.OwlBot.lock.yaml | 3 ++-
.github/dependabot.yml | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index aadf54f643..73568a1e99 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -13,4 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
- digest: sha256:ad9cabee4c022f1aab04a71332369e0c23841062124818a4490f73337f790337
+ digest: sha256:af2eda87a54601ae7b7b2be5055c17b43ac98a7805b586772db314de8a7d4a1d
+# created: 2023-06-16T02:10:09.149325782Z
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index c8f413b0da..fde1ced49f 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -5,10 +5,13 @@ updates:
schedule:
interval: "daily"
# Disable version updates for Maven dependencies
- open-pull-requests-limit: 0
+ # we use renovate-bot as well as shared-dependencies BOM to update maven dependencies.
+ ignore: "*"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
# Disable version updates for pip dependencies
- open-pull-requests-limit: 0
\ No newline at end of file
+ # If a security vulnerability comes in, we will be notified about
+ # it via template in the synthtool repository.
+ ignore: "*"
From 2ad196c063e67c7efdac344792b67de3479d789d Mon Sep 17 00:00:00 2001
From: BenWhitehead
Date: Fri, 16 Jun 2023 11:13:01 -0400
Subject: [PATCH 07/15] feat: add new dedup utility method to Option classes
(#2063)
When providing options duplicates are not allowed, however there are times when you might end up providing two options which would collide. These new utility methods encapsulate the logic necessary to deduplicate any overlap wil returing an array which can be passed directly to the respective operation method.
`dedupe` utility methods added to each of the following Option classes:
* Storage.BlobGetOption.dedupe();
* Storage.BlobListOption.dedupe();
* Storage.BlobSourceOption.dedupe();
* Storage.BlobTargetOption.dedupe();
* Storage.BlobWriteOption.dedupe();
* Storage.BucketGetOption.dedupe();
* Storage.BucketListOption.dedupe();
* Storage.BucketSourceOption.dedupe();
* Storage.BucketTargetOption.dedupe();
* Storage.CreateHmacKeyOption.dedupe();
* Storage.DeleteHmacKeyOption.dedupe();
* Storage.GetHmacKeyOption.dedupe();
* Storage.ListHmacKeysOption.dedupe();
* Storage.UpdateHmacKeyOption.dedupe();
* Bucket.BlobTargetOption.dedupe();
* Bucket.BlobWriteOption.dedupe();
* Bucket.BucketSourceOption.dedupe();
* Blob.BlobSourceOption.dedupe();
There are overloads which accept a collection or array in addition to varargs.
---
.../java/com/google/cloud/storage/Blob.java | 35 ++
.../java/com/google/cloud/storage/Bucket.java | 107 +++-
.../java/com/google/cloud/storage/Option.java | 33 ++
.../com/google/cloud/storage/Storage.java | 484 +++++++++++++++++-
.../cloud/storage/it/DedupeOptionTest.java | 163 ++++++
5 files changed, 818 insertions(+), 4 deletions(-)
create mode 100644 google-cloud-storage/src/test/java/com/google/cloud/storage/it/DedupeOptionTest.java
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java
index 15d3c489fc..4bba8aef9c 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java
@@ -40,6 +40,7 @@
import java.security.Key;
import java.time.OffsetDateTime;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -163,6 +164,40 @@ public static BlobSourceOption shouldReturnRawInputStream(boolean shouldReturnRa
return new BlobSourceOption(UnifiedOpts.returnRawInputStream(shouldReturnRawInputStream));
}
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobSourceOption[] dedupe(BlobSourceOption... os) {
+ return Option.dedupe(BlobSourceOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobSourceOption[] dedupe(
+ Collection collection, BlobSourceOption... os) {
+ return Option.dedupe(BlobSourceOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobSourceOption[] dedupe(BlobSourceOption[] array, BlobSourceOption... os) {
+ return Option.dedupe(BlobSourceOption[]::new, array, os);
+ }
+
static Storage.BlobSourceOption[] toSourceOptions(
BlobInfo blobInfo, BlobSourceOption... options) {
Storage.BlobSourceOption[] convertedOptions = new Storage.BlobSourceOption[options.length];
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Bucket.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Bucket.java
index af5c2cc255..c8827c1fac 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Bucket.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Bucket.java
@@ -30,7 +30,6 @@
import com.google.cloud.storage.UnifiedOpts.BucketSourceOpt;
import com.google.cloud.storage.UnifiedOpts.ObjectOptExtractor;
import com.google.cloud.storage.UnifiedOpts.ObjectTargetOpt;
-import com.google.cloud.storage.UnifiedOpts.OptionShim;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import java.io.IOException;
@@ -41,6 +40,7 @@
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -99,6 +99,41 @@ public static BucketSourceOption userProject(@NonNull String userProject) {
return new BucketSourceOption(UnifiedOpts.userProject(userProject));
}
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BucketSourceOption[] dedupe(BucketSourceOption... os) {
+ return Option.dedupe(BucketSourceOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketSourceOption[] dedupe(
+ Collection collection, BucketSourceOption... os) {
+ return Option.dedupe(BucketSourceOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketSourceOption[] dedupe(
+ BucketSourceOption[] array, BucketSourceOption... os) {
+ return Option.dedupe(BucketSourceOption[]::new, array, os);
+ }
+
static Storage.BucketSourceOption[] toSourceOptions(
BucketInfo bucketInfo, BucketSourceOption... options) {
Storage.BucketSourceOption[] convertedOptions =
@@ -237,6 +272,40 @@ public static BlobTargetOption userProject(@NonNull String userProject) {
return new BlobTargetOption(UnifiedOpts.userProject(userProject));
}
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobTargetOption[] dedupe(BlobTargetOption... os) {
+ return Option.dedupe(BlobTargetOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobTargetOption[] dedupe(
+ Collection collection, BlobTargetOption... os) {
+ return Option.dedupe(BlobTargetOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobTargetOption[] dedupe(BlobTargetOption[] array, BlobTargetOption... os) {
+ return Option.dedupe(BlobTargetOption[]::new, array, os);
+ }
+
static Storage.BlobTargetOption[] toTargetOptions(
BlobInfo blobInfo, BlobTargetOption... options) {
Storage.BlobTargetOption[] targetOptions = new Storage.BlobTargetOption[options.length];
@@ -255,7 +324,7 @@ static Storage.BlobTargetOption[] toTargetOptions(
}
/** Class for specifying blob write options when {@code Bucket} methods are used. */
- public static class BlobWriteOption extends OptionShim implements Serializable {
+ public static class BlobWriteOption extends Option implements Serializable {
private static final long serialVersionUID = 59762268190041584L;
@@ -366,6 +435,40 @@ public static BlobWriteOption userProject(@NonNull String userProject) {
return new BlobWriteOption(UnifiedOpts.userProject(userProject));
}
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobWriteOption[] dedupe(BlobWriteOption... os) {
+ return Option.dedupe(BlobWriteOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobWriteOption[] dedupe(
+ Collection collection, BlobWriteOption... os) {
+ return Option.dedupe(BlobWriteOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobWriteOption[] dedupe(BlobWriteOption[] array, BlobWriteOption... os) {
+ return Option.dedupe(BlobWriteOption[]::new, array, os);
+ }
+
static Storage.BlobWriteOption[] toWriteOptions(BlobInfo blobInfo, BlobWriteOption... options) {
Storage.BlobWriteOption[] convertedOptions = new Storage.BlobWriteOption[options.length];
for (int i = 0; i < options.length; i++) {
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Option.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Option.java
index 5fb7479c88..e526486ef3 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Option.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Option.java
@@ -18,6 +18,11 @@
import com.google.cloud.storage.UnifiedOpts.Opt;
import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.function.IntFunction;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
/** Base class for Storage operation option. */
@Deprecated
@@ -29,4 +34,32 @@ public abstract class Option extends UnifiedOpts.OptionShim
Option(O opt) {
super(opt);
}
+
+ @SafeVarargs
+ static > O[] dedupe(IntFunction gen, O... os) {
+ return dedupe(gen, Arrays.stream(os));
+ }
+
+ @SafeVarargs
+ static > O[] dedupe(IntFunction gen, Collection collection, O... os) {
+ return dedupe(gen, Stream.of(collection.stream(), Arrays.stream(os)).flatMap(s -> s));
+ }
+
+ @SafeVarargs
+ static > O[] dedupe(IntFunction gen, O[] array, O... os) {
+ return dedupe(gen, Stream.of(Arrays.stream(array), Arrays.stream(os)).flatMap(s -> s));
+ }
+
+ /**
+ * All Options contain an {@link Opt}, {@code Opt}s are distinct classes allowing us to group
+ * based on those classes. Once grouped, we select the last element to provide last wins behavior.
+ *
+ *
Each of these helpers is an internal implementation detail, primarily due to the fact that
+ * generic arrays can not be instantiated in Java and requires a factory to be passed in.
+ */
+ private static > O[] dedupe(IntFunction gen, Stream s) {
+ return s.collect(Collectors.groupingBy(o -> o.getOpt().getClass())).values().stream()
+ .map(l -> l.get(l.size() - 1))
+ .toArray(gen);
+ }
}
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
index d1838985a8..63a0793cfe 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
@@ -45,7 +45,6 @@
import com.google.cloud.storage.UnifiedOpts.ObjectListOpt;
import com.google.cloud.storage.UnifiedOpts.ObjectSourceOpt;
import com.google.cloud.storage.UnifiedOpts.ObjectTargetOpt;
-import com.google.cloud.storage.UnifiedOpts.OptionShim;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@@ -59,6 +58,7 @@
import java.nio.file.Path;
import java.security.Key;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.LinkedList;
@@ -358,6 +358,39 @@ public static BucketTargetOption userProject(@NonNull String userProject) {
public static BucketTargetOption projection(@NonNull String projection) {
return new BucketTargetOption(UnifiedOpts.projection(projection));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BucketTargetOption[] dedupe(BucketTargetOption... os) {
+ return Option.dedupe(BucketTargetOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ public static BucketTargetOption[] dedupe(
+ Collection collection, BucketTargetOption... os) {
+ return Option.dedupe(BucketTargetOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ public static BucketTargetOption[] dedupe(
+ BucketTargetOption[] array, BucketTargetOption... os) {
+ return Option.dedupe(BucketTargetOption[]::new, array, os);
+ }
}
/** Class for specifying bucket source options. */
@@ -400,6 +433,41 @@ public static BucketSourceOption userProject(@NonNull String userProject) {
public static BucketSourceOption requestedPolicyVersion(long version) {
return new BucketSourceOption(UnifiedOpts.requestedPolicyVersion(version));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BucketSourceOption[] dedupe(BucketSourceOption... os) {
+ return Option.dedupe(BucketSourceOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketSourceOption[] dedupe(
+ Collection collection, BucketSourceOption... os) {
+ return Option.dedupe(BucketSourceOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketSourceOption[] dedupe(
+ BucketSourceOption[] array, BucketSourceOption... os) {
+ return Option.dedupe(BucketSourceOption[]::new, array, os);
+ }
}
/** Class for specifying listHmacKeys options */
@@ -456,6 +524,41 @@ public static ListHmacKeysOption userProject(@NonNull String userProject) {
public static ListHmacKeysOption projectId(@NonNull String projectId) {
return new ListHmacKeysOption(UnifiedOpts.projectId(projectId));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static ListHmacKeysOption[] dedupe(ListHmacKeysOption... os) {
+ return Option.dedupe(ListHmacKeysOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static ListHmacKeysOption[] dedupe(
+ Collection collection, ListHmacKeysOption... os) {
+ return Option.dedupe(ListHmacKeysOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static ListHmacKeysOption[] dedupe(
+ ListHmacKeysOption[] array, ListHmacKeysOption... os) {
+ return Option.dedupe(ListHmacKeysOption[]::new, array, os);
+ }
}
/** Class for specifying createHmacKey options */
@@ -482,6 +585,41 @@ public static CreateHmacKeyOption userProject(@NonNull String userProject) {
public static CreateHmacKeyOption projectId(@NonNull String projectId) {
return new CreateHmacKeyOption(UnifiedOpts.projectId(projectId));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static CreateHmacKeyOption[] dedupe(CreateHmacKeyOption... os) {
+ return Option.dedupe(CreateHmacKeyOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static CreateHmacKeyOption[] dedupe(
+ Collection collection, CreateHmacKeyOption... os) {
+ return Option.dedupe(CreateHmacKeyOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static CreateHmacKeyOption[] dedupe(
+ CreateHmacKeyOption[] array, CreateHmacKeyOption... os) {
+ return Option.dedupe(CreateHmacKeyOption[]::new, array, os);
+ }
}
/** Class for specifying getHmacKey options */
@@ -507,6 +645,40 @@ public static GetHmacKeyOption userProject(@NonNull String userProject) {
public static GetHmacKeyOption projectId(@NonNull String projectId) {
return new GetHmacKeyOption(UnifiedOpts.projectId(projectId));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static GetHmacKeyOption[] dedupe(GetHmacKeyOption... os) {
+ return Option.dedupe(GetHmacKeyOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static GetHmacKeyOption[] dedupe(
+ Collection collection, GetHmacKeyOption... os) {
+ return Option.dedupe(GetHmacKeyOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static GetHmacKeyOption[] dedupe(GetHmacKeyOption[] array, GetHmacKeyOption... os) {
+ return Option.dedupe(GetHmacKeyOption[]::new, array, os);
+ }
}
/** Class for specifying deleteHmacKey options */
@@ -523,6 +695,41 @@ private DeleteHmacKeyOption(HmacKeyTargetOpt opt) {
public static DeleteHmacKeyOption userProject(@NonNull String userProject) {
return new DeleteHmacKeyOption(UnifiedOpts.userProject(userProject));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static DeleteHmacKeyOption[] dedupe(DeleteHmacKeyOption... os) {
+ return Option.dedupe(DeleteHmacKeyOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static DeleteHmacKeyOption[] dedupe(
+ Collection collection, DeleteHmacKeyOption... os) {
+ return Option.dedupe(DeleteHmacKeyOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static DeleteHmacKeyOption[] dedupe(
+ DeleteHmacKeyOption[] array, DeleteHmacKeyOption... os) {
+ return Option.dedupe(DeleteHmacKeyOption[]::new, array, os);
+ }
}
/** Class for specifying updateHmacKey options */
@@ -539,6 +746,41 @@ private UpdateHmacKeyOption(HmacKeyTargetOpt opt) {
public static UpdateHmacKeyOption userProject(@NonNull String userProject) {
return new UpdateHmacKeyOption(UnifiedOpts.userProject(userProject));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static UpdateHmacKeyOption[] dedupe(UpdateHmacKeyOption... os) {
+ return Option.dedupe(UpdateHmacKeyOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static UpdateHmacKeyOption[] dedupe(
+ Collection collection, UpdateHmacKeyOption... os) {
+ return Option.dedupe(UpdateHmacKeyOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static UpdateHmacKeyOption[] dedupe(
+ UpdateHmacKeyOption[] array, UpdateHmacKeyOption... os) {
+ return Option.dedupe(UpdateHmacKeyOption[]::new, array, os);
+ }
}
/** Class for specifying bucket get options. */
@@ -593,6 +835,40 @@ public static BucketGetOption fields(BucketField... fields) {
.build();
return new BucketGetOption(UnifiedOpts.fields(set));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BucketGetOption[] dedupe(BucketGetOption... os) {
+ return Option.dedupe(BucketGetOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketGetOption[] dedupe(
+ Collection collection, BucketGetOption... os) {
+ return Option.dedupe(BucketGetOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketGetOption[] dedupe(BucketGetOption[] array, BucketGetOption... os) {
+ return Option.dedupe(BucketGetOption[]::new, array, os);
+ }
}
/** Class for specifying blob target options. */
@@ -743,10 +1019,44 @@ public static BlobTargetOption encryptionKey(@NonNull String key) {
public static BlobTargetOption kmsKeyName(@NonNull String kmsKeyName) {
return new BlobTargetOption(UnifiedOpts.kmsKeyName(kmsKeyName));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobTargetOption[] dedupe(BlobTargetOption... os) {
+ return Option.dedupe(BlobTargetOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobTargetOption[] dedupe(
+ Collection collection, BlobTargetOption... os) {
+ return Option.dedupe(BlobTargetOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobTargetOption[] dedupe(BlobTargetOption[] array, BlobTargetOption... os) {
+ return Option.dedupe(BlobTargetOption[]::new, array, os);
+ }
}
/** Class for specifying blob write options. */
- class BlobWriteOption extends OptionShim implements Serializable {
+ class BlobWriteOption extends Option implements Serializable {
private static final long serialVersionUID = 5536338021856320475L;
@@ -921,6 +1231,40 @@ public static BlobWriteOption disableGzipContent() {
public static BlobWriteOption detectContentType() {
return new BlobWriteOption(UnifiedOpts.detectContentType());
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobWriteOption[] dedupe(BlobWriteOption... os) {
+ return Option.dedupe(BlobWriteOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobWriteOption[] dedupe(
+ Collection collection, BlobWriteOption... os) {
+ return Option.dedupe(BlobWriteOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobWriteOption[] dedupe(BlobWriteOption[] array, BlobWriteOption... os) {
+ return Option.dedupe(BlobWriteOption[]::new, array, os);
+ }
}
/** Class for specifying blob source options. */
@@ -1034,6 +1378,40 @@ public static BlobSourceOption userProject(@NonNull String userProject) {
public static BlobSourceOption shouldReturnRawInputStream(boolean shouldReturnRawInputStream) {
return new BlobSourceOption(UnifiedOpts.returnRawInputStream(shouldReturnRawInputStream));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobSourceOption[] dedupe(BlobSourceOption... os) {
+ return Option.dedupe(BlobSourceOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobSourceOption[] dedupe(
+ Collection collection, BlobSourceOption... os) {
+ return Option.dedupe(BlobSourceOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobSourceOption[] dedupe(BlobSourceOption[] array, BlobSourceOption... os) {
+ return Option.dedupe(BlobSourceOption[]::new, array, os);
+ }
}
/** Class for specifying blob get options. */
@@ -1161,6 +1539,40 @@ public static BlobGetOption decryptionKey(@NonNull String key) {
public static BlobGetOption shouldReturnRawInputStream(boolean shouldReturnRawInputStream) {
return new BlobGetOption(UnifiedOpts.returnRawInputStream(shouldReturnRawInputStream));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobGetOption[] dedupe(BlobGetOption... os) {
+ return Option.dedupe(BlobGetOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobGetOption[] dedupe(
+ Collection collection, BlobGetOption... os) {
+ return Option.dedupe(BlobGetOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobGetOption[] dedupe(BlobGetOption[] array, BlobGetOption... os) {
+ return Option.dedupe(BlobGetOption[]::new, array, os);
+ }
}
/** Class for specifying bucket list options. */
@@ -1219,6 +1631,40 @@ public static BucketListOption fields(BucketField... fields) {
.collect(ImmutableSet.toImmutableSet());
return new BucketListOption(UnifiedOpts.fields(set));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BucketListOption[] dedupe(BucketListOption... os) {
+ return Option.dedupe(BucketListOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketListOption[] dedupe(
+ Collection collection, BucketListOption... os) {
+ return Option.dedupe(BucketListOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BucketListOption[] dedupe(BucketListOption[] array, BucketListOption... os) {
+ return Option.dedupe(BucketListOption[]::new, array, os);
+ }
}
/** Class for specifying blob list options. */
@@ -1351,6 +1797,40 @@ public static BlobListOption fields(BlobField... fields) {
.collect(ImmutableSet.toImmutableSet());
return new BlobListOption(UnifiedOpts.fields(set));
}
+
+ /**
+ * Deduplicate any options which are the same parameter. The value which comes last in {@code
+ * os} will be the value included in the return.
+ */
+ @BetaApi
+ public static BlobListOption[] dedupe(BlobListOption... os) {
+ return Option.dedupe(BlobListOption[]::new, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *
The value which comes last in {@code collection} and {@code os} will be the value included
+ * in the return. All options from {@code os} will override their counterparts in {@code
+ * collection}.
+ */
+ @BetaApi
+ public static BlobListOption[] dedupe(
+ Collection collection, BlobListOption... os) {
+ return Option.dedupe(BlobListOption[]::new, collection, os);
+ }
+
+ /**
+ * Deduplicate any options which are the same parameter.
+ *
+ *