@Override public List<? extends Instance> getInstancesWithHealtcheckScheduledOnHost(long hostId) { return create() .select(INSTANCE.fields()) .from(INSTANCE) .join(HEALTHCHECK_INSTANCE) .on(HEALTHCHECK_INSTANCE.INSTANCE_ID.eq(INSTANCE.ID)) .join(HEALTHCHECK_INSTANCE_HOST_MAP) .on(HEALTHCHECK_INSTANCE_HOST_MAP.HEALTHCHECK_INSTANCE_ID.eq(HEALTHCHECK_INSTANCE.ID)) .where(HEALTHCHECK_INSTANCE_HOST_MAP.HOST_ID.eq(hostId)) .and(HEALTHCHECK_INSTANCE_HOST_MAP.REMOVED.isNull()) .and(HEALTHCHECK_INSTANCE.REMOVED.isNull()) .and(INSTANCE.REMOVED.isNull()) .fetchInto(InstanceRecord.class); }
@Override public List<? extends Instance> getInstancesWithHealtcheckEnabled(long accountId) { return create() .select(INSTANCE.fields()) .from(INSTANCE) .join(HEALTHCHECK_INSTANCE) .on(HEALTHCHECK_INSTANCE.INSTANCE_ID.eq(INSTANCE.ID)) .and(HEALTHCHECK_INSTANCE.REMOVED.isNull()) .and(INSTANCE.REMOVED.isNull()) .and( INSTANCE .STATE .in(InstanceConstants.STATE_STARTING, InstanceConstants.STATE_RUNNING) .and(INSTANCE.ACCOUNT_ID.eq(accountId))) .fetchInto(InstanceRecord.class); }