@@ -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