diff --git a/google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/FakeStorageRpc.java b/google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/FakeStorageRpc.java index 4ce3abae3dc2..95b7948acef5 100644 --- a/google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/FakeStorageRpc.java +++ b/google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/FakeStorageRpc.java @@ -448,17 +448,17 @@ private static boolean processedAsFolder(StorageObject so, String delimiter, Str } @Override - public Policy getPolicy(String bucket) { + public Policy getIamPolicy(String bucket) { throw new UnsupportedOperationException(); } @Override - public Policy updatePolicy(String bucket, Policy policy) { + public Policy setIamPolicy(String bucket, Policy policy) { throw new UnsupportedOperationException(); } @Override - public TestIamPermissionsResponse testPermissions(String bucket, List permissions) { + public TestIamPermissionsResponse testIamPermissions(String bucket, List permissions) { throw new UnsupportedOperationException(); } } diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java index e94bf34344a3..59a4a6d3a853 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java @@ -2378,13 +2378,13 @@ public static Builder newBuilder() { *

Example of getting the IAM policy for a bucket. *

 {@code
    * String bucketName = "my_unique_bucket";
-   * Policy policy = storage.getPolicy(bucketName);
+   * Policy policy = storage.getIamPolicy(bucketName);
    * }
* * @throws StorageException upon failure */ @GcpLaunchStage.Alpha - Policy getPolicy(String bucket); + Policy getIamPolicy(String bucket); /** * Updates the IAM policy on the specified bucket. @@ -2393,9 +2393,9 @@ public static Builder newBuilder() { *
{@code
    * // We want to make all objects in our bucket publicly readable.
    * String bucketName = "my_unique_bucket";
-   * Policy currentPolicy = storage.getPolicy(bucketName);
+   * Policy currentPolicy = storage.getIamPolicy(bucketName);
    * Policy updatedPolicy =
-   *     storage.updatePolicy(
+   *     storage.setIamPolicy(
    *         bucketName,
    *         currentPolicy.toBuilder()
    *             .addIdentity(StorageRoles.objectViewer(), Identity.allUsers())
@@ -2405,7 +2405,7 @@ public static Builder newBuilder() {
    * @throws StorageException upon failure
    */
   @GcpLaunchStage.Alpha
-  Policy updatePolicy(String bucket, Policy policy);
+  Policy setIamPolicy(String bucket, Policy policy);
   
   /**
    * Tests whether the caller holds the permissions on the specified bucket. Returns a list of
@@ -2415,7 +2415,7 @@ public static Builder newBuilder() {
    * 
 {@code
    * String bucketName = "my_unique_bucket";
    * List response =
-   *     storage.testPermissions(
+   *     storage.testIamPermissions(
    *         bucket,
    *         ImmutableList.of("storage.buckets.get", "storage.buckets.getIamPolicy"));
    * for (boolean hasPermission : response) {
@@ -2426,5 +2426,5 @@ public static Builder newBuilder() {
    * @throws StorageException upon failure
    */
   @GcpLaunchStage.Alpha
-  List testPermissions(String bucket, List permissions);
+  List testIamPermissions(String bucket, List permissions);
 }
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
index 30a41fd81185..996750423a29 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
@@ -862,12 +862,12 @@ public List call() {
   }
   
   @Override
-  public Policy getPolicy(final String bucket) {
+  public Policy getIamPolicy(final String bucket) {
     try {
       return convertFromApiPolicy(runWithRetries(new Callable() {
         @Override
         public com.google.api.services.storage.model.Policy call() {
-          return storageRpc.getPolicy(bucket);
+          return storageRpc.getIamPolicy(bucket);
         }
       }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()));
     } catch (RetryHelperException e){
@@ -876,12 +876,12 @@ public com.google.api.services.storage.model.Policy call() {
   }
   
   @Override
-  public Policy updatePolicy(final String bucket, final Policy policy) {
+  public Policy setIamPolicy(final String bucket, final Policy policy) {
     try {
       return convertFromApiPolicy(runWithRetries(new Callable() {
         @Override
         public com.google.api.services.storage.model.Policy call() {
-          return storageRpc.updatePolicy(bucket, convertToApiPolicy(policy));
+          return storageRpc.setIamPolicy(bucket, convertToApiPolicy(policy));
         }
       }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()));
     } catch (RetryHelperException e) {
@@ -890,12 +890,12 @@ public com.google.api.services.storage.model.Policy call() {
   }
   
   @Override
-  public List testPermissions(final String bucket, final List permissions) {
+  public List testIamPermissions(final String bucket, final List permissions) {
     try {
       TestIamPermissionsResponse response = runWithRetries(new Callable() {
         @Override
         public TestIamPermissionsResponse call() {
-          return storageRpc.testPermissions(bucket, permissions);
+          return storageRpc.testIamPermissions(bucket, permissions);
         }
       }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock());
       final Set heldPermissions =
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
index 15981d0ac075..a20f8d093b7f 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
@@ -838,7 +838,7 @@ public List listAcls(String bucket, String object, Long gen
   }
 
   @Override
-  public Policy getPolicy(String bucket) {
+  public Policy getIamPolicy(String bucket) {
     try {
       return storage.buckets().getIamPolicy(bucket).execute();
     } catch (IOException ex) {
@@ -847,7 +847,7 @@ public Policy getPolicy(String bucket) {
   }
 
   @Override
-  public Policy updatePolicy(String bucket, Policy policy) {
+  public Policy setIamPolicy(String bucket, Policy policy) {
     try {
       return storage.buckets().setIamPolicy(bucket, policy).execute();
     } catch (IOException ex) {
@@ -856,7 +856,7 @@ public Policy updatePolicy(String bucket, Policy policy) {
   }
 
   @Override
-  public TestIamPermissionsResponse testPermissions(String bucket, List permissions) {
+  public TestIamPermissionsResponse testIamPermissions(String bucket, List permissions) {
     try {
       return storage.buckets().testIamPermissions(bucket, permissions).execute();
     } catch (IOException ex) {
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java
index 31a1ca4896aa..2b408d7aab76 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java
@@ -435,19 +435,19 @@ void write(String uploadId, byte[] toWrite, int toWriteOffset, long destOffset,
    * 
    * @throws StorageException upon failure
    */
-  Policy getPolicy(String bucket);
+  Policy getIamPolicy(String bucket);
   
   /**
    * Updates the IAM policy for the specified bucket.
    * 
    * @throws StorageException upon failure
    */
-  Policy updatePolicy(String bucket, Policy policy);
+  Policy setIamPolicy(String bucket, Policy policy);
   
   /**
    * Tests whether the caller holds the specified permissions for the specified bucket.
    * 
    * @throws StorageException upon failure
    */
-  TestIamPermissionsResponse testPermissions(String bucket, List permissions);
+  TestIamPermissionsResponse testIamPermissions(String bucket, List permissions);
 }
diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
index 1b72623ee92a..fec826dd71ed 100644
--- a/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
@@ -1983,15 +1983,15 @@ public void testListBlobAcl() {
   }
 
   @Test
-  public void testGetPolicy() {
-    EasyMock.expect(storageRpcMock.getPolicy(BUCKET_NAME1)).andReturn(API_POLICY1);
+  public void testGetIamPolicy() {
+    EasyMock.expect(storageRpcMock.getIamPolicy(BUCKET_NAME1)).andReturn(API_POLICY1);
     EasyMock.replay(storageRpcMock);
     initializeService();
-    assertEquals(LIB_POLICY1, storage.getPolicy(BUCKET_NAME1));
+    assertEquals(LIB_POLICY1, storage.getIamPolicy(BUCKET_NAME1));
   }
 
   @Test
-  public void testUpdatePolicy() {
+  public void testSetIamPolicy() {
     com.google.api.services.storage.model.Policy preCommitApiPolicy =
         new com.google.api.services.storage.model.Policy()
             .setBindings(ImmutableList.of(
@@ -2036,18 +2036,18 @@ public void testUpdatePolicy() {
             .setEtag(POLICY_ETAG2)
             .build();
 
-    EasyMock.expect(storageRpcMock.getPolicy(BUCKET_NAME1)).andReturn(API_POLICY1);
+    EasyMock.expect(storageRpcMock.getIamPolicy(BUCKET_NAME1)).andReturn(API_POLICY1);
     EasyMock.expect(
-          storageRpcMock.updatePolicy(
+          storageRpcMock.setIamPolicy(
               eq(BUCKET_NAME1),
               eqApiPolicy(preCommitApiPolicy)))
         .andReturn(postCommitApiPolicy);
     EasyMock.replay(storageRpcMock);
     initializeService();
 
-    Policy currentPolicy = storage.getPolicy(BUCKET_NAME1);
+    Policy currentPolicy = storage.getIamPolicy(BUCKET_NAME1);
     Policy updatedPolicy =
-        storage.updatePolicy(
+        storage.setIamPolicy(
             BUCKET_NAME1,
             currentPolicy.toBuilder()
                 .addIdentity(StorageRoles.admin(), Identity.group("test-group@gmail.com"))
@@ -2056,30 +2056,30 @@ public void testUpdatePolicy() {
   }
 
   @Test
-  public void testTestPermissionsNull() {
+  public void testTestIamPermissionsNull() {
     ImmutableList expectedPermissions = ImmutableList.of(false, false, false);
     ImmutableList checkedPermissions =
         ImmutableList.of("storage.buckets.get", "storage.buckets.getIamPolicy", "storage.objects.list");
 
-    EasyMock.expect(storageRpcMock.testPermissions(BUCKET_NAME1, checkedPermissions))
+    EasyMock.expect(storageRpcMock.testIamPermissions(BUCKET_NAME1, checkedPermissions))
         .andReturn(new TestIamPermissionsResponse());
     EasyMock.replay(storageRpcMock);
     initializeService();
-    assertEquals(expectedPermissions, storage.testPermissions(BUCKET_NAME1, checkedPermissions));
+    assertEquals(expectedPermissions, storage.testIamPermissions(BUCKET_NAME1, checkedPermissions));
   }
 
   @Test
-  public void testTestPermissionsNonNull() {
+  public void testTestIamPermissionsNonNull() {
     ImmutableList expectedPermissions = ImmutableList.of(true, false, true);
     ImmutableList checkedPermissions =
         ImmutableList.of("storage.buckets.get", "storage.buckets.getIamPolicy", "storage.objects.list");
 
-    EasyMock.expect(storageRpcMock.testPermissions(BUCKET_NAME1, checkedPermissions))
+    EasyMock.expect(storageRpcMock.testIamPermissions(BUCKET_NAME1, checkedPermissions))
         .andReturn(new TestIamPermissionsResponse()
             .setPermissions(ImmutableList.of("storage.objects.list", "storage.buckets.get")));
     EasyMock.replay(storageRpcMock);
     initializeService();
-    assertEquals(expectedPermissions, storage.testPermissions(BUCKET_NAME1, checkedPermissions));
+    assertEquals(expectedPermissions, storage.testIamPermissions(BUCKET_NAME1, checkedPermissions));
   }
 
   @Test
diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
index 9215058595a5..66f7edca7ed9 100644
--- a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
@@ -1463,19 +1463,19 @@ public void testBucketPolicy() {
           StorageRoles.legacyObjectReader(), newHashSet(Identity.allUsers()));
 
     // Validate getting policy.
-    Policy currentPolicy = storage.getPolicy(BUCKET);
+    Policy currentPolicy = storage.getIamPolicy(BUCKET);
     assertEquals(bindingsWithoutPublicRead, currentPolicy.getBindings());
     
     // Validate updating policy.
     Policy updatedPolicy =
-        storage.updatePolicy(
+        storage.setIamPolicy(
             BUCKET,
             currentPolicy.toBuilder()
                 .addIdentity(StorageRoles.legacyObjectReader(), Identity.allUsers())
                 .build());
     assertEquals(bindingsWithPublicRead, updatedPolicy.getBindings());
     Policy revertedPolicy =
-        storage.updatePolicy(
+        storage.setIamPolicy(
             BUCKET,
             updatedPolicy.toBuilder()
                 .removeIdentity(StorageRoles.legacyObjectReader(), Identity.allUsers())
@@ -1486,7 +1486,7 @@ public void testBucketPolicy() {
     List expectedPermissions = ImmutableList.of(true, true);
     assertEquals(
         expectedPermissions,
-        storage.testPermissions(
+        storage.testIamPermissions(
             BUCKET,
             ImmutableList.of("storage.buckets.getIamPolicy", "storage.buckets.setIamPolicy")));
   }