I am using Python code to get the permissions present in custom IAM role. Even though, I pass the parameter as per the documentation https://cloud.google.com/iam/docs/creating-custom-roles#iam-custom-roles-get-metadata-python. It is throwing me the below error. role['name']
assumes the role id from the IAM role. I am not able to figure it out from the Google docs. Any help would be appreciated.
TypeError: Parameter "name" value "projects/my-new-project-273607/roles/CustomRole" does not match the pattern "^roles/[^/]+$"
roles = service.roles().list(parent='projects/' + 'my-new-project-273607').execute()['roles']
print('Name: ' + roles['name'])
role = service.roles().get(name=roles['name']).execute()
for permission in role['includedPermissions']:
print(permission)
print('permissions:' + role['includedPermissions'])
role['name']
here? The example in the docs tells you to callservice.roles().get(name=name).execute()
. Have you tried doing that? - Dustin Ingram