Amazon.IdentityManagement.AmazonIdentityManagementServiceClient.ListRolesAsync C# (CSharp) Method

ListRolesAsync() public method

Initiates the asynchronous execution of the ListRoles operation.
public ListRolesAsync ( ListRolesRequest request, System cancellationToken = default(CancellationToken) ) : Task
request ListRolesRequest Container for the necessary parameters to execute the ListRoles operation.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
return Task
        public Task<ListRolesResponse> ListRolesAsync(ListRolesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ListRolesRequestMarshaller();
            var unmarshaller = ListRolesResponseUnmarshaller.Instance;

            return InvokeAsync<ListRolesRequest,ListRolesResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }

Same methods

AmazonIdentityManagementServiceClient::ListRolesAsync ( System cancellationToken = default(CancellationToken) ) : Task
AmazonIdentityManagementServiceClient::ListRolesAsync ( ListRolesResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
AmazonIdentityManagementServiceClient::ListRolesAsync ( ListRolesRequest request, ListRolesResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void

Usage Example

 private async Task<bool> RoleAlreadyExistsAsync()
 {
     using (
         var iamClient = new AmazonIdentityManagementServiceClient(credentials,
             configurationProvider.RegionEndpoint))
     {
         var listRolesResponse = await iamClient.ListRolesAsync();
         return listRolesResponse.Roles
             .Any(r => string.Equals(r.RoleName, configurationProvider.ShortApplicationName,
                 StringComparison.CurrentCultureIgnoreCase));
     }
 }
AmazonIdentityManagementServiceClient