public Page < Bucket > authListBuckets ( ) { // [START auth_cloud_implicit] // If you don't specify credentials when constructing the client, the // client library will look for credentials in the environment. Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; Page < Bucket > buckets = storage . list ( ) ; for ( Bucket bucket : buckets . iterateAll ( ) ) { // do something with the info } // [END auth_cloud_implicit] return buckets ; }
Example of default auth