class AwsIamService {

    public Role getRole(AmazonIdentityManagement iam, String roleArn,
            ValidationResultBuilder validationResultBuilder) {
        Role role = null;
        if (roleArn != null && roleArn.contains("/")) {
            String roleName = roleArn.split("/", 2)[1];
            GetRoleRequest roleRequest = new GetRoleRequest().withRoleName(roleName);
            try {
                role = iam.getRole(roleRequest).getRole();
            } catch (NoSuchEntityException | ServiceFailureException e) {
                String msg = String.format("Role (%s) doesn't exist.", roleArn);
                LOGGER.debug(msg, e);
                validationResultBuilder.error(msg);
            }
        }
        return role;
    }

}