Skip to content

Commit 488a468

Browse files
authored
---
yaml --- r: 8465 b: refs/heads/master c: 5af5e6c h: refs/heads/master i: 8463: ce3c968
1 parent 52b702c commit 488a468

8 files changed

Lines changed: 319 additions & 86 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0b728fd80dd6b0aeec6144484d6b2535b602e1cb
2+
refs/heads/master: 5af5e6cb420b60a2c8520f2d5964f7be9affb8db
33
refs/heads/travis: 47e4fee4fd5af9b2a8ce46f23c72ec95f9b195b2
44
refs/heads/gh-pages: 3e16a39145437096333db5811e5c0292719c1823
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

trunk/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/testing/FakeStorageRpc.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,27 +343,27 @@ public RewriteResponse continueRewrite(RewriteResponse previousResponse) throws
343343
}
344344

345345
@Override
346-
public BucketAccessControl getAcl(String bucket, String entity) {
346+
public BucketAccessControl getAcl(String bucket, String entity, Map<Option, ?> options) {
347347
throw new UnsupportedOperationException();
348348
}
349349

350350
@Override
351-
public boolean deleteAcl(String bucket, String entity) {
351+
public boolean deleteAcl(String bucket, String entity, Map<Option, ?> options) {
352352
throw new UnsupportedOperationException();
353353
}
354354

355355
@Override
356-
public BucketAccessControl createAcl(BucketAccessControl acl) {
356+
public BucketAccessControl createAcl(BucketAccessControl acl, Map<Option, ?> options) {
357357
throw new UnsupportedOperationException();
358358
}
359359

360360
@Override
361-
public BucketAccessControl patchAcl(BucketAccessControl acl) {
361+
public BucketAccessControl patchAcl(BucketAccessControl acl, Map<Option, ?> options) {
362362
throw new UnsupportedOperationException();
363363
}
364364

365365
@Override
366-
public List<BucketAccessControl> listAcls(String bucket) {
366+
public List<BucketAccessControl> listAcls(String bucket, Map<Option, ?> options) {
367367
throw new UnsupportedOperationException();
368368
}
369369

@@ -449,17 +449,17 @@ private static boolean processedAsFolder(StorageObject so, String delimiter, Str
449449
}
450450

451451
@Override
452-
public Policy getIamPolicy(String bucket) {
452+
public Policy getIamPolicy(String bucket, Map<Option, ?> options) {
453453
throw new UnsupportedOperationException();
454454
}
455455

456456
@Override
457-
public Policy setIamPolicy(String bucket, Policy policy) {
457+
public Policy setIamPolicy(String bucket, Policy policy, Map<Option, ?> options) {
458458
throw new UnsupportedOperationException();
459459
}
460460

461461
@Override
462-
public TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions) {
462+
public TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions, Map<Option, ?> options) {
463463
throw new UnsupportedOperationException();
464464
}
465465
}

trunk/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java

Lines changed: 97 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,17 @@ public static BlobListOption currentDirectory() {
833833
return new BlobListOption(StorageRpc.Option.DELIMITER, true);
834834
}
835835

836+
/**
837+
* Returns an option for bucket's billing user project. This option is only used by the buckets with
838+
* 'requester_pays' flag.
839+
*
840+
* @param userProject projectId of the billing user project.
841+
*/
842+
@GcpLaunchStage.Alpha
843+
public static BlobListOption userProject(String userProject) {
844+
return new BlobListOption(StorageRpc.Option.USER_PROJECT, userProject);
845+
}
846+
836847
/**
837848
* If set to {@code true}, lists all versions of a blob. The default is {@code false}.
838849
*
@@ -2178,15 +2189,25 @@ public static Builder newBuilder() {
21782189
* Acl acl = storage.getAcl(bucketName, User.ofAllAuthenticatedUsers());
21792190
* }</pre>
21802191
*
2181-
* <p>Example of getting the ACL entry for a specific user on a bucket.
2192+
* <p>Example of getting the ACL entry for a specific user on a requester_pays bucket with a
2193+
* user_project option.
21822194
* <pre> {@code
21832195
* String bucketName = "my_unique_bucket";
21842196
* String userEmail = "google-cloud-java-tests@java-docs-samples-tests.iam.gserviceaccount.com";
2185-
* Acl acl = storage.getAcl(bucketName, new User(userEmail));
2197+
* BucketSourceOption userProjectOption = BucketSourceOption.userProject("myProject");
2198+
* Acl acl = storage.getAcl(bucketName, new User(userEmail), userProjectOption);
21862199
* }</pre>
21872200
*
2201+
* @param bucket name of the bucket where the getAcl operation takes place
2202+
* @param entity ACL entity to fetch
2203+
* @param options extra parameters to apply to this operation
21882204
* @throws StorageException upon failure
21892205
*/
2206+
Acl getAcl(String bucket, Entity entity, BucketSourceOption... options);
2207+
2208+
/**
2209+
* @see #getAcl(String, Entity, BucketSourceOption...)
2210+
*/
21902211
Acl getAcl(String bucket, Entity entity);
21912212

21922213
/**
@@ -2203,9 +2224,25 @@ public static Builder newBuilder() {
22032224
* }
22042225
* }</pre>
22052226
*
2227+
* <p>Example of deleting the ACL entry for a specific user on a requester_pays bucket with a
2228+
* user_project option.
2229+
* <pre> {@code
2230+
* String bucketName = "my_unique_bucket";
2231+
* BucketSourceOption userProject = BucketSourceOption.userProject("myProject");
2232+
* boolean deleted = storage.deleteAcl(bucketName, User.ofAllAuthenticatedUsers(), userProject);
2233+
* }</pre>
2234+
*
2235+
* @param bucket name of the bucket to delete an ACL from
2236+
* @param entity ACL entity to delete
2237+
* @param options extra parameters to apply to this operation
22062238
* @return {@code true} if the ACL was deleted, {@code false} if it was not found
22072239
* @throws StorageException upon failure
22082240
*/
2241+
boolean deleteAcl(String bucket, Entity entity, BucketSourceOption... options);
2242+
2243+
/**
2244+
* @see #deleteAcl(String, Entity, BucketSourceOption...)
2245+
*/
22092246
boolean deleteAcl(String bucket, Entity entity);
22102247

22112248
/**
@@ -2217,8 +2254,23 @@ public static Builder newBuilder() {
22172254
* Acl acl = storage.createAcl(bucketName, Acl.of(User.ofAllAuthenticatedUsers(), Role.READER));
22182255
* }</pre>
22192256
*
2257+
* <p>Example of creating a new ACL entry on a requester_pays bucket with a user_project option.
2258+
* <pre> {@code
2259+
* String bucketName = "my_unique_bucket";
2260+
* Acl acl = storage.createAcl(bucketName, Acl.of(User.ofAllAuthenticatedUsers(), Role.READER),
2261+
* BucketSourceOption.userProject("myProject"));
2262+
* }</pre>
2263+
*
2264+
* @param bucket name of the bucket for which an ACL should be created
2265+
* @param acl ACL to create
2266+
* @param options extra parameters to apply to this operation
22202267
* @throws StorageException upon failure
22212268
*/
2269+
Acl createAcl(String bucket, Acl acl, BucketSourceOption... options);
2270+
2271+
/**
2272+
* @see #createAcl(String, Acl, BucketSourceOption...)
2273+
*/
22222274
Acl createAcl(String bucket, Acl acl);
22232275

22242276
/**
@@ -2230,8 +2282,23 @@ public static Builder newBuilder() {
22302282
* Acl acl = storage.updateAcl(bucketName, Acl.of(User.ofAllAuthenticatedUsers(), Role.OWNER));
22312283
* }</pre>
22322284
*
2285+
* <p>Example of updating a new ACL entry on a requester_pays bucket with a user_project option.
2286+
* <pre> {@code
2287+
* String bucketName = "my_unique_bucket";
2288+
* Acl acl = storage.updateAcl(bucketName, Acl.of(User.ofAllAuthenticatedUsers(), Role.OWNER),
2289+
* BucketSourceOption.userProject("myProject"));
2290+
* }</pre>
2291+
*
2292+
* @param bucket name of the bucket where the updateAcl operation takes place
2293+
* @param acl ACL to update
2294+
* @param options extra parameters to apply to this operation
22332295
* @throws StorageException upon failure
22342296
*/
2297+
Acl updateAcl(String bucket, Acl acl, BucketSourceOption... options);
2298+
2299+
/**
2300+
* @see #updateAcl(String, Acl, BucketSourceOption...)
2301+
*/
22352302
Acl updateAcl(String bucket, Acl acl);
22362303

22372304
/**
@@ -2246,8 +2313,25 @@ public static Builder newBuilder() {
22462313
* }
22472314
* }</pre>
22482315
*
2316+
* <p>Example of listing the ACL entries for a blob in a requester_pays bucket with a user_project
2317+
* option.
2318+
* <pre> {@code
2319+
* String bucketName = "my_unique_bucket";
2320+
* List<Acl> acls = storage.listAcls(bucketName, BucketSourceOption.userProject("myProject"));
2321+
* for (Acl acl : acls) {
2322+
* // do something with ACL entry
2323+
* }
2324+
* }</pre>
2325+
*
2326+
* @param bucket the name of the bucket to list ACLs for
2327+
* @param options any number of BucketSourceOptions to apply to this operation
22492328
* @throws StorageException upon failure
22502329
*/
2330+
List<Acl> listAcls(String bucket, BucketSourceOption... options);
2331+
2332+
/**
2333+
* @see #listAcls(String, BucketSourceOption...)
2334+
*/
22512335
List<Acl> listAcls(String bucket);
22522336

22532337
/**
@@ -2459,11 +2543,13 @@ public static Builder newBuilder() {
24592543
* Policy policy = storage.getIamPolicy(bucketName);
24602544
* }</pre>
24612545
*
2546+
* @param bucket name of the bucket where the getIamPolicy operation takes place
2547+
* @param options extra parameters to apply to this operation
24622548
* @throws StorageException upon failure
24632549
*/
24642550
@BetaApi
24652551
@GcpLaunchStage.Alpha
2466-
Policy getIamPolicy(String bucket);
2552+
Policy getIamPolicy(String bucket, BucketSourceOption... options);
24672553

24682554
/**
24692555
* Updates the IAM policy on the specified bucket.
@@ -2481,11 +2567,14 @@ public static Builder newBuilder() {
24812567
* .build());
24822568
* }</pre>
24832569
*
2570+
* @param bucket name of the bucket where the setIamPolicy operation takes place
2571+
* @param policy policy to be set on the specified bucket
2572+
* @param options extra parameters to apply to this operation
24842573
* @throws StorageException upon failure
24852574
*/
24862575
@BetaApi
24872576
@GcpLaunchStage.Alpha
2488-
Policy setIamPolicy(String bucket, Policy policy);
2577+
Policy setIamPolicy(String bucket, Policy policy, BucketSourceOption... options);
24892578

24902579
/**
24912580
* Tests whether the caller holds the permissions on the specified bucket. Returns a list of
@@ -2503,9 +2592,12 @@ public static Builder newBuilder() {
25032592
* }
25042593
* }</pre>
25052594
*
2595+
* @param bucket name of the bucket where the testIamPermissions operation takes place
2596+
* @param permissions list of permissions to test on the bucket
2597+
* @param options extra parameters to apply to this operation
25062598
* @throws StorageException upon failure
25072599
*/
25082600
@BetaApi
25092601
@GcpLaunchStage.Alpha
2510-
List<Boolean> testIamPermissions(String bucket, List<String> permissions);
2602+
List<Boolean> testIamPermissions(String bucket, List<String> permissions, BucketSourceOption... options);
25112603
}

0 commit comments

Comments
 (0)