Search in sources :

Example 1 with DeleteUserRequest

use of software.amazon.awssdk.services.iam.model.DeleteUserRequest in project aws-doc-sdk-examples by awsdocs.

the class DeleteUser method deleteIAMUser.

// snippet-start:[iam.java2.delete_user.main]
public static void deleteIAMUser(IamClient iam, String userName) {
    try {
        DeleteUserRequest request = DeleteUserRequest.builder().userName(userName).build();
        iam.deleteUser(request);
        System.out.println("Successfully deleted IAM user " + userName);
    } catch (IamException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : DeleteUserRequest(software.amazon.awssdk.services.iam.model.DeleteUserRequest) IamException(software.amazon.awssdk.services.iam.model.IamException)

Aggregations

DeleteUserRequest (software.amazon.awssdk.services.iam.model.DeleteUserRequest)1 IamException (software.amazon.awssdk.services.iam.model.IamException)1