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

com.spotify.autoscaler.db.BigtableClusterBuilder Maven / Gradle / Ivy

package com.spotify.autoscaler.db;

import io.norberg.automatter.AutoMatter;
import java.time.Instant;
import java.util.Optional;
import javax.annotation.processing.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class BigtableClusterBuilder {
  private String projectId;

  private String instanceId;

  private String clusterId;

  private int minNodes;

  private int maxNodes;

  private double cpuTarget;

  private double storageTarget;

  private Optional lastChange;

  private Optional lastCheck;

  private boolean enabled;

  private Optional overloadStep;

  private Optional lastFailure;

  private Optional lastFailureMessage;

  private int consecutiveFailureCount;

  private int minNodesOverride;

  private Optional errorCode;

  private Optional extraEnabledAlgorithms;

  public BigtableClusterBuilder() {
    this.lastChange = Optional.empty();
    this.lastCheck = Optional.empty();
    this.overloadStep = Optional.empty();
    this.lastFailure = Optional.empty();
    this.lastFailureMessage = Optional.empty();
    this.errorCode = Optional.empty();
    this.extraEnabledAlgorithms = Optional.empty();
  }

  private BigtableClusterBuilder(BigtableCluster v) {
    this.projectId = v.projectId();
    this.instanceId = v.instanceId();
    this.clusterId = v.clusterId();
    this.minNodes = v.minNodes();
    this.maxNodes = v.maxNodes();
    this.cpuTarget = v.cpuTarget();
    this.storageTarget = v.storageTarget();
    this.lastChange = v.lastChange();
    this.lastCheck = v.lastCheck();
    this.enabled = v.enabled();
    this.overloadStep = v.overloadStep();
    this.lastFailure = v.lastFailure();
    this.lastFailureMessage = v.lastFailureMessage();
    this.consecutiveFailureCount = v.consecutiveFailureCount();
    this.minNodesOverride = v.minNodesOverride();
    this.errorCode = v.errorCode();
    this.extraEnabledAlgorithms = v.extraEnabledAlgorithms();
  }

  private BigtableClusterBuilder(BigtableClusterBuilder v) {
    this.projectId = v.projectId;
    this.instanceId = v.instanceId;
    this.clusterId = v.clusterId;
    this.minNodes = v.minNodes;
    this.maxNodes = v.maxNodes;
    this.cpuTarget = v.cpuTarget;
    this.storageTarget = v.storageTarget;
    this.lastChange = v.lastChange;
    this.lastCheck = v.lastCheck;
    this.enabled = v.enabled;
    this.overloadStep = v.overloadStep;
    this.lastFailure = v.lastFailure;
    this.lastFailureMessage = v.lastFailureMessage;
    this.consecutiveFailureCount = v.consecutiveFailureCount;
    this.minNodesOverride = v.minNodesOverride;
    this.errorCode = v.errorCode;
    this.extraEnabledAlgorithms = v.extraEnabledAlgorithms;
  }

  public String projectId() {
    return projectId;
  }

  public BigtableClusterBuilder projectId(String projectId) {
    if (projectId == null) {
      throw new NullPointerException("projectId");
    }
    this.projectId = projectId;
    return this;
  }

  public String instanceId() {
    return instanceId;
  }

  public BigtableClusterBuilder instanceId(String instanceId) {
    if (instanceId == null) {
      throw new NullPointerException("instanceId");
    }
    this.instanceId = instanceId;
    return this;
  }

  public String clusterId() {
    return clusterId;
  }

  public BigtableClusterBuilder clusterId(String clusterId) {
    if (clusterId == null) {
      throw new NullPointerException("clusterId");
    }
    this.clusterId = clusterId;
    return this;
  }

  public int minNodes() {
    return minNodes;
  }

  public BigtableClusterBuilder minNodes(int minNodes) {
    this.minNodes = minNodes;
    return this;
  }

  public int maxNodes() {
    return maxNodes;
  }

  public BigtableClusterBuilder maxNodes(int maxNodes) {
    this.maxNodes = maxNodes;
    return this;
  }

  public double cpuTarget() {
    return cpuTarget;
  }

  public BigtableClusterBuilder cpuTarget(double cpuTarget) {
    this.cpuTarget = cpuTarget;
    return this;
  }

  public double storageTarget() {
    return storageTarget;
  }

  public BigtableClusterBuilder storageTarget(double storageTarget) {
    this.storageTarget = storageTarget;
    return this;
  }

  public Optional lastChange() {
    return lastChange;
  }

  public BigtableClusterBuilder lastChange(Instant lastChange) {
    return lastChange(Optional.ofNullable(lastChange));
  }

  @SuppressWarnings("unchecked")
  public BigtableClusterBuilder lastChange(Optional lastChange) {
    if (lastChange == null) {
      throw new NullPointerException("lastChange");
    }
    this.lastChange = (Optional)lastChange;
    return this;
  }

  public Optional lastCheck() {
    return lastCheck;
  }

  public BigtableClusterBuilder lastCheck(Instant lastCheck) {
    return lastCheck(Optional.ofNullable(lastCheck));
  }

  @SuppressWarnings("unchecked")
  public BigtableClusterBuilder lastCheck(Optional lastCheck) {
    if (lastCheck == null) {
      throw new NullPointerException("lastCheck");
    }
    this.lastCheck = (Optional)lastCheck;
    return this;
  }

  public boolean enabled() {
    return enabled;
  }

  public BigtableClusterBuilder enabled(boolean enabled) {
    this.enabled = enabled;
    return this;
  }

  public Optional overloadStep() {
    return overloadStep;
  }

  public BigtableClusterBuilder overloadStep(Integer overloadStep) {
    return overloadStep(Optional.ofNullable(overloadStep));
  }

  @SuppressWarnings("unchecked")
  public BigtableClusterBuilder overloadStep(Optional overloadStep) {
    if (overloadStep == null) {
      throw new NullPointerException("overloadStep");
    }
    this.overloadStep = (Optional)overloadStep;
    return this;
  }

  public Optional lastFailure() {
    return lastFailure;
  }

  public BigtableClusterBuilder lastFailure(Instant lastFailure) {
    return lastFailure(Optional.ofNullable(lastFailure));
  }

  @SuppressWarnings("unchecked")
  public BigtableClusterBuilder lastFailure(Optional lastFailure) {
    if (lastFailure == null) {
      throw new NullPointerException("lastFailure");
    }
    this.lastFailure = (Optional)lastFailure;
    return this;
  }

  public Optional lastFailureMessage() {
    return lastFailureMessage;
  }

  public BigtableClusterBuilder lastFailureMessage(String lastFailureMessage) {
    return lastFailureMessage(Optional.ofNullable(lastFailureMessage));
  }

  @SuppressWarnings("unchecked")
  public BigtableClusterBuilder lastFailureMessage(Optional lastFailureMessage) {
    if (lastFailureMessage == null) {
      throw new NullPointerException("lastFailureMessage");
    }
    this.lastFailureMessage = (Optional)lastFailureMessage;
    return this;
  }

  public int consecutiveFailureCount() {
    return consecutiveFailureCount;
  }

  public BigtableClusterBuilder consecutiveFailureCount(int consecutiveFailureCount) {
    this.consecutiveFailureCount = consecutiveFailureCount;
    return this;
  }

  public int minNodesOverride() {
    return minNodesOverride;
  }

  public BigtableClusterBuilder minNodesOverride(int minNodesOverride) {
    this.minNodesOverride = minNodesOverride;
    return this;
  }

  public Optional errorCode() {
    return errorCode;
  }

  public BigtableClusterBuilder errorCode(ErrorCode errorCode) {
    return errorCode(Optional.ofNullable(errorCode));
  }

  @SuppressWarnings("unchecked")
  public BigtableClusterBuilder errorCode(Optional errorCode) {
    if (errorCode == null) {
      throw new NullPointerException("errorCode");
    }
    this.errorCode = (Optional)errorCode;
    return this;
  }

  public Optional extraEnabledAlgorithms() {
    return extraEnabledAlgorithms;
  }

  public BigtableClusterBuilder extraEnabledAlgorithms(String extraEnabledAlgorithms) {
    return extraEnabledAlgorithms(Optional.ofNullable(extraEnabledAlgorithms));
  }

  @SuppressWarnings("unchecked")
  public BigtableClusterBuilder extraEnabledAlgorithms(
      Optional extraEnabledAlgorithms) {
    if (extraEnabledAlgorithms == null) {
      throw new NullPointerException("extraEnabledAlgorithms");
    }
    this.extraEnabledAlgorithms = (Optional)extraEnabledAlgorithms;
    return this;
  }

  public BigtableCluster build() {
    return new Value(projectId, instanceId, clusterId, minNodes, maxNodes, cpuTarget, storageTarget, lastChange, lastCheck, enabled, overloadStep, lastFailure, lastFailureMessage, consecutiveFailureCount, minNodesOverride, errorCode, extraEnabledAlgorithms);
  }

  public static BigtableClusterBuilder from(BigtableCluster v) {
    return new BigtableClusterBuilder(v);
  }

  public static BigtableClusterBuilder from(BigtableClusterBuilder v) {
    return new BigtableClusterBuilder(v);
  }

  private static final class Value implements BigtableCluster {
    private final String projectId;

    private final String instanceId;

    private final String clusterId;

    private final int minNodes;

    private final int maxNodes;

    private final double cpuTarget;

    private final double storageTarget;

    private final Optional lastChange;

    private final Optional lastCheck;

    private final boolean enabled;

    private final Optional overloadStep;

    private final Optional lastFailure;

    private final Optional lastFailureMessage;

    private final int consecutiveFailureCount;

    private final int minNodesOverride;

    private final Optional errorCode;

    private final Optional extraEnabledAlgorithms;

    private Value(@AutoMatter.Field("projectId") String projectId,
        @AutoMatter.Field("instanceId") String instanceId,
        @AutoMatter.Field("clusterId") String clusterId, @AutoMatter.Field("minNodes") int minNodes,
        @AutoMatter.Field("maxNodes") int maxNodes, @AutoMatter.Field("cpuTarget") double cpuTarget,
        @AutoMatter.Field("storageTarget") double storageTarget,
        @AutoMatter.Field("lastChange") Optional lastChange,
        @AutoMatter.Field("lastCheck") Optional lastCheck,
        @AutoMatter.Field("enabled") boolean enabled,
        @AutoMatter.Field("overloadStep") Optional overloadStep,
        @AutoMatter.Field("lastFailure") Optional lastFailure,
        @AutoMatter.Field("lastFailureMessage") Optional lastFailureMessage,
        @AutoMatter.Field("consecutiveFailureCount") int consecutiveFailureCount,
        @AutoMatter.Field("minNodesOverride") int minNodesOverride,
        @AutoMatter.Field("errorCode") Optional errorCode,
        @AutoMatter.Field("extraEnabledAlgorithms") Optional extraEnabledAlgorithms) {
      if (projectId == null) {
        throw new NullPointerException("projectId");
      }
      if (instanceId == null) {
        throw new NullPointerException("instanceId");
      }
      if (clusterId == null) {
        throw new NullPointerException("clusterId");
      }
      if (lastChange == null) {
        throw new NullPointerException("lastChange");
      }
      if (lastCheck == null) {
        throw new NullPointerException("lastCheck");
      }
      if (overloadStep == null) {
        throw new NullPointerException("overloadStep");
      }
      if (lastFailure == null) {
        throw new NullPointerException("lastFailure");
      }
      if (lastFailureMessage == null) {
        throw new NullPointerException("lastFailureMessage");
      }
      if (errorCode == null) {
        throw new NullPointerException("errorCode");
      }
      if (extraEnabledAlgorithms == null) {
        throw new NullPointerException("extraEnabledAlgorithms");
      }
      this.projectId = projectId;
      this.instanceId = instanceId;
      this.clusterId = clusterId;
      this.minNodes = minNodes;
      this.maxNodes = maxNodes;
      this.cpuTarget = cpuTarget;
      this.storageTarget = storageTarget;
      this.lastChange = lastChange;
      this.lastCheck = lastCheck;
      this.enabled = enabled;
      this.overloadStep = overloadStep;
      this.lastFailure = lastFailure;
      this.lastFailureMessage = lastFailureMessage;
      this.consecutiveFailureCount = consecutiveFailureCount;
      this.minNodesOverride = minNodesOverride;
      this.errorCode = errorCode;
      this.extraEnabledAlgorithms = extraEnabledAlgorithms;
    }

    @AutoMatter.Field
    @Override
    public String projectId() {
      return projectId;
    }

    @AutoMatter.Field
    @Override
    public String instanceId() {
      return instanceId;
    }

    @AutoMatter.Field
    @Override
    public String clusterId() {
      return clusterId;
    }

    @AutoMatter.Field
    @Override
    public int minNodes() {
      return minNodes;
    }

    @AutoMatter.Field
    @Override
    public int maxNodes() {
      return maxNodes;
    }

    @AutoMatter.Field
    @Override
    public double cpuTarget() {
      return cpuTarget;
    }

    @AutoMatter.Field
    @Override
    public double storageTarget() {
      return storageTarget;
    }

    @AutoMatter.Field
    @Override
    public Optional lastChange() {
      return lastChange;
    }

    @AutoMatter.Field
    @Override
    public Optional lastCheck() {
      return lastCheck;
    }

    @AutoMatter.Field
    @Override
    public boolean enabled() {
      return enabled;
    }

    @AutoMatter.Field
    @Override
    public Optional overloadStep() {
      return overloadStep;
    }

    @AutoMatter.Field
    @Override
    public Optional lastFailure() {
      return lastFailure;
    }

    @AutoMatter.Field
    @Override
    public Optional lastFailureMessage() {
      return lastFailureMessage;
    }

    @AutoMatter.Field
    @Override
    public int consecutiveFailureCount() {
      return consecutiveFailureCount;
    }

    @AutoMatter.Field
    @Override
    public int minNodesOverride() {
      return minNodesOverride;
    }

    @AutoMatter.Field
    @Override
    public Optional errorCode() {
      return errorCode;
    }

    @AutoMatter.Field
    @Override
    public Optional extraEnabledAlgorithms() {
      return extraEnabledAlgorithms;
    }

    public BigtableClusterBuilder builder() {
      return new BigtableClusterBuilder(this);
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof BigtableCluster)) {
        return false;
      }
      final BigtableCluster that = (BigtableCluster) o;
      if (projectId != null ? !projectId.equals(that.projectId()) : that.projectId() != null) {
        return false;
      }
      if (instanceId != null ? !instanceId.equals(that.instanceId()) : that.instanceId() != null) {
        return false;
      }
      if (clusterId != null ? !clusterId.equals(that.clusterId()) : that.clusterId() != null) {
        return false;
      }
      if (minNodes != that.minNodes()) {
        return false;
      }
      if (maxNodes != that.maxNodes()) {
        return false;
      }
      if (Double.compare(cpuTarget, that.cpuTarget()) != 0) {
        return false;
      }
      if (Double.compare(storageTarget, that.storageTarget()) != 0) {
        return false;
      }
      if (lastChange != null ? !lastChange.equals(that.lastChange()) : that.lastChange() != null) {
        return false;
      }
      if (lastCheck != null ? !lastCheck.equals(that.lastCheck()) : that.lastCheck() != null) {
        return false;
      }
      if (enabled != that.enabled()) {
        return false;
      }
      if (overloadStep != null ? !overloadStep.equals(that.overloadStep()) : that.overloadStep() != null) {
        return false;
      }
      if (lastFailure != null ? !lastFailure.equals(that.lastFailure()) : that.lastFailure() != null) {
        return false;
      }
      if (lastFailureMessage != null ? !lastFailureMessage.equals(that.lastFailureMessage()) : that.lastFailureMessage() != null) {
        return false;
      }
      if (consecutiveFailureCount != that.consecutiveFailureCount()) {
        return false;
      }
      if (minNodesOverride != that.minNodesOverride()) {
        return false;
      }
      if (errorCode != null ? !errorCode.equals(that.errorCode()) : that.errorCode() != null) {
        return false;
      }
      if (extraEnabledAlgorithms != null ? !extraEnabledAlgorithms.equals(that.extraEnabledAlgorithms()) : that.extraEnabledAlgorithms() != null) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      long temp;
      result = 31 * result + (this.projectId != null ? this.projectId.hashCode() : 0);
      result = 31 * result + (this.instanceId != null ? this.instanceId.hashCode() : 0);
      result = 31 * result + (this.clusterId != null ? this.clusterId.hashCode() : 0);
      result = 31 * result + this.minNodes;
      result = 31 * result + this.maxNodes;
      temp = Double.doubleToLongBits(this.cpuTarget);
      result = 31 * result + (int) (temp ^ (temp >>> 32));
      temp = Double.doubleToLongBits(this.storageTarget);
      result = 31 * result + (int) (temp ^ (temp >>> 32));
      result = 31 * result + (this.lastChange != null ? this.lastChange.hashCode() : 0);
      result = 31 * result + (this.lastCheck != null ? this.lastCheck.hashCode() : 0);
      result = 31 * result + (this.enabled ? 1231 : 1237);
      result = 31 * result + (this.overloadStep != null ? this.overloadStep.hashCode() : 0);
      result = 31 * result + (this.lastFailure != null ? this.lastFailure.hashCode() : 0);
      result = 31 * result + (this.lastFailureMessage != null ? this.lastFailureMessage.hashCode() : 0);
      result = 31 * result + this.consecutiveFailureCount;
      result = 31 * result + this.minNodesOverride;
      result = 31 * result + (this.errorCode != null ? this.errorCode.hashCode() : 0);
      result = 31 * result + (this.extraEnabledAlgorithms != null ? this.extraEnabledAlgorithms.hashCode() : 0);
      return result;
    }

    @Override
    public String toString() {
      return "BigtableCluster{" +
      "projectId=" + projectId +
      ", instanceId=" + instanceId +
      ", clusterId=" + clusterId +
      ", minNodes=" + minNodes +
      ", maxNodes=" + maxNodes +
      ", cpuTarget=" + cpuTarget +
      ", storageTarget=" + storageTarget +
      ", lastChange=" + lastChange +
      ", lastCheck=" + lastCheck +
      ", enabled=" + enabled +
      ", overloadStep=" + overloadStep +
      ", lastFailure=" + lastFailure +
      ", lastFailureMessage=" + lastFailureMessage +
      ", consecutiveFailureCount=" + consecutiveFailureCount +
      ", minNodesOverride=" + minNodesOverride +
      ", errorCode=" + errorCode +
      ", extraEnabledAlgorithms=" + extraEnabledAlgorithms +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy