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

GetGroupAsync() public method

Initiates the asynchronous execution of the GetGroup operation.
public GetGroupAsync ( GetGroupRequest request, GetGroupResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
request GetGroupRequest Container for the necessary parameters to execute the GetGroup operation on AmazonIdentityManagementServiceClient.
callback GetGroupResponse>.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.
return void
        public void GetGroupAsync(GetGroupRequest request, AmazonServiceCallback<GetGroupRequest, GetGroupResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller = new GetGroupRequestMarshaller();
            var unmarshaller = GetGroupResponseUnmarshaller.Instance;
            Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
            if(callback !=null )
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
                    AmazonServiceResult<GetGroupRequest,GetGroupResponse> responseObject 
                            = new AmazonServiceResult<GetGroupRequest,GetGroupResponse>((GetGroupRequest)req, (GetGroupResponse)res, ex , ao.State);    
                        callback(responseObject); 
                };
            BeginInvoke<GetGroupRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }

Same methods

AmazonIdentityManagementServiceClient::GetGroupAsync ( GetGroupRequest request, System cancellationToken = default(CancellationToken) ) : Task

Usage Example

示例#1
0
        public static void DeleteUsersAndGroupsInTestNameSpace(AmazonIdentityManagementServiceClient client)
        {
            ListGroupsResponse lgRes = client.ListGroupsAsync(new ListGroupsRequest() { PathPrefix = TEST_PATH }).Result;
            foreach (Group g in lgRes.Groups)
            {
                GetGroupResponse ggRes = client.GetGroupAsync(new GetGroupRequest() { GroupName = g.GroupName }).Result;
                foreach (User u in ggRes.Users)
                {
                    client.RemoveUserFromGroupAsync(new RemoveUserFromGroupRequest() { GroupName = g.GroupName, UserName = u.UserName }).Wait();
                }
                client.DeleteGroupAsync(new DeleteGroupRequest() { GroupName = g.GroupName }).Wait();
            }

            ListUsersResponse luRes = client.ListUsersAsync(new ListUsersRequest() { PathPrefix = TEST_PATH }).Result;
            foreach (User u in luRes.Users)
            {
                DeleteTestUsers(client, u.UserName);
            }
        }
AmazonIdentityManagementServiceClient