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

DeleteGroup() public method

Deletes the specified IAM group. The group must not contain any users or have any attached policies.
/// The request was rejected because it attempted to delete a resource that has attached /// subordinate entities. The error message describes these entities. /// /// The request was rejected because it attempted to create resources beyond the current /// AWS account limits. The error message describes the limit exceeded. /// /// The request was rejected because it referenced an entity that does not exist. The /// error message describes the entity. /// /// The request processing has failed because of an unknown error, exception or failure. ///
public DeleteGroup ( DeleteGroupRequest request ) : Amazon.IdentityManagement.Model.DeleteGroupResponse
request Amazon.IdentityManagement.Model.DeleteGroupRequest Container for the necessary parameters to execute the DeleteGroup service method.
return Amazon.IdentityManagement.Model.DeleteGroupResponse
        public DeleteGroupResponse DeleteGroup(DeleteGroupRequest request)
        {
            var marshaller = new DeleteGroupRequestMarshaller();
            var unmarshaller = DeleteGroupResponseUnmarshaller.Instance;

            return Invoke<DeleteGroupRequest,DeleteGroupResponse>(request, marshaller, unmarshaller);
        }

Usage Example

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

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