GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Could not get list of permissions from pre-defined roles using IAM API · Issue #2874 · googleapis/google-cloud-java

Could not get list of permissions from pre-defined roles using IAM API  #2874

New issue
Copy link
New issue
Copy link
Closed
Closed
Could not get list of permissions from pre-defined roles using IAM API #2874
Copy link
Assignees
ihsanhaikalz

Description

@ihsanhaikalz
ihsanhaikalz
opened on Feb 7, 2018
Issue body actions

I am not sure if this issue should be put in this repo but I could not find the correct responding github for IAM API.

So I was using google-api-services-iam library ver v1-rev231-1.23.0 and I would like to get list of permissions from certain roles using code like this:

public static List<String> getPermissionsFromRole(Iam iam, String projectName, String roleName) throws IOException{
		Role d = iam.projects().roles().get(roleName).execute();
		return d.getIncludedPermissions();
	}

So it works for custom role with the format like projects/projectName/roles/SecurityReviewer but when I try to use pre-defined role like roles/storage.legacyBucketOwnerthen it gave error like

Exception in thread "main" java.lang.IllegalArgumentException: Parameter name must conform to the pattern ^projects/[^/]+/roles/[^/]+$
	at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:125)
	at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:49)
	at com.google.api.services.iam.v1.Iam$Projects$Roles$Get.<init>(Iam.java:1899)
	at com.google.api.services.iam.v1.Iam$Projects$Roles.get(Iam.java:1867)
	at gcp.GoogleIAM.getPermissionsFromRole(GoogleIAM.java:291)
	at gcp.GoogleIAM.main(GoogleIAM.java:90)

Obviously using pre-defined roles with format projects/projectName/roles/storage.legacyBucketOwner will give error like

Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "message" : "The role named projects/testing-123-ok/roles/storage.legacyBucketOwner was not found.",
    "reason" : "notFound"
  } ],
  "message" : "The role named projects/testing-123-ok/roles/storage.legacyBucketOwner was not found.",
  "status" : "NOT_FOUND"
}
	at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
	at gcp.GoogleIAM.getPermissionsFromRole(GoogleIAM.java:291)
	at gcp.GoogleIAM.main(GoogleIAM.java:90)

Do you know the fix to this issue?

Activity

  1. ihsanhaikalz
    closed this as completedon Feb 7, 2018
  2. JustinBeckwith
    assigned
    ihsanhaikalz
    on Feb 1, 2021
  3. chingor13
    added a commit that references this issue on Feb 20, 2026

    deps: update dependency com.google.http-client:google-http-client to …

    4ba9010
  4. suztomo
    added a commit that references this issue on Mar 9, 2026

    deps: update dependency com.google.cloud:google-cloud-datacatalog-bom…

    6cafedf
  5. lqiu96
    added a commit that references this issue on Mar 20, 2026

    deps: update dependency com.google.http-client:google-http-client to …

    659762a
  6. chingor13
    added 2 commits that reference this issue on Mar 24, 2026

    fix: Move the logic of getting systemProductName from static block to…

    cf67770

    chore(main): release 2.42.0 (#2847)

    c85602b
  7. rahul2393
    added a commit that references this issue on May 21, 2026

    chore(main): release 2.77.1-SNAPSHOT (googleapis#2874)

    4741eeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ihsanhaikalz
    ihsanhaikalz

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.