Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.storage;

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

public class ListBucketsReturnPartialSuccess {

public static void listBucketsReturnPartialSuccess() {
// [START storage_buckets_list_with_return_partial_success]
// The ID of your project
String projectId = "your-project-id";

Storage storage = StorageOptions.newBuilder().setProjectId(projectId).build().getService();
Iterator<Bucket> buckets = storage.listBuckets(Storage.BucketListOption.returnPartialSuccess()).iterateAll();

buckets.forEachRemaining(
bucket -> {
System.out.println(bucket.getName() + " isUnreachable: " + bucket.isUnreachable());
});
// [END storage_buckets_list_with_return_partial_success]
}
}
Loading