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

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

There is a newer version: 22.0.0
Show newest version
/*
Copyright 2021 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 com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.Objects;

/**
 * The pod this Toleration is attached to tolerates any taint that matches the triple
 * <key,value,effect> using the matching operator <operator>.
 */
@ApiModel(
    description =
        "The pod this Toleration is attached to tolerates any taint that matches the triple  using the matching operator .")
@javax.annotation.Generated(
    value = "org.openapitools.codegen.languages.JavaClientCodegen",
    date = "2021-12-10T19:11:23.904Z[Etc/UTC]")
public class V1Toleration {
  /**
   * Effect indicates the taint effect to match. Empty means match all taint effects. When
   * specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. Possible enum values:
   * - `\"NoExecute\"` Evict any already-running pods that do not tolerate the
   * taint. Currently enforced by NodeController. - `\"NoSchedule\"` Do not
   * allow new pods to schedule onto the node unless they tolerate the taint, but allow all pods
   * submitted to Kubelet without going through the scheduler to start, and allow all
   * already-running pods to continue running. Enforced by the scheduler. -
   * `\"PreferNoSchedule\"` Like TaintEffectNoSchedule, but the scheduler tries
   * not to schedule new pods onto the node, rather than prohibiting new pods from scheduling onto
   * the node entirely. Enforced by the scheduler.
   */
  @JsonAdapter(EffectEnum.Adapter.class)
  public enum EffectEnum {
    NOEXECUTE("NoExecute"),

    NOSCHEDULE("NoSchedule"),

    PREFERNOSCHEDULE("PreferNoSchedule");

    private String value;

    EffectEnum(String value) {
      this.value = value;
    }

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static EffectEnum fromValue(String value) {
      for (EffectEnum b : EffectEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter {
      @Override
      public void write(final JsonWriter jsonWriter, final EffectEnum enumeration)
          throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public EffectEnum read(final JsonReader jsonReader) throws IOException {
        String value = jsonReader.nextString();
        return EffectEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_EFFECT = "effect";

  @SerializedName(SERIALIZED_NAME_EFFECT)
  private EffectEnum effect;

  public static final String SERIALIZED_NAME_KEY = "key";

  @SerializedName(SERIALIZED_NAME_KEY)
  private String key;

  /**
   * Operator represents a key's relationship to the value. Valid operators are Exists and
   * Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can
   * tolerate all taints of a particular category. Possible enum values: -
   * `\"Equal\"` - `\"Exists\"`
   */
  @JsonAdapter(OperatorEnum.Adapter.class)
  public enum OperatorEnum {
    EQUAL("Equal"),

    EXISTS("Exists");

    private String value;

    OperatorEnum(String value) {
      this.value = value;
    }

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static OperatorEnum fromValue(String value) {
      for (OperatorEnum b : OperatorEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter {
      @Override
      public void write(final JsonWriter jsonWriter, final OperatorEnum enumeration)
          throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public OperatorEnum read(final JsonReader jsonReader) throws IOException {
        String value = jsonReader.nextString();
        return OperatorEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_OPERATOR = "operator";

  @SerializedName(SERIALIZED_NAME_OPERATOR)
  private OperatorEnum operator;

  public static final String SERIALIZED_NAME_TOLERATION_SECONDS = "tolerationSeconds";

  @SerializedName(SERIALIZED_NAME_TOLERATION_SECONDS)
  private Long tolerationSeconds;

  public static final String SERIALIZED_NAME_VALUE = "value";

  @SerializedName(SERIALIZED_NAME_VALUE)
  private String value;

  public V1Toleration effect(EffectEnum effect) {

    this.effect = effect;
    return this;
  }

  /**
   * Effect indicates the taint effect to match. Empty means match all taint effects. When
   * specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. Possible enum values:
   * - `\"NoExecute\"` Evict any already-running pods that do not tolerate the
   * taint. Currently enforced by NodeController. - `\"NoSchedule\"` Do not
   * allow new pods to schedule onto the node unless they tolerate the taint, but allow all pods
   * submitted to Kubelet without going through the scheduler to start, and allow all
   * already-running pods to continue running. Enforced by the scheduler. -
   * `\"PreferNoSchedule\"` Like TaintEffectNoSchedule, but the scheduler tries
   * not to schedule new pods onto the node, rather than prohibiting new pods from scheduling onto
   * the node entirely. Enforced by the scheduler.
   *
   * @return effect
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.  Possible enum values:  - `\"NoExecute\"` Evict any already-running pods that do not tolerate the taint. Currently enforced by NodeController.  - `\"NoSchedule\"` Do not allow new pods to schedule onto the node unless they tolerate the taint, but allow all pods submitted to Kubelet without going through the scheduler to start, and allow all already-running pods to continue running. Enforced by the scheduler.  - `\"PreferNoSchedule\"` Like TaintEffectNoSchedule, but the scheduler tries not to schedule new pods onto the node, rather than prohibiting new pods from scheduling onto the node entirely. Enforced by the scheduler.")
  public EffectEnum getEffect() {
    return effect;
  }

  public void setEffect(EffectEnum effect) {
    this.effect = effect;
  }

  public V1Toleration key(String key) {

    this.key = key;
    return this;
  }

  /**
   * Key is the taint key that the toleration applies to. Empty means match all taint keys. If the
   * key is empty, operator must be Exists; this combination means to match all values and all keys.
   *
   * @return key
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.")
  public String getKey() {
    return key;
  }

  public void setKey(String key) {
    this.key = key;
  }

  public V1Toleration operator(OperatorEnum operator) {

    this.operator = operator;
    return this;
  }

  /**
   * Operator represents a key's relationship to the value. Valid operators are Exists and
   * Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can
   * tolerate all taints of a particular category. Possible enum values: -
   * `\"Equal\"` - `\"Exists\"`
   *
   * @return operator
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.  Possible enum values:  - `\"Equal\"`  - `\"Exists\"`")
  public OperatorEnum getOperator() {
    return operator;
  }

  public void setOperator(OperatorEnum operator) {
    this.operator = operator;
  }

  public V1Toleration tolerationSeconds(Long tolerationSeconds) {

    this.tolerationSeconds = tolerationSeconds;
    return this;
  }

  /**
   * TolerationSeconds represents the period of time the toleration (which must be of effect
   * NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set,
   * which means tolerate the taint forever (do not evict). Zero and negative values will be treated
   * as 0 (evict immediately) by the system.
   *
   * @return tolerationSeconds
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.")
  public Long getTolerationSeconds() {
    return tolerationSeconds;
  }

  public void setTolerationSeconds(Long tolerationSeconds) {
    this.tolerationSeconds = tolerationSeconds;
  }

  public V1Toleration value(String value) {

    this.value = value;
    return this;
  }

  /**
   * Value is the taint value the toleration matches to. If the operator is Exists, the value should
   * be empty, otherwise just a regular string.
   *
   * @return value
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.")
  public String getValue() {
    return value;
  }

  public void setValue(String value) {
    this.value = value;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    V1Toleration v1Toleration = (V1Toleration) o;
    return Objects.equals(this.effect, v1Toleration.effect)
        && Objects.equals(this.key, v1Toleration.key)
        && Objects.equals(this.operator, v1Toleration.operator)
        && Objects.equals(this.tolerationSeconds, v1Toleration.tolerationSeconds)
        && Objects.equals(this.value, v1Toleration.value);
  }

  @Override
  public int hashCode() {
    return Objects.hash(effect, key, operator, tolerationSeconds, value);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class V1Toleration {\n");
    sb.append("    effect: ").append(toIndentedString(effect)).append("\n");
    sb.append("    key: ").append(toIndentedString(key)).append("\n");
    sb.append("    operator: ").append(toIndentedString(operator)).append("\n");
    sb.append("    tolerationSeconds: ").append(toIndentedString(tolerationSeconds)).append("\n");
    sb.append("    value: ").append(toIndentedString(value)).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(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy