From 52bf6c1001716cd5f2145ff3be40631d542cd200 Mon Sep 17 00:00:00 2001 From: Ajay Kannan Date: Mon, 21 Mar 2016 19:51:37 -0700 Subject: [PATCH] remove varargs for testPermissions and other minor fixes --- .../google/gcloud/resourcemanager/Policy.java | 4 ++-- .../gcloud/resourcemanager/Project.java | 23 ------------------- .../resourcemanager/ResourceManager.java | 22 ------------------ .../resourcemanager/ResourceManagerImpl.java | 7 ------ .../gcloud/resourcemanager/ProjectTest.java | 3 --- .../ResourceManagerImplTest.java | 6 ----- 6 files changed, 2 insertions(+), 63 deletions(-) diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java index 884f474bed59..219d74262319 100644 --- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java +++ b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java @@ -47,7 +47,7 @@ public class Policy extends IamPolicy { /** * The project-level roles in an IAM policy. This enum is not an exhaustive list of all roles * you can use in an IAM policy. You can also use service-specific roles (e.g. - * roles/pubsub.editor). See the Supported Cloud Platform Services page for links + * "roles/pubsub.editor"). See the Supported Cloud Platform Services page for links * to service-specific roles. * * @see Supported Cloud @@ -74,7 +74,7 @@ public enum ProjectRole { */ OWNER("roles/owner"); - String value; + private final String value; private ProjectRole(String value) { this.value = value; diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java index de5e6c336af4..bf9cf0e01a6d 100644 --- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java +++ b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java @@ -251,29 +251,6 @@ List testPermissions(List permissions) { return resourceManager.testPermissions(projectId(), permissions); } - /** - * Returns the permissions that a caller has on this project. You typically don't call this method - * if you're using Google Cloud Platform directly to manage permissions. This method is intended - * for integration with your proprietary software, such as a customized graphical user interface. - * For example, the Cloud Platform Console tests IAM permissions internally to determine which UI - * should be available to the logged-in user. Each service that supports IAM lists the possible - * permissions; see the Supported Cloud Platform services page below for links to these - * lists. - * - * @return a list of booleans representing whether the caller has the permissions specified (in - * the order of the given permissions) - * @throws ResourceManagerException upon failure - * @see - * Resource Manager testIamPermissions - * @see Supported Cloud Platform - * Services - */ - List testPermissions(String firstPermission, String... otherPermissions) { - return resourceManager.testPermissions(projectId(), firstPermission, otherPermissions); - } - @Override public Builder toBuilder() { return new Builder(this); diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java index 708bd711b477..70eeb9c8eb50 100644 --- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java +++ b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java @@ -341,26 +341,4 @@ public static ProjectListOption fields(ProjectField... fields) { * Services */ List testPermissions(String projectId, List permissions); - - /** - * Returns the permissions that a caller has on the specified project. You typically don't call - * this method if you're using Google Cloud Platform directly to manage permissions. This method - * is intended for integration with your proprietary software, such as a customized graphical user - * interface. For example, the Cloud Platform Console tests IAM permissions internally to - * determine which UI should be available to the logged-in user. Each service that supports IAM - * lists the possible permissions; see the Supported Cloud Platform services page below for - * links to these lists. - * - * @return A list of booleans representing whether the caller has the permissions specified (in - * the order of the given permissions) - * @throws ResourceManagerException upon failure - * @see - * Resource Manager testIamPermissions - * @see Supported Cloud Platform - * Services - */ - List testPermissions( - String projectId, String firstPermission, String... otherPermissions); } diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java index 5526918bc1eb..e4663cb74cb9 100644 --- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java +++ b/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gcloud.BaseService; import com.google.gcloud.Page; @@ -230,12 +229,6 @@ public List call() { } } - @Override - public List testPermissions( - String projectId, String firstPermission, String... otherPermissions) { - return testPermissions(projectId, Lists.asList(firstPermission, otherPermissions)); - } - private Map optionMap(Option... options) { Map temp = Maps.newEnumMap(ResourceManagerRpc.Option.class); for (Option option : options) { diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java index acce6f84c680..0f4c205dde17 100644 --- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java +++ b/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java @@ -240,14 +240,11 @@ public void testTestPermissions() { String getPermission = "resourcemanager.projects.get"; String deletePermission = "resourcemanager.projects.delete"; expect(resourceManager.options()).andReturn(mockOptions).times(1); - expect(resourceManager.testPermissions(PROJECT_ID, getPermission, deletePermission)) - .andReturn(response); expect(resourceManager.testPermissions( PROJECT_ID, ImmutableList.of(getPermission, deletePermission))) .andReturn(response); replay(resourceManager); initializeProject(); - assertEquals(response, project.testPermissions(getPermission, deletePermission)); assertEquals( response, project.testPermissions(ImmutableList.of(getPermission, deletePermission))); } diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java index 2525039e9c0d..7d52901aa372 100644 --- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java +++ b/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java @@ -381,12 +381,6 @@ public void testTestPermissions() { RESOURCE_MANAGER.create(PARTIAL_PROJECT); assertEquals(ImmutableList.of(true), RESOURCE_MANAGER.testPermissions(PARTIAL_PROJECT.projectId(), permissions)); - assertEquals( - ImmutableList.of(true, true), - RESOURCE_MANAGER.testPermissions( - PARTIAL_PROJECT.projectId(), - "resourcemanager.projects.delete", - "resourcemanager.projects.get")); } @Test