All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.camunda.zeebe.management.backups.BackupInfo Maven / Gradle / Ivy

There is a newer version: 8.7.0-alpha1
Show newest version
package io.camunda.zeebe.management.backups;

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.backups.PartitionBackupInfo;
import io.camunda.zeebe.management.backups.StateCode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
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;

/**
 * Detailed status of a backup. The aggregated state is computed from the backup state of each partition as: - If the backup of all partitions is in state 'COMPLETED', then the overall state is 'COMPLETED'. - If one is 'FAILED', then the overall state is 'FAILED'. - Otherwise, if one is 'DOES_NOT_EXIST', then the overall state is 'INCOMPLETE'. - Otherwise, if one is 'IN_PROGRESS', then the overall state is 'IN_PROGRESS'. 
 */
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)

@Schema(name = "BackupInfo", description = "Detailed status of a backup. The aggregated state is computed from the backup state of each partition as: - If the backup of all partitions is in state 'COMPLETED', then the overall state is 'COMPLETED'. - If one is 'FAILED', then the overall state is 'FAILED'. - Otherwise, if one is 'DOES_NOT_EXIST', then the overall state is 'INCOMPLETE'. - Otherwise, if one is 'IN_PROGRESS', then the overall state is 'IN_PROGRESS'. ")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-09-24T12:12:46.611450107Z[GMT]", comments = "Generator version: 7.8.0")
public class BackupInfo {

  private Long backupId;

  private StateCode state;

  private String failureReason;

  @Valid
  private List<@Valid PartitionBackupInfo> details = new ArrayList<>();

  public BackupInfo() {
    super();
  }

  /**
   * Constructor with only required parameters
   */
  public BackupInfo(Long backupId, StateCode state, List<@Valid PartitionBackupInfo> details) {
    this.backupId = backupId;
    this.state = state;
    this.details = details;
  }

  public BackupInfo backupId(Long backupId) {
    this.backupId = backupId;
    return this;
  }

  /**
   * The ID of the backup. The ID of the backup must be a positive numerical value. As backups are logically ordered by their IDs (ascending), each successive backup must use a higher ID than the previous one. 
   * minimum: 0
   * @return backupId
   */
  @Min(0L) 
  @Schema(name = "backupId", accessMode = Schema.AccessMode.READ_ONLY, example = "1", description = "The ID of the backup. The ID of the backup must be a positive numerical value. As backups are logically ordered by their IDs (ascending), each successive backup must use a higher ID than the previous one. ", requiredMode = Schema.RequiredMode.REQUIRED)
  @JsonProperty("backupId")
  public Long getBackupId() {
    return backupId;
  }

  public void setBackupId(Long backupId) {
    this.backupId = backupId;
  }

  public BackupInfo state(StateCode state) {
    this.state = state;
    return this;
  }

  /**
   * Get state
   * @return state
   */
  @Valid 
  @Schema(name = "state", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.REQUIRED)
  @JsonProperty("state")
  public StateCode getState() {
    return state;
  }

  public void setState(StateCode state) {
    this.state = state;
  }

  public BackupInfo failureReason(String failureReason) {
    this.failureReason = failureReason;
    return this;
  }

  /**
   * Reason for failure if the state is 'FAILED'
   * @return failureReason
   */
  
  @Schema(name = "failureReason", example = "", description = "Reason for failure if the state is 'FAILED'", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
  @JsonProperty("failureReason")
  public String getFailureReason() {
    return failureReason;
  }

  public void setFailureReason(String failureReason) {
    this.failureReason = failureReason;
  }

  public BackupInfo details(List<@Valid PartitionBackupInfo> details) {
    this.details = details;
    return this;
  }

  public BackupInfo addDetailsItem(PartitionBackupInfo detailsItem) {
    if (this.details == null) {
      this.details = new ArrayList<>();
    }
    this.details.add(detailsItem);
    return this;
  }

  /**
   * Detailed list of the status of the backup per partition. It should always contain all partitions known to the cluster. 
   * @return details
   */
  @Valid 
  @Schema(name = "details", accessMode = Schema.AccessMode.READ_ONLY, description = "Detailed list of the status of the backup per partition. It should always contain all partitions known to the cluster. ", requiredMode = Schema.RequiredMode.REQUIRED)
  @JsonProperty("details")
  public List<@Valid PartitionBackupInfo> getDetails() {
    return details;
  }

  public void setDetails(List<@Valid PartitionBackupInfo> details) {
    this.details = details;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    BackupInfo backupInfo = (BackupInfo) o;
    return Objects.equals(this.backupId, backupInfo.backupId) &&
        Objects.equals(this.state, backupInfo.state) &&
        Objects.equals(this.failureReason, backupInfo.failureReason) &&
        Objects.equals(this.details, backupInfo.details);
  }

  @Override
  public int hashCode() {
    return Objects.hash(backupId, state, failureReason, details);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class BackupInfo {\n");
    sb.append("    backupId: ").append(toIndentedString(backupId)).append("\n");
    sb.append("    state: ").append(toIndentedString(state)).append("\n");
    sb.append("    failureReason: ").append(toIndentedString(failureReason)).append("\n");
    sb.append("    details: ").append(toIndentedString(details)).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    ");
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy