io.quarkus.eureka.operation.query.InstanceResult Maven / Gradle / Ivy
/*
* Copyright 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.quarkus.eureka.operation.query;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.eureka.client.Status;
import static io.quarkus.eureka.client.Status.UNKNOWN;
import static io.quarkus.eureka.client.Status.UP;
@JsonIgnoreProperties(ignoreUnknown = true)
public class InstanceResult extends QueryResponse {
private final String instanceId;
private final String hostName;
private final String app;
private final String homePageUrl;
private final String ipAddr;
private final Status status;
private final Map metadata;
@JsonCreator
public InstanceResult(@JsonProperty("hostName") final String hostName,
@JsonProperty("instanceId") final String instanceId,
@JsonProperty("app") String app,
@JsonProperty("homePageUrl") String homePageUrl,
@JsonProperty("ipAddr") String ipAddr,
@JsonProperty("status") Status status,
@JsonProperty("metadata") Map metadata) {
this.instanceId = instanceId;
this.hostName = hostName;
this.app = app;
this.ipAddr = ipAddr;
this.status = status;
this.homePageUrl = homePageUrl;
this.metadata = metadata;
}
private InstanceResult(final Status status) {
this(null, null, null, null, null, status, Map.of());
}
public static InstanceResult error() {
return new InstanceResult(UNKNOWN);
}
public Status getStatus() {
return this.status;
}
@Override
boolean success() {
return UP.equals(this.getStatus());
}
@Override
InstanceResult entity() {
return this;
}
public String getHostName() {
return hostName;
}
public String getHomePageUrl() {
return homePageUrl;
}
public String getApp() {
return app;
}
public String getIpAddr() {
return ipAddr;
}
public Map getMetadata() {
return metadata;
}
public String getInstanceId() {
return instanceId;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy