org.graylog2.telemetry.dto.NodeInfo Maven / Gradle / Ivy
package org.graylog2.telemetry.dto;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import org.hibernate.validator.constraints.NotEmpty;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import javax.validation.constraints.NotNull;
import java.util.Set;
@AutoValue
@JsonAutoDetect
public abstract class NodeInfo {
@JsonProperty
public abstract String nodeId();
@JsonProperty
public abstract String nodeIdHash();
@JsonProperty
public abstract NodeRole role();
@JsonProperty
public abstract String hostname();
@JsonProperty
public abstract String serverVersion();
@JsonProperty
public abstract DateTime startedAt();
@JsonProperty
public abstract DateTimeZone timezone();
@JsonProperty
public abstract Set plugins();
public static NodeInfo create(@NotEmpty String nodeId,
@NotEmpty String nodeIdHash,
@NotNull NodeRole role,
@NotEmpty final String hostname,
@NotEmpty final String serverVersion,
@NotNull final DateTime startedAt,
@NotNull final DateTimeZone timezone,
@NotNull final Set plugins) {
return new AutoValue_NodeInfo(nodeId, nodeIdHash, role, hostname, serverVersion, startedAt, timezone, plugins);
}
}