I am using python code to get the permissions present in my 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 "roles/projects/my-new-project-273607/roles/CustomRole" does not match the pattern "^roles/[^/]+$"
role = service.roles().get(name='roles/' + role['name']).execute()
for permission in role['includedPermissions']:
print(permission)
print('permissions:' + role['includedPermissions'])