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

io.kubernetes.client.openapi.models.V1TopologySpreadConstraintFluentImpl Maven / Gradle / Ivy

There is a newer version: 22.0.0
Show newest version
/*
Copyright 2022 The Kubernetes 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
http://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.kubernetes.client.openapi.models;

import io.kubernetes.client.fluent.BaseFluent;
import io.kubernetes.client.fluent.Nested;

/** Generated */
@SuppressWarnings(value = "unchecked")
public class V1TopologySpreadConstraintFluentImpl>
    extends BaseFluent implements V1TopologySpreadConstraintFluent {
  public V1TopologySpreadConstraintFluentImpl() {}

  public V1TopologySpreadConstraintFluentImpl(
      io.kubernetes.client.openapi.models.V1TopologySpreadConstraint instance) {
    this.withLabelSelector(instance.getLabelSelector());

    this.withMaxSkew(instance.getMaxSkew());

    this.withMinDomains(instance.getMinDomains());

    this.withTopologyKey(instance.getTopologyKey());

    this.withWhenUnsatisfiable(instance.getWhenUnsatisfiable());
  }

  private V1LabelSelectorBuilder labelSelector;
  private Integer maxSkew;
  private java.lang.Integer minDomains;
  private String topologyKey;
  private java.lang.String whenUnsatisfiable;

  /**
   * This method has been deprecated, please use method buildLabelSelector instead.
   *
   * @return The buildable object.
   */
  @Deprecated
  public io.kubernetes.client.openapi.models.V1LabelSelector getLabelSelector() {
    return this.labelSelector != null ? this.labelSelector.build() : null;
  }

  public io.kubernetes.client.openapi.models.V1LabelSelector buildLabelSelector() {
    return this.labelSelector != null ? this.labelSelector.build() : null;
  }

  public A withLabelSelector(io.kubernetes.client.openapi.models.V1LabelSelector labelSelector) {
    _visitables.get("labelSelector").remove(this.labelSelector);
    if (labelSelector != null) {
      this.labelSelector = new V1LabelSelectorBuilder(labelSelector);
      _visitables.get("labelSelector").add(this.labelSelector);
    }
    return (A) this;
  }

  public Boolean hasLabelSelector() {
    return this.labelSelector != null;
  }

  public V1TopologySpreadConstraintFluent.LabelSelectorNested withNewLabelSelector() {
    return new V1TopologySpreadConstraintFluentImpl.LabelSelectorNestedImpl();
  }

  public io.kubernetes.client.openapi.models.V1TopologySpreadConstraintFluent.LabelSelectorNested
      withNewLabelSelectorLike(io.kubernetes.client.openapi.models.V1LabelSelector item) {
    return new V1TopologySpreadConstraintFluentImpl.LabelSelectorNestedImpl(item);
  }

  public io.kubernetes.client.openapi.models.V1TopologySpreadConstraintFluent.LabelSelectorNested
      editLabelSelector() {
    return withNewLabelSelectorLike(getLabelSelector());
  }

  public io.kubernetes.client.openapi.models.V1TopologySpreadConstraintFluent.LabelSelectorNested
      editOrNewLabelSelector() {
    return withNewLabelSelectorLike(
        getLabelSelector() != null
            ? getLabelSelector()
            : new io.kubernetes.client.openapi.models.V1LabelSelectorBuilder().build());
  }

  public io.kubernetes.client.openapi.models.V1TopologySpreadConstraintFluent.LabelSelectorNested
      editOrNewLabelSelectorLike(io.kubernetes.client.openapi.models.V1LabelSelector item) {
    return withNewLabelSelectorLike(getLabelSelector() != null ? getLabelSelector() : item);
  }

  public java.lang.Integer getMaxSkew() {
    return this.maxSkew;
  }

  public A withMaxSkew(java.lang.Integer maxSkew) {
    this.maxSkew = maxSkew;
    return (A) this;
  }

  public java.lang.Boolean hasMaxSkew() {
    return this.maxSkew != null;
  }

  public java.lang.Integer getMinDomains() {
    return this.minDomains;
  }

  public A withMinDomains(java.lang.Integer minDomains) {
    this.minDomains = minDomains;
    return (A) this;
  }

  public java.lang.Boolean hasMinDomains() {
    return this.minDomains != null;
  }

  public java.lang.String getTopologyKey() {
    return this.topologyKey;
  }

  public A withTopologyKey(java.lang.String topologyKey) {
    this.topologyKey = topologyKey;
    return (A) this;
  }

  public java.lang.Boolean hasTopologyKey() {
    return this.topologyKey != null;
  }

  public java.lang.String getWhenUnsatisfiable() {
    return this.whenUnsatisfiable;
  }

  public A withWhenUnsatisfiable(java.lang.String whenUnsatisfiable) {
    this.whenUnsatisfiable = whenUnsatisfiable;
    return (A) this;
  }

  public java.lang.Boolean hasWhenUnsatisfiable() {
    return this.whenUnsatisfiable != null;
  }

  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    V1TopologySpreadConstraintFluentImpl that = (V1TopologySpreadConstraintFluentImpl) o;
    if (labelSelector != null
        ? !labelSelector.equals(that.labelSelector)
        : that.labelSelector != null) return false;
    if (maxSkew != null ? !maxSkew.equals(that.maxSkew) : that.maxSkew != null) return false;
    if (minDomains != null ? !minDomains.equals(that.minDomains) : that.minDomains != null)
      return false;
    if (topologyKey != null ? !topologyKey.equals(that.topologyKey) : that.topologyKey != null)
      return false;
    if (whenUnsatisfiable != null
        ? !whenUnsatisfiable.equals(that.whenUnsatisfiable)
        : that.whenUnsatisfiable != null) return false;
    return true;
  }

  public int hashCode() {
    return java.util.Objects.hash(
        labelSelector, maxSkew, minDomains, topologyKey, whenUnsatisfiable, super.hashCode());
  }

  public java.lang.String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (labelSelector != null) {
      sb.append("labelSelector:");
      sb.append(labelSelector + ",");
    }
    if (maxSkew != null) {
      sb.append("maxSkew:");
      sb.append(maxSkew + ",");
    }
    if (minDomains != null) {
      sb.append("minDomains:");
      sb.append(minDomains + ",");
    }
    if (topologyKey != null) {
      sb.append("topologyKey:");
      sb.append(topologyKey + ",");
    }
    if (whenUnsatisfiable != null) {
      sb.append("whenUnsatisfiable:");
      sb.append(whenUnsatisfiable);
    }
    sb.append("}");
    return sb.toString();
  }

  class LabelSelectorNestedImpl
      extends V1LabelSelectorFluentImpl>
      implements io.kubernetes.client.openapi.models.V1TopologySpreadConstraintFluent
                  .LabelSelectorNested<
              N>,
          Nested {
    LabelSelectorNestedImpl(V1LabelSelector item) {
      this.builder = new V1LabelSelectorBuilder(this, item);
    }

    LabelSelectorNestedImpl() {
      this.builder = new io.kubernetes.client.openapi.models.V1LabelSelectorBuilder(this);
    }

    io.kubernetes.client.openapi.models.V1LabelSelectorBuilder builder;

    public N and() {
      return (N) V1TopologySpreadConstraintFluentImpl.this.withLabelSelector(builder.build());
    }

    public N endLabelSelector() {
      return and();
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy