Skip to content

Commit 52bf6c1

Browse files
author
Ajay Kannan
committed
remove varargs for testPermissions and other minor fixes
1 parent 3a97ae1 commit 52bf6c1

File tree

6 files changed

+2
-63
lines changed

6 files changed

+2
-63
lines changed

gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class Policy extends IamPolicy<String> {
4747
/**
4848
* The project-level roles in an IAM policy. This enum is not an exhaustive list of all roles
4949
* you can use in an IAM policy. You can also use service-specific roles (e.g.
50-
* <i>roles/pubsub.editor</i>). See the <i>Supported Cloud Platform Services</i> page for links
50+
* "roles/pubsub.editor"). See the <i>Supported Cloud Platform Services</i> page for links
5151
* to service-specific roles.
5252
*
5353
* @see <a href="https://cloud.google.com/iam/#supported_cloud_platform_services">Supported Cloud
@@ -74,7 +74,7 @@ public enum ProjectRole {
7474
*/
7575
OWNER("roles/owner");
7676

77-
String value;
77+
private final String value;
7878

7979
private ProjectRole(String value) {
8080
this.value = value;

gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -251,29 +251,6 @@ List<Boolean> testPermissions(List<String> permissions) {
251251
return resourceManager.testPermissions(projectId(), permissions);
252252
}
253253

254-
/**
255-
* Returns the permissions that a caller has on this project. You typically don't call this method
256-
* if you're using Google Cloud Platform directly to manage permissions. This method is intended
257-
* for integration with your proprietary software, such as a customized graphical user interface.
258-
* For example, the Cloud Platform Console tests IAM permissions internally to determine which UI
259-
* should be available to the logged-in user. Each service that supports IAM lists the possible
260-
* permissions; see the <i>Supported Cloud Platform services</i> page below for links to these
261-
* lists.
262-
*
263-
* @return a list of booleans representing whether the caller has the permissions specified (in
264-
* the order of the given permissions)
265-
* @throws ResourceManagerException upon failure
266-
* @see <a href=
267-
* "https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/testIamPermissions">
268-
* Resource Manager testIamPermissions</a>
269-
* @see <a href=
270-
* "https://cloud.google.com/iam/#supported_cloud_platform_services">Supported Cloud Platform
271-
* Services</a>
272-
*/
273-
List<Boolean> testPermissions(String firstPermission, String... otherPermissions) {
274-
return resourceManager.testPermissions(projectId(), firstPermission, otherPermissions);
275-
}
276-
277254
@Override
278255
public Builder toBuilder() {
279256
return new Builder(this);

gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -341,26 +341,4 @@ public static ProjectListOption fields(ProjectField... fields) {
341341
* Services</a>
342342
*/
343343
List<Boolean> testPermissions(String projectId, List<String> permissions);
344-
345-
/**
346-
* Returns the permissions that a caller has on the specified project. You typically don't call
347-
* this method if you're using Google Cloud Platform directly to manage permissions. This method
348-
* is intended for integration with your proprietary software, such as a customized graphical user
349-
* interface. For example, the Cloud Platform Console tests IAM permissions internally to
350-
* determine which UI should be available to the logged-in user. Each service that supports IAM
351-
* lists the possible permissions; see the <i>Supported Cloud Platform services</i> page below for
352-
* links to these lists.
353-
*
354-
* @return A list of booleans representing whether the caller has the permissions specified (in
355-
* the order of the given permissions)
356-
* @throws ResourceManagerException upon failure
357-
* @see <a href=
358-
* "https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/testIamPermissions">
359-
* Resource Manager testIamPermissions</a>
360-
* @see <a href=
361-
* "https://cloud.google.com/iam/#supported_cloud_platform_services">Supported Cloud Platform
362-
* Services</a>
363-
*/
364-
List<Boolean> testPermissions(
365-
String projectId, String firstPermission, String... otherPermissions);
366344
}

gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.google.common.collect.ImmutableList;
2424
import com.google.common.collect.ImmutableMap;
2525
import com.google.common.collect.Iterables;
26-
import com.google.common.collect.Lists;
2726
import com.google.common.collect.Maps;
2827
import com.google.gcloud.BaseService;
2928
import com.google.gcloud.Page;
@@ -230,12 +229,6 @@ public List<Boolean> call() {
230229
}
231230
}
232231

233-
@Override
234-
public List<Boolean> testPermissions(
235-
String projectId, String firstPermission, String... otherPermissions) {
236-
return testPermissions(projectId, Lists.asList(firstPermission, otherPermissions));
237-
}
238-
239232
private Map<ResourceManagerRpc.Option, ?> optionMap(Option... options) {
240233
Map<ResourceManagerRpc.Option, Object> temp = Maps.newEnumMap(ResourceManagerRpc.Option.class);
241234
for (Option option : options) {

gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,11 @@ public void testTestPermissions() {
240240
String getPermission = "resourcemanager.projects.get";
241241
String deletePermission = "resourcemanager.projects.delete";
242242
expect(resourceManager.options()).andReturn(mockOptions).times(1);
243-
expect(resourceManager.testPermissions(PROJECT_ID, getPermission, deletePermission))
244-
.andReturn(response);
245243
expect(resourceManager.testPermissions(
246244
PROJECT_ID, ImmutableList.of(getPermission, deletePermission)))
247245
.andReturn(response);
248246
replay(resourceManager);
249247
initializeProject();
250-
assertEquals(response, project.testPermissions(getPermission, deletePermission));
251248
assertEquals(
252249
response, project.testPermissions(ImmutableList.of(getPermission, deletePermission)));
253250
}

gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,6 @@ public void testTestPermissions() {
381381
RESOURCE_MANAGER.create(PARTIAL_PROJECT);
382382
assertEquals(ImmutableList.of(true),
383383
RESOURCE_MANAGER.testPermissions(PARTIAL_PROJECT.projectId(), permissions));
384-
assertEquals(
385-
ImmutableList.of(true, true),
386-
RESOURCE_MANAGER.testPermissions(
387-
PARTIAL_PROJECT.projectId(),
388-
"resourcemanager.projects.delete",
389-
"resourcemanager.projects.get"));
390384
}
391385

392386
@Test

0 commit comments

Comments
 (0)