class AvailabilityZoneConstraint 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();
        String instanceAvailabilityZone = agentInstance.getAttributes().getOrDefault(configuration.getAvailabilityZoneAttributeName(), "");
        return instanceAvailabilityZone.equalsIgnoreCase(availabilityZone) ? VALID : AVAILABILITY_ZONE_DOES_NOT_MATCH;
    }

    public  AvailabilityZoneConstraint(SchedulerConfiguration configuration, AgentManagementService agentManagementService, String availabilityZone);

}