-
Notifications
You must be signed in to change notification settings - Fork 89
feat: add support for partial success in ListBuckets for json #3404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
Outdated
Show resolved
Hide resolved
google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java
Outdated
Show resolved
Hide resolved
google-cloud-storage/src/main/java/com/google/cloud/storage/BucketInfo.java
Outdated
Show resolved
Hide resolved
google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
Outdated
Show resolved
Hide resolved
google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITListBucketTest.java
Outdated
Show resolved
Hide resolved
google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplMockitoTest.java
Outdated
Show resolved
Hide resolved
google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITListBucketTest.java
Outdated
Show resolved
Hide resolved
| @CrossRun( | ||
| backends = {Backend.TEST_BENCH}, | ||
| transports = {Transport.HTTP}) | ||
| public class ITListBucketTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a testcase with multiple unreachable buckets
| ifNonNull(from.getIpFilter(), ipFilterCodec::decode, to::setIpFilter); | ||
| if (from.containsKey("isUnreachable")) { | ||
| to.setIsUnreachable(Boolean.TRUE); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spoke about this offline as well, but we need to update the logic here to handle the bucket resource names the same way grpc does.
On line https://github.com/googleapis/java-storage/pull/3404/files#diff-02854c6353038f671563a52b22658f9dcb49e66d8eb45a822439e90aa60b11f6R612 we need to add change the first line to be BucketInfo.Builder to = new BucketInfo.BuilderImpl(bucketNameCodec.decode(from.getName())); like in
java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcConversions.java
Line 322 in 3a95990
| BucketInfo.Builder to = new BucketInfo.BuilderImpl(bucketNameCodec.decode(from.getName())); |
Even in grpc we don't expose projects/_/buckets/ everything is normalized to json style bucket names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this does deviate from how the API returns the value, and possibly how other languages have exposed things. This change does mean that the Storage sdk here is internally consistent, and customers can reliably use bucket names regardless of unavailability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in PR #3415
This PR adds support for the returnPartialSuccess parameter in ListBuckets calls for JSON.
A new Storage.BucketListOption.returnPartialSuccess(true) is introduced. When set, the list operation returns a set containing both reachable buckets and unreachable buckets. Unreachable buckets are distinguished by having the isUnreachable=true flag set and are named using their full resource form (e.g., "projects/_/buckets/bucket1").