public Bucket getRequesterPaysStatus ( String bucketName ) throws StorageException { // [START get_requester_pays_status] // Instantiate a Google Cloud Storage client Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; // The name of the bucket to retrieve requester-pays status, eg. "my-bucket" // String bucketName = "my-bucket" // Retrieve the bucket, throws StorageException on failure Bucket bucket = storage . get ( bucketName , Storage . BucketGetOption . fields ( BucketField . BILLING ) ) ; System . out . println ( "Requester pays status : " + bucket . requesterPays ( ) ) ; // [END get_requester_pays_status] return bucket ; }
Example of retrieving Requester pays status on a bucket .