using System;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Iam.v1;
using Google.Apis.Iam.v1.Data;
public partial class CustomRoles
{
public static Role GetRole(string name)
{
var credential = GoogleCredential.GetApplicationDefault()
.CreateScoped(IamService.Scope.CloudPlatform);
var service = new IamService(new IamService.Initializer
{
HttpClientInitializer = credential
});
var role = service.Roles.Get(name).Execute();
Console.WriteLine(role.Name);
Console.WriteLine(String.Join(", ", role.IncludedPermissions));
return role;
}
}
def get_role(name):
"""Gets a role."""
# pylint: disable=no-member
role = service.roles().get(name=name).execute()
print(role['name'])
for permission in role['includedPermissions']:
print(permission)