class MachineIdConstraint implements ConstraintEvaluator {

    @Override
    public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) {
        Optional<AgentInstance> instanceOpt = SchedulerUtils.findInstance(agentManagementService, configuration.getInstanceAttributeName(), targetVM);
        if (!instanceOpt.isPresent()) {
            return MACHINE_DOES_NOT_EXIST;
        }

        AgentInstance agentInstance = instanceOpt.get();
        return agentInstance.getId().equalsIgnoreCase(machineId) ? VALID : MACHINE_ID_DOES_NOT_MATCH;
    }

    public  MachineIdConstraint(SchedulerConfiguration configuration, AgentManagementService agentManagementService, String machineId);

}