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);
}
}
Aggregations