Skip to content

Requester pays expose userProject#2558

Merged
andreamlin merged 39 commits intogoogleapis:masterfrom
andreamlin:requester_pays_test_iam_permissions
Nov 6, 2017
Merged

Requester pays expose userProject#2558
andreamlin merged 39 commits intogoogleapis:masterfrom
andreamlin:requester_pays_test_iam_permissions

Conversation

@andreamlin
Copy link
Contributor

@andreamlin andreamlin commented Oct 26, 2017

Expose userProject for the operations

  • storage.objects.list
  • storage.bucket.testIamPermissions
  • storage.bucketAccessControls.delete
  • storage.bucketAccessControls.get
  • storage.bucketAccessControls.insert
  • storage.bucketAccessControls.list
  • storage.bucketAccessControls.patch
  • storage.buckets.getIamPolicy
  • storage.buckets.setIamPolicy

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 26, 2017
@andreamlin andreamlin removed the request for review from garrettjonesgoogle October 26, 2017 23:43
@andreamlin andreamlin changed the title Requester pays test iam permissions WIP Requester pays expose userProject Nov 1, 2017
@andreamlin andreamlin requested a review from vam-google November 1, 2017 17:42
@andreamlin
Copy link
Contributor Author

PTAL

/**
* Returns an option for bucket's billing user project. This option is only used by the buckets with
* 'requester_pays' flag.
*/

This comment was marked as spam.

This comment was marked as spam.

*/
List<Boolean> delete(Iterable<BlobId> blobIds);

/**

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

*
* <p>Example of getting the ACL entry for a specific user on a bucket.
* <pre> {@code
* String bucketName = "my_unique_bucket";

This comment was marked as spam.

This comment was marked as spam.

return Collections.unmodifiableList(results);
}

@Override

This comment was marked as spam.

This comment was marked as spam.

*/
RewriteResponse continueRewrite(RewriteResponse previousResponse);

/**

This comment was marked as spam.

This comment was marked as spam.

}

// Test listing a Requester Pays bucket.
Bucket remoteBucket = storage.get(BUCKET, Storage.BucketGetOption.fields(BucketField.ID));

This comment was marked as spam.

This comment was marked as spam.

StorageRoles.legacyBucketOwner(),
(Set<Identity>) newHashSet(projectOwner, projectEditor),
StorageRoles.legacyBucketReader(), newHashSet(projectViewer));
(Set<Identity>) Sets.newHashSet(projectOwner, projectEditor),

This comment was marked as spam.

This comment was marked as spam.

@andreamlin andreamlin mentioned this pull request Nov 2, 2017
@andreamlin
Copy link
Contributor Author

Addressed all comments. PTAL

* String bucketName = "my_unique_bucket";
* String userEmail = "google-cloud-java-tests@java-docs-samples-tests.iam.gserviceaccount.com";
* Acl acl = storage.getAcl(bucketName, new User(userEmail));
* BucketSourceOption userProjectOption = BucketSourceOption.userProject("myProject");

This comment was marked as spam.

This comment was marked as spam.

*
* @throws StorageException upon failure
*/
Acl getAcl(String bucket, Entity entity, BucketSourceOption... options);

This comment was marked as spam.

This comment was marked as spam.

* <pre> {@code
* String bucketName = "my_unique_bucket";
* boolean deleted = storage.deleteAcl(bucketName, User.ofAllAuthenticatedUsers());
* BucketSourceOption userProject = BucketSourceOption.userProject("myProject");

This comment was marked as spam.

This comment was marked as spam.

Acl createAcl(String bucket, Acl acl, BucketSourceOption... options);

/**
* @see com.google.cloud.storage.Storage#createAcl(String bucket, Acl acl, BucketSourceOption... options)

This comment was marked as spam.

This comment was marked as spam.

try {
storage.bucketAccessControls().delete(bucket, entity).execute();
storage.bucketAccessControls().delete(bucket, entity)
.setUserProject(Option.USER_PROJECT.getString(options))

This comment was marked as spam.

This comment was marked as spam.

@andreamlin
Copy link
Contributor Author

Replied to all comments. PTAL.

Copy link
Contributor

@vam-google vam-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, with few minor comments. Please address them before pushing (you don't have to request for another LGTM to push your changes).

Acl updateAcl(String bucket, Acl acl, BucketSourceOption... options);

/**
* @see Storage#updateAcl(String, Acl, BucketSourceOption...)

This comment was marked as spam.

This comment was marked as spam.

* // do something with ACL entry
* }
* }</pre>
*

This comment was marked as spam.

This comment was marked as spam.

@andreamlin andreamlin merged commit 5af5e6c into googleapis:master Nov 6, 2017
schmidt-sebastian pushed a commit to FirebasePrivate/google-cloud-java that referenced this pull request Nov 9, 2017
Expose userProject for the operations
- storage.objects.list
- storage.bucket.testIamPermissions
- storage.bucketAccessControls.delete
- storage.bucketAccessControls.get
- storage.bucketAccessControls.insert
- storage.bucketAccessControls.list
- storage.bucketAccessControls.patch
- storage.buckets.getIamPolicy
- storage.buckets.setIamPolicy
@andreamlin andreamlin deleted the requester_pays_test_iam_permissions branch February 27, 2018 18:07
chingor13 pushed a commit that referenced this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants