use of software.amazon.awssdk.services.iam.model.UpdateUserRequest in project aws-doc-sdk-examples by awsdocs.
the class UpdateUser method updateIAMUser.
// snippet-start:[iam.java2.update_user.main]
public static void updateIAMUser(IamClient iam, String curName, String newName) {
try {
UpdateUserRequest request = UpdateUserRequest.builder().userName(curName).newUserName(newName).build();
iam.updateUser(request);
System.out.printf("Successfully updated user to username %s", newName);
} catch (IamException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations