io.camunda.zeebe.management.cluster.BrokerState Maven / Gradle / Ivy
package io.camunda.zeebe.management.cluster;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.camunda.zeebe.management.cluster.BrokerStateCode;
import io.camunda.zeebe.management.cluster.PartitionState;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import jakarta.annotation.Generated;
/**
* State of a broker
*/
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
@Schema(name = "BrokerState", description = "State of a broker")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-10-02T11:21:27.419777225Z[GMT]", comments = "Generator version: 7.8.0")
public class BrokerState {
private Integer id;
private BrokerStateCode state;
private Long version;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
private OffsetDateTime lastUpdatedAt;
@Valid
private List<@Valid PartitionState> partitions = new ArrayList<>();
public BrokerState id(Integer id) {
this.id = id;
return this;
}
/**
* The ID of a broker, starting from 0
* @return id
*/
@Schema(name = "id", example = "0", description = "The ID of a broker, starting from 0", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("id")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BrokerState state(BrokerStateCode state) {
this.state = state;
return this;
}
/**
* Get state
* @return state
*/
@Valid
@Schema(name = "state", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("state")
public BrokerStateCode getState() {
return state;
}
public void setState(BrokerStateCode state) {
this.state = state;
}
public BrokerState version(Long version) {
this.version = version;
return this;
}
/**
* The version of the broker state
* @return version
*/
@Schema(name = "version", example = "1", description = "The version of the broker state", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("version")
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
public BrokerState lastUpdatedAt(OffsetDateTime lastUpdatedAt) {
this.lastUpdatedAt = lastUpdatedAt;
return this;
}
/**
* The time when the broker state was last updated
* @return lastUpdatedAt
*/
@Valid
@Schema(name = "lastUpdatedAt", example = "2020-01-01T00:00Z", description = "The time when the broker state was last updated", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("lastUpdatedAt")
public OffsetDateTime getLastUpdatedAt() {
return lastUpdatedAt;
}
public void setLastUpdatedAt(OffsetDateTime lastUpdatedAt) {
this.lastUpdatedAt = lastUpdatedAt;
}
public BrokerState partitions(List<@Valid PartitionState> partitions) {
this.partitions = partitions;
return this;
}
public BrokerState addPartitionsItem(PartitionState partitionsItem) {
if (this.partitions == null) {
this.partitions = new ArrayList<>();
}
this.partitions.add(partitionsItem);
return this;
}
/**
* Get partitions
* @return partitions
*/
@Valid
@Schema(name = "partitions", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("partitions")
public List<@Valid PartitionState> getPartitions() {
return partitions;
}
public void setPartitions(List<@Valid PartitionState> partitions) {
this.partitions = partitions;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BrokerState brokerState = (BrokerState) o;
return Objects.equals(this.id, brokerState.id) &&
Objects.equals(this.state, brokerState.state) &&
Objects.equals(this.version, brokerState.version) &&
Objects.equals(this.lastUpdatedAt, brokerState.lastUpdatedAt) &&
Objects.equals(this.partitions, brokerState.partitions);
}
@Override
public int hashCode() {
return Objects.hash(id, state, version, lastUpdatedAt, partitions);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BrokerState {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" state: ").append(toIndentedString(state)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" lastUpdatedAt: ").append(toIndentedString(lastUpdatedAt)).append("\n");
sb.append(" partitions: ").append(toIndentedString(partitions)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}