Search in sources :

Example 1 with UpdateUserRequest

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);
    }
}
Also used : IamException(software.amazon.awssdk.services.iam.model.IamException) UpdateUserRequest(software.amazon.awssdk.services.iam.model.UpdateUserRequest)

Aggregations

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