// [START iam_query_testable_permissions] public static IList <Permission> QueryTestablePermissions( string resource) { var request = new QueryTestablePermissionsRequest { FullResourceName = resource }; var permissions = s_service.Permissions.QueryTestablePermissions( request).Execute().Permissions; foreach (var p in permissions) { Console.WriteLine(p.Name); } return(permissions); }
public static IList <Permission> QueryTestablePermissions( string fullResourceName) { var credential = GoogleCredential.GetApplicationDefault() .CreateScoped(IamService.Scope.CloudPlatform); var service = new IamService(new IamService.Initializer { HttpClientInitializer = credential }); var request = new QueryTestablePermissionsRequest { FullResourceName = fullResourceName }; var response = service.Permissions.QueryTestablePermissions(request) .Execute(); foreach (var p in response.Permissions) { Console.WriteLine(p.Name); } return(response.Permissions); }
/// <summary> /// Lists the permissions testable on a resource.A permission is testable if it can be tested for an identity on a resource. /// Documentation https://developers.google.com/iam/v1/reference/permissions/queryTestablePermissions /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Iam service.</param> /// <param name="body">A valid Iam v1 body.</param> /// <returns>QueryTestablePermissionsResponseResponse</returns> public static QueryTestablePermissionsResponse QueryTestablePermissions(IamService service, QueryTestablePermissionsRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Make the request. return(service.Permissions.QueryTestablePermissions(body).Execute()); } catch (Exception ex) { throw new Exception("Request Permissions.QueryTestablePermissions failed.", ex); } }