public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonLakeFormationConfig config = new AmazonLakeFormationConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonLakeFormationClient client = new AmazonLakeFormationClient(creds, config); ListPermissionsResponse resp = new ListPermissionsResponse(); do { ListPermissionsRequest req = new ListPermissionsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListPermissions(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.PrincipalResourcePermissions) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public async Task <IActionResult> GetRoleAsync([FromRoute] Guid id) { var requestRole = new GetRoleRequest { Id = id, }; var responseRole = await _authorizationClient.GetRoleAsync(requestRole); var requestPermissions = new ListPermissionsRequest(); var responsePermissions = await _authorizationClient.ListPermissionsAsync(requestPermissions); var result = new GetRoleOutput { Role = new RoleDetail { Id = responseRole.Id, Name = responseRole.Name, IsEnabled = responseRole.IsEnabled, PermissionIds = responseRole.PermissionIds .Select(x => (Guid)x) .ToList(), }, Permissions = responsePermissions.Items .Select(x => new NamedEntityResult { Id = x.Id, Name = x.Name }) .ToList(), }; return(Ok(result)); }
/// <summary> /// Returns a list of the principal permissions on the resource, filtered by the permissions /// of the caller. For example, if you are granted an ALTER permission, you are able to /// see only the principal permissions for ALTER. /// /// /// <para> /// This operation returns only those permissions that have been explicitly granted. /// </para> /// /// <para> /// For information about permissions, see <a href="https://docs-aws.amazon.com/lake-formation/latest/dg/security-data-access.html">Security /// and Access Control to Metadata and Data</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListPermissions service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the ListPermissions service method, as returned by LakeFormation.</returns> /// <exception cref="Amazon.LakeFormation.Model.InternalServiceException"> /// An internal service error occurred. /// </exception> /// <exception cref="Amazon.LakeFormation.Model.InvalidInputException"> /// The input provided was not valid. /// </exception> /// <exception cref="Amazon.LakeFormation.Model.OperationTimeoutException"> /// The operation timed out. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lakeformation-2017-03-31/ListPermissions">REST API Reference for ListPermissions Operation</seealso> public virtual Task <ListPermissionsResponse> ListPermissionsAsync(ListPermissionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListPermissionsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListPermissionsResponseUnmarshaller.Instance; return(InvokeAsync <ListPermissionsResponse>(request, options, cancellationToken)); }
internal virtual ListPermissionsResponse ListPermissions(ListPermissionsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListPermissionsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListPermissionsResponseUnmarshaller.Instance; return(Invoke <ListPermissionsResponse>(request, options)); }
public override async Task <ListNamedEntityResponse> ListPermissions(ListPermissionsRequest request, ServerCallContext context) { var permissions = await _authorizationApp.GetPermissionsAsync(); var items = permissions.Items.Select(x => new ListNamedEntityResponse.Types.NamedEntity { Id = x.Id, Name = x.Name, }); var result = new ListNamedEntityResponse(); result.Items.AddRange(items); return(result); }
public async Task <IActionResult> GetNewRoleAsync() { var requestPermissions = new ListPermissionsRequest(); var responsePermissions = await _authorizationClient.ListPermissionsAsync(requestPermissions); var result = new GetRoleOutput { Role = new RoleDetail { IsEnabled = true, }, Permissions = responsePermissions.Items .Select(x => new NamedEntityResult { Id = x.Id, Name = x.Name }) .ToList(), }; return(Ok(result)); }