public Bucket disableRequesterPays ( String bucketName ) { // [START disable_requester_pays] // Instantiate a Google Cloud Storage client Storage storage = StorageOptions . getDefaultInstance ( ) . getService ( ) ; // The name of the bucket to disable requester-paying for, e.g. "my-bucket" // String bucketName = "my-bucket" BucketInfo bucketInfo = BucketInfo . newBuilder ( bucketName ) . setRequesterPays ( false ) . build ( ) ; // Update the bucket, throws StorageException on failure Bucket bucket = storage . update ( bucketInfo ) ; System . out . println ( "Requester pays status for " + bucketName + ": " + bucket . requesterPays ( ) ) ; // [END disable_requester_pays] return bucket ; }
Example of disabling Requester pays on a bucket .