com.amazonaws.services.identitymanagement.model.DeleteUserRequest Java Examples

The following examples show how to use com.amazonaws.services.identitymanagement.model.DeleteUserRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IAMService.java    From Serverless-Programming-Cookbook with MIT License 6 votes vote down vote up
/**
 * Delete user.
 * @param userName - user name.
 * @return IAMOperationResponse
 */
public final IAMOperationResponse deleteUser(final String userName) {
    DeleteUserRequest request = new DeleteUserRequest()
            .withUserName(userName);

    try {
        iamClient.deleteUser(request);
    } catch (DeleteConflictException e) {
        return new IAMOperationResponse(null,
                "Unable to delete user");
    }

    return new IAMOperationResponse(
            "Deleted user " + userName,
            null);
}
 
Example #2
Source File: IAMServiceImpl.java    From Serverless-Programming-Cookbook with MIT License 6 votes vote down vote up
@Override
public final IAMOperationResponse deleteUser(final String userName) {
    DeleteUserRequest request = new DeleteUserRequest()
            .withUserName(userName);

    try {
        iamClient.deleteUser(request);
    } catch (DeleteConflictException e) {
        return new IAMOperationResponse(null,
                "Unable to delete user");
    }

    return new IAMOperationResponse(
            "Deleted user " + userName,
            null);
}
 
Example #3
Source File: DeleteUser.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a username\n" +
            "Ex: DeleteUser <username>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String username = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        DeleteUserRequest request = new DeleteUserRequest()
            .withUserName(username);

        try {
            iam.deleteUser(request);
        } catch (DeleteConflictException e) {
            System.out.println("Unable to delete user. Verify user is not" +
                    " associated with any resources");
            throw e;
        }

        System.out.println("Successfully deleted IAM user " + username);
    }
 
Example #4
Source File: UserImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void delete(DeleteUserRequest request) {
    delete(request, null);
}
 
Example #5
Source File: UserImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void delete(DeleteUserRequest request, ResultCapture<Void> extractor)
        {

    resource.performAction("Delete", request, extractor);
}
 
Example #6
Source File: UserImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void delete(ResultCapture<Void> extractor) {
    DeleteUserRequest request = new DeleteUserRequest();
    delete(request, extractor);
}
 
Example #7
Source File: User.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>Delete</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>User</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>UserName</code></b>
 *         - mapped from the <code>Name</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see DeleteUserRequest
 */
void delete(DeleteUserRequest request);
 
Example #8
Source File: User.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>Delete</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>User</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>UserName</code></b>
 *         - mapped from the <code>Name</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see DeleteUserRequest
 */
void delete(DeleteUserRequest request, ResultCapture<Void> extractor);