Search in sources :

Example 1 with InstanceEntity

use of io.gravitee.rest.api.model.InstanceEntity in project gravitee-management-rest-api by gravitee-io.

the class HealthCheckServiceImpl method getGatewayMetadata.

private Map<String, String> getGatewayMetadata(String gateway) {
    Map<String, String> metadata = new HashMap<>();
    try {
        InstanceEntity instance = instanceService.findById(gateway);
        metadata.put("hostname", instance.getHostname());
        metadata.put("ip", instance.getIp());
        if (instance.getTenant() != null) {
            metadata.put("tenant", instance.getTenant());
        }
    } catch (InstanceNotFoundException infe) {
        metadata.put("deleted", "true");
    }
    return metadata;
}
Also used : InstanceNotFoundException(io.gravitee.rest.api.service.exceptions.InstanceNotFoundException) InstanceEntity(io.gravitee.rest.api.model.InstanceEntity)

Aggregations

InstanceEntity (io.gravitee.rest.api.model.InstanceEntity)1 InstanceNotFoundException (io.gravitee.rest.api.service.exceptions.InstanceNotFoundException)1