Amazon.IdentityManagement.AmazonIdentityManagementServiceClient.ListUserPoliciesAsync C# (CSharp) Méthode

ListUserPoliciesAsync() public méthode

Initiates the asynchronous execution of the ListUserPolicies operation.
public ListUserPoliciesAsync ( ListUserPoliciesRequest request, ListUserPoliciesResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
request ListUserPoliciesRequest Container for the necessary parameters to execute the ListUserPolicies operation on AmazonIdentityManagementServiceClient.
callback ListUserPoliciesResponse>.AmazonServiceCallback An Action delegate that is invoked when the operation completes.
options AsyncOptions A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.
Résultat void
        public void ListUserPoliciesAsync(ListUserPoliciesRequest request, AmazonServiceCallback<ListUserPoliciesRequest, ListUserPoliciesResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller = new ListUserPoliciesRequestMarshaller();
            var unmarshaller = ListUserPoliciesResponseUnmarshaller.Instance;
            Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
            if(callback !=null )
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
                    AmazonServiceResult<ListUserPoliciesRequest,ListUserPoliciesResponse> responseObject 
                            = new AmazonServiceResult<ListUserPoliciesRequest,ListUserPoliciesResponse>((ListUserPoliciesRequest)req, (ListUserPoliciesResponse)res, ex , ao.State);    
                        callback(responseObject); 
                };
            BeginInvoke<ListUserPoliciesRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }

Same methods

AmazonIdentityManagementServiceClient::ListUserPoliciesAsync ( ListUserPoliciesRequest request, System cancellationToken = default(CancellationToken) ) : Task

Usage Example

Exemple #1
0
 public static void DeleteUserPoliciesForUser(AmazonIdentityManagementServiceClient client, string username)
 {
     ListUserPoliciesResponse response =
         client.ListUserPoliciesAsync(new ListUserPoliciesRequest() { UserName = username }).Result;
     foreach (string pName in response.PolicyNames)
     {
         client.DeleteUserPolicyAsync(new DeleteUserPolicyRequest() { UserName = username, PolicyName = pName }).Wait();
     }
 }
AmazonIdentityManagementServiceClient