/*
 * Copyright 2020 Google LLC
 *
 * 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
 *
 *     https://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.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/vmmigration/v1/vmmigration.proto

package com.google.cloud.vmmigration.v1;

/**
 *
 *
 * <pre>
 * Scheduling information for VM on maintenance/restart behaviour and
 * node allocation in sole tenant nodes.
 * </pre>
 *
 * Protobuf type {@code google.cloud.vmmigration.v1.ComputeScheduling}
 */
public final class ComputeScheduling extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.vmmigration.v1.ComputeScheduling)
    ComputeSchedulingOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use ComputeScheduling.newBuilder() to construct.
  private ComputeScheduling(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private ComputeScheduling() {
    onHostMaintenance_ = 0;
    restartType_ = 0;
    nodeAffinities_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new ComputeScheduling();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.vmmigration.v1.VmMigrationProto
        .internal_static_google_cloud_vmmigration_v1_ComputeScheduling_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.vmmigration.v1.VmMigrationProto
        .internal_static_google_cloud_vmmigration_v1_ComputeScheduling_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.vmmigration.v1.ComputeScheduling.class,
            com.google.cloud.vmmigration.v1.ComputeScheduling.Builder.class);
  }

  /** Protobuf enum {@code google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance} */
  public enum OnHostMaintenance implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * An unknown, unexpected behavior.
     * </pre>
     *
     * <code>ON_HOST_MAINTENANCE_UNSPECIFIED = 0;</code>
     */
    ON_HOST_MAINTENANCE_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * Terminate the instance when the host machine undergoes maintenance.
     * </pre>
     *
     * <code>TERMINATE = 1;</code>
     */
    TERMINATE(1),
    /**
     *
     *
     * <pre>
     * Migrate the instance when the host machine undergoes maintenance.
     * </pre>
     *
     * <code>MIGRATE = 2;</code>
     */
    MIGRATE(2),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * An unknown, unexpected behavior.
     * </pre>
     *
     * <code>ON_HOST_MAINTENANCE_UNSPECIFIED = 0;</code>
     */
    public static final int ON_HOST_MAINTENANCE_UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * Terminate the instance when the host machine undergoes maintenance.
     * </pre>
     *
     * <code>TERMINATE = 1;</code>
     */
    public static final int TERMINATE_VALUE = 1;
    /**
     *
     *
     * <pre>
     * Migrate the instance when the host machine undergoes maintenance.
     * </pre>
     *
     * <code>MIGRATE = 2;</code>
     */
    public static final int MIGRATE_VALUE = 2;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static OnHostMaintenance valueOf(int value) {
      return forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static OnHostMaintenance forNumber(int value) {
      switch (value) {
        case 0:
          return ON_HOST_MAINTENANCE_UNSPECIFIED;
        case 1:
          return TERMINATE;
        case 2:
          return MIGRATE;
        default:
          return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<OnHostMaintenance>
        internalGetValueMap() {
      return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<OnHostMaintenance>
        internalValueMap =
            new com.google.protobuf.Internal.EnumLiteMap<OnHostMaintenance>() {
              public OnHostMaintenance findValueByNumber(int number) {
                return OnHostMaintenance.forNumber(number);
              }
            };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalStateException(
            "Can't get the descriptor of an unrecognized enum value.");
      }
      return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
      return getDescriptor();
    }

    public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
      return com.google.cloud.vmmigration.v1.ComputeScheduling.getDescriptor()
          .getEnumTypes()
          .get(0);
    }

    private static final OnHostMaintenance[] VALUES = values();

    public static OnHostMaintenance valueOf(
        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private OnHostMaintenance(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance)
  }

  /**
   *
   *
   * <pre>
   * Defines whether the Instance should be automatically restarted whenever
   * it is terminated by Compute Engine (not terminated by user).
   * </pre>
   *
   * Protobuf enum {@code google.cloud.vmmigration.v1.ComputeScheduling.RestartType}
   */
  public enum RestartType implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * Unspecified behavior. This will use the default.
     * </pre>
     *
     * <code>RESTART_TYPE_UNSPECIFIED = 0;</code>
     */
    RESTART_TYPE_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * The Instance should be automatically restarted whenever it is
     * terminated by Compute Engine.
     * </pre>
     *
     * <code>AUTOMATIC_RESTART = 1;</code>
     */
    AUTOMATIC_RESTART(1),
    /**
     *
     *
     * <pre>
     * The Instance isn't automatically restarted whenever it is
     * terminated by Compute Engine.
     * </pre>
     *
     * <code>NO_AUTOMATIC_RESTART = 2;</code>
     */
    NO_AUTOMATIC_RESTART(2),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * Unspecified behavior. This will use the default.
     * </pre>
     *
     * <code>RESTART_TYPE_UNSPECIFIED = 0;</code>
     */
    public static final int RESTART_TYPE_UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * The Instance should be automatically restarted whenever it is
     * terminated by Compute Engine.
     * </pre>
     *
     * <code>AUTOMATIC_RESTART = 1;</code>
     */
    public static final int AUTOMATIC_RESTART_VALUE = 1;
    /**
     *
     *
     * <pre>
     * The Instance isn't automatically restarted whenever it is
     * terminated by Compute Engine.
     * </pre>
     *
     * <code>NO_AUTOMATIC_RESTART = 2;</code>
     */
    public static final int NO_AUTOMATIC_RESTART_VALUE = 2;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static RestartType valueOf(int value) {
      return forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static RestartType forNumber(int value) {
      switch (value) {
        case 0:
          return RESTART_TYPE_UNSPECIFIED;
        case 1:
          return AUTOMATIC_RESTART;
        case 2:
          return NO_AUTOMATIC_RESTART;
        default:
          return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<RestartType> internalGetValueMap() {
      return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<RestartType> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<RestartType>() {
          public RestartType findValueByNumber(int number) {
            return RestartType.forNumber(number);
          }
        };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalStateException(
            "Can't get the descriptor of an unrecognized enum value.");
      }
      return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
      return getDescriptor();
    }

    public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
      return com.google.cloud.vmmigration.v1.ComputeScheduling.getDescriptor()
          .getEnumTypes()
          .get(1);
    }

    private static final RestartType[] VALUES = values();

    public static RestartType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private RestartType(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.cloud.vmmigration.v1.ComputeScheduling.RestartType)
  }

  public static final int ON_HOST_MAINTENANCE_FIELD_NUMBER = 1;
  private int onHostMaintenance_ = 0;
  /**
   *
   *
   * <pre>
   * How the instance should behave when the host machine undergoes
   * maintenance that may temporarily impact instance performance.
   * </pre>
   *
   * <code>.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1;
   * </code>
   *
   * @return The enum numeric value on the wire for onHostMaintenance.
   */
  @java.lang.Override
  public int getOnHostMaintenanceValue() {
    return onHostMaintenance_;
  }
  /**
   *
   *
   * <pre>
   * How the instance should behave when the host machine undergoes
   * maintenance that may temporarily impact instance performance.
   * </pre>
   *
   * <code>.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1;
   * </code>
   *
   * @return The onHostMaintenance.
   */
  @java.lang.Override
  public com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance
      getOnHostMaintenance() {
    com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance result =
        com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance.forNumber(
            onHostMaintenance_);
    return result == null
        ? com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance.UNRECOGNIZED
        : result;
  }

  public static final int RESTART_TYPE_FIELD_NUMBER = 5;
  private int restartType_ = 0;
  /**
   *
   *
   * <pre>
   * Whether the Instance should be automatically restarted whenever it is
   * terminated by Compute Engine (not terminated by user).
   * This configuration is identical to `automaticRestart` field in Compute
   * Engine create instance under scheduling.
   * It was changed to an enum (instead of a boolean) to match the default
   * value in Compute Engine which is automatic restart.
   * </pre>
   *
   * <code>.google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5;</code>
   *
   * @return The enum numeric value on the wire for restartType.
   */
  @java.lang.Override
  public int getRestartTypeValue() {
    return restartType_;
  }
  /**
   *
   *
   * <pre>
   * Whether the Instance should be automatically restarted whenever it is
   * terminated by Compute Engine (not terminated by user).
   * This configuration is identical to `automaticRestart` field in Compute
   * Engine create instance under scheduling.
   * It was changed to an enum (instead of a boolean) to match the default
   * value in Compute Engine which is automatic restart.
   * </pre>
   *
   * <code>.google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5;</code>
   *
   * @return The restartType.
   */
  @java.lang.Override
  public com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType getRestartType() {
    com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType result =
        com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType.forNumber(restartType_);
    return result == null
        ? com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType.UNRECOGNIZED
        : result;
  }

  public static final int NODE_AFFINITIES_FIELD_NUMBER = 3;

  @SuppressWarnings("serial")
  private java.util.List<com.google.cloud.vmmigration.v1.SchedulingNodeAffinity> nodeAffinities_;
  /**
   *
   *
   * <pre>
   * A set of node affinity and anti-affinity configurations for sole tenant
   * nodes.
   * </pre>
   *
   * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.cloud.vmmigration.v1.SchedulingNodeAffinity>
      getNodeAffinitiesList() {
    return nodeAffinities_;
  }
  /**
   *
   *
   * <pre>
   * A set of node affinity and anti-affinity configurations for sole tenant
   * nodes.
   * </pre>
   *
   * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.cloud.vmmigration.v1.SchedulingNodeAffinityOrBuilder>
      getNodeAffinitiesOrBuilderList() {
    return nodeAffinities_;
  }
  /**
   *
   *
   * <pre>
   * A set of node affinity and anti-affinity configurations for sole tenant
   * nodes.
   * </pre>
   *
   * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;</code>
   */
  @java.lang.Override
  public int getNodeAffinitiesCount() {
    return nodeAffinities_.size();
  }
  /**
   *
   *
   * <pre>
   * A set of node affinity and anti-affinity configurations for sole tenant
   * nodes.
   * </pre>
   *
   * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;</code>
   */
  @java.lang.Override
  public com.google.cloud.vmmigration.v1.SchedulingNodeAffinity getNodeAffinities(int index) {
    return nodeAffinities_.get(index);
  }
  /**
   *
   *
   * <pre>
   * A set of node affinity and anti-affinity configurations for sole tenant
   * nodes.
   * </pre>
   *
   * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;</code>
   */
  @java.lang.Override
  public com.google.cloud.vmmigration.v1.SchedulingNodeAffinityOrBuilder getNodeAffinitiesOrBuilder(
      int index) {
    return nodeAffinities_.get(index);
  }

  public static final int MIN_NODE_CPUS_FIELD_NUMBER = 4;
  private int minNodeCpus_ = 0;
  /**
   *
   *
   * <pre>
   * The minimum number of virtual CPUs this instance will consume when
   * running on a sole-tenant node. Ignored if no node_affinites are
   * configured.
   * </pre>
   *
   * <code>int32 min_node_cpus = 4;</code>
   *
   * @return The minNodeCpus.
   */
  @java.lang.Override
  public int getMinNodeCpus() {
    return minNodeCpus_;
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (onHostMaintenance_
        != com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance
            .ON_HOST_MAINTENANCE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(1, onHostMaintenance_);
    }
    for (int i = 0; i < nodeAffinities_.size(); i++) {
      output.writeMessage(3, nodeAffinities_.get(i));
    }
    if (minNodeCpus_ != 0) {
      output.writeInt32(4, minNodeCpus_);
    }
    if (restartType_
        != com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType.RESTART_TYPE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(5, restartType_);
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (onHostMaintenance_
        != com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance
            .ON_HOST_MAINTENANCE_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, onHostMaintenance_);
    }
    for (int i = 0; i < nodeAffinities_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, nodeAffinities_.get(i));
    }
    if (minNodeCpus_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, minNodeCpus_);
    }
    if (restartType_
        != com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType.RESTART_TYPE_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, restartType_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.vmmigration.v1.ComputeScheduling)) {
      return super.equals(obj);
    }
    com.google.cloud.vmmigration.v1.ComputeScheduling other =
        (com.google.cloud.vmmigration.v1.ComputeScheduling) obj;

    if (onHostMaintenance_ != other.onHostMaintenance_) return false;
    if (restartType_ != other.restartType_) return false;
    if (!getNodeAffinitiesList().equals(other.getNodeAffinitiesList())) return false;
    if (getMinNodeCpus() != other.getMinNodeCpus()) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + ON_HOST_MAINTENANCE_FIELD_NUMBER;
    hash = (53 * hash) + onHostMaintenance_;
    hash = (37 * hash) + RESTART_TYPE_FIELD_NUMBER;
    hash = (53 * hash) + restartType_;
    if (getNodeAffinitiesCount() > 0) {
      hash = (37 * hash) + NODE_AFFINITIES_FIELD_NUMBER;
      hash = (53 * hash) + getNodeAffinitiesList().hashCode();
    }
    hash = (37 * hash) + MIN_NODE_CPUS_FIELD_NUMBER;
    hash = (53 * hash) + getMinNodeCpus();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.cloud.vmmigration.v1.ComputeScheduling prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * Scheduling information for VM on maintenance/restart behaviour and
   * node allocation in sole tenant nodes.
   * </pre>
   *
   * Protobuf type {@code google.cloud.vmmigration.v1.ComputeScheduling}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.vmmigration.v1.ComputeScheduling)
      com.google.cloud.vmmigration.v1.ComputeSchedulingOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.vmmigration.v1.VmMigrationProto
          .internal_static_google_cloud_vmmigration_v1_ComputeScheduling_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.vmmigration.v1.VmMigrationProto
          .internal_static_google_cloud_vmmigration_v1_ComputeScheduling_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.vmmigration.v1.ComputeScheduling.class,
              com.google.cloud.vmmigration.v1.ComputeScheduling.Builder.class);
    }

    // Construct using com.google.cloud.vmmigration.v1.ComputeScheduling.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      onHostMaintenance_ = 0;
      restartType_ = 0;
      if (nodeAffinitiesBuilder_ == null) {
        nodeAffinities_ = java.util.Collections.emptyList();
      } else {
        nodeAffinities_ = null;
        nodeAffinitiesBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000004);
      minNodeCpus_ = 0;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.vmmigration.v1.VmMigrationProto
          .internal_static_google_cloud_vmmigration_v1_ComputeScheduling_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.vmmigration.v1.ComputeScheduling getDefaultInstanceForType() {
      return com.google.cloud.vmmigration.v1.ComputeScheduling.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.vmmigration.v1.ComputeScheduling build() {
      com.google.cloud.vmmigration.v1.ComputeScheduling result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.vmmigration.v1.ComputeScheduling buildPartial() {
      com.google.cloud.vmmigration.v1.ComputeScheduling result =
          new com.google.cloud.vmmigration.v1.ComputeScheduling(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(
        com.google.cloud.vmmigration.v1.ComputeScheduling result) {
      if (nodeAffinitiesBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)) {
          nodeAffinities_ = java.util.Collections.unmodifiableList(nodeAffinities_);
          bitField0_ = (bitField0_ & ~0x00000004);
        }
        result.nodeAffinities_ = nodeAffinities_;
      } else {
        result.nodeAffinities_ = nodeAffinitiesBuilder_.build();
      }
    }

    private void buildPartial0(com.google.cloud.vmmigration.v1.ComputeScheduling result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.onHostMaintenance_ = onHostMaintenance_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.restartType_ = restartType_;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.minNodeCpus_ = minNodeCpus_;
      }
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.vmmigration.v1.ComputeScheduling) {
        return mergeFrom((com.google.cloud.vmmigration.v1.ComputeScheduling) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.vmmigration.v1.ComputeScheduling other) {
      if (other == com.google.cloud.vmmigration.v1.ComputeScheduling.getDefaultInstance())
        return this;
      if (other.onHostMaintenance_ != 0) {
        setOnHostMaintenanceValue(other.getOnHostMaintenanceValue());
      }
      if (other.restartType_ != 0) {
        setRestartTypeValue(other.getRestartTypeValue());
      }
      if (nodeAffinitiesBuilder_ == null) {
        if (!other.nodeAffinities_.isEmpty()) {
          if (nodeAffinities_.isEmpty()) {
            nodeAffinities_ = other.nodeAffinities_;
            bitField0_ = (bitField0_ & ~0x00000004);
          } else {
            ensureNodeAffinitiesIsMutable();
            nodeAffinities_.addAll(other.nodeAffinities_);
          }
          onChanged();
        }
      } else {
        if (!other.nodeAffinities_.isEmpty()) {
          if (nodeAffinitiesBuilder_.isEmpty()) {
            nodeAffinitiesBuilder_.dispose();
            nodeAffinitiesBuilder_ = null;
            nodeAffinities_ = other.nodeAffinities_;
            bitField0_ = (bitField0_ & ~0x00000004);
            nodeAffinitiesBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getNodeAffinitiesFieldBuilder()
                    : null;
          } else {
            nodeAffinitiesBuilder_.addAllMessages(other.nodeAffinities_);
          }
        }
      }
      if (other.getMinNodeCpus() != 0) {
        setMinNodeCpus(other.getMinNodeCpus());
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 8:
              {
                onHostMaintenance_ = input.readEnum();
                bitField0_ |= 0x00000001;
                break;
              } // case 8
            case 26:
              {
                com.google.cloud.vmmigration.v1.SchedulingNodeAffinity m =
                    input.readMessage(
                        com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.parser(),
                        extensionRegistry);
                if (nodeAffinitiesBuilder_ == null) {
                  ensureNodeAffinitiesIsMutable();
                  nodeAffinities_.add(m);
                } else {
                  nodeAffinitiesBuilder_.addMessage(m);
                }
                break;
              } // case 26
            case 32:
              {
                minNodeCpus_ = input.readInt32();
                bitField0_ |= 0x00000008;
                break;
              } // case 32
            case 40:
              {
                restartType_ = input.readEnum();
                bitField0_ |= 0x00000002;
                break;
              } // case 40
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private int onHostMaintenance_ = 0;
    /**
     *
     *
     * <pre>
     * How the instance should behave when the host machine undergoes
     * maintenance that may temporarily impact instance performance.
     * </pre>
     *
     * <code>
     * .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1;
     * </code>
     *
     * @return The enum numeric value on the wire for onHostMaintenance.
     */
    @java.lang.Override
    public int getOnHostMaintenanceValue() {
      return onHostMaintenance_;
    }
    /**
     *
     *
     * <pre>
     * How the instance should behave when the host machine undergoes
     * maintenance that may temporarily impact instance performance.
     * </pre>
     *
     * <code>
     * .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1;
     * </code>
     *
     * @param value The enum numeric value on the wire for onHostMaintenance to set.
     * @return This builder for chaining.
     */
    public Builder setOnHostMaintenanceValue(int value) {
      onHostMaintenance_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * How the instance should behave when the host machine undergoes
     * maintenance that may temporarily impact instance performance.
     * </pre>
     *
     * <code>
     * .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1;
     * </code>
     *
     * @return The onHostMaintenance.
     */
    @java.lang.Override
    public com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance
        getOnHostMaintenance() {
      com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance result =
          com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance.forNumber(
              onHostMaintenance_);
      return result == null
          ? com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * How the instance should behave when the host machine undergoes
     * maintenance that may temporarily impact instance performance.
     * </pre>
     *
     * <code>
     * .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1;
     * </code>
     *
     * @param value The onHostMaintenance to set.
     * @return This builder for chaining.
     */
    public Builder setOnHostMaintenance(
        com.google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000001;
      onHostMaintenance_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * How the instance should behave when the host machine undergoes
     * maintenance that may temporarily impact instance performance.
     * </pre>
     *
     * <code>
     * .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1;
     * </code>
     *
     * @return This builder for chaining.
     */
    public Builder clearOnHostMaintenance() {
      bitField0_ = (bitField0_ & ~0x00000001);
      onHostMaintenance_ = 0;
      onChanged();
      return this;
    }

    private int restartType_ = 0;
    /**
     *
     *
     * <pre>
     * Whether the Instance should be automatically restarted whenever it is
     * terminated by Compute Engine (not terminated by user).
     * This configuration is identical to `automaticRestart` field in Compute
     * Engine create instance under scheduling.
     * It was changed to an enum (instead of a boolean) to match the default
     * value in Compute Engine which is automatic restart.
     * </pre>
     *
     * <code>.google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5;</code>
     *
     * @return The enum numeric value on the wire for restartType.
     */
    @java.lang.Override
    public int getRestartTypeValue() {
      return restartType_;
    }
    /**
     *
     *
     * <pre>
     * Whether the Instance should be automatically restarted whenever it is
     * terminated by Compute Engine (not terminated by user).
     * This configuration is identical to `automaticRestart` field in Compute
     * Engine create instance under scheduling.
     * It was changed to an enum (instead of a boolean) to match the default
     * value in Compute Engine which is automatic restart.
     * </pre>
     *
     * <code>.google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5;</code>
     *
     * @param value The enum numeric value on the wire for restartType to set.
     * @return This builder for chaining.
     */
    public Builder setRestartTypeValue(int value) {
      restartType_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether the Instance should be automatically restarted whenever it is
     * terminated by Compute Engine (not terminated by user).
     * This configuration is identical to `automaticRestart` field in Compute
     * Engine create instance under scheduling.
     * It was changed to an enum (instead of a boolean) to match the default
     * value in Compute Engine which is automatic restart.
     * </pre>
     *
     * <code>.google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5;</code>
     *
     * @return The restartType.
     */
    @java.lang.Override
    public com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType getRestartType() {
      com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType result =
          com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType.forNumber(restartType_);
      return result == null
          ? com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * Whether the Instance should be automatically restarted whenever it is
     * terminated by Compute Engine (not terminated by user).
     * This configuration is identical to `automaticRestart` field in Compute
     * Engine create instance under scheduling.
     * It was changed to an enum (instead of a boolean) to match the default
     * value in Compute Engine which is automatic restart.
     * </pre>
     *
     * <code>.google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5;</code>
     *
     * @param value The restartType to set.
     * @return This builder for chaining.
     */
    public Builder setRestartType(
        com.google.cloud.vmmigration.v1.ComputeScheduling.RestartType value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000002;
      restartType_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether the Instance should be automatically restarted whenever it is
     * terminated by Compute Engine (not terminated by user).
     * This configuration is identical to `automaticRestart` field in Compute
     * Engine create instance under scheduling.
     * It was changed to an enum (instead of a boolean) to match the default
     * value in Compute Engine which is automatic restart.
     * </pre>
     *
     * <code>.google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearRestartType() {
      bitField0_ = (bitField0_ & ~0x00000002);
      restartType_ = 0;
      onChanged();
      return this;
    }

    private java.util.List<com.google.cloud.vmmigration.v1.SchedulingNodeAffinity> nodeAffinities_ =
        java.util.Collections.emptyList();

    private void ensureNodeAffinitiesIsMutable() {
      if (!((bitField0_ & 0x00000004) != 0)) {
        nodeAffinities_ =
            new java.util.ArrayList<com.google.cloud.vmmigration.v1.SchedulingNodeAffinity>(
                nodeAffinities_);
        bitField0_ |= 0x00000004;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.vmmigration.v1.SchedulingNodeAffinity,
            com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder,
            com.google.cloud.vmmigration.v1.SchedulingNodeAffinityOrBuilder>
        nodeAffinitiesBuilder_;

    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public java.util.List<com.google.cloud.vmmigration.v1.SchedulingNodeAffinity>
        getNodeAffinitiesList() {
      if (nodeAffinitiesBuilder_ == null) {
        return java.util.Collections.unmodifiableList(nodeAffinities_);
      } else {
        return nodeAffinitiesBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public int getNodeAffinitiesCount() {
      if (nodeAffinitiesBuilder_ == null) {
        return nodeAffinities_.size();
      } else {
        return nodeAffinitiesBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public com.google.cloud.vmmigration.v1.SchedulingNodeAffinity getNodeAffinities(int index) {
      if (nodeAffinitiesBuilder_ == null) {
        return nodeAffinities_.get(index);
      } else {
        return nodeAffinitiesBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder setNodeAffinities(
        int index, com.google.cloud.vmmigration.v1.SchedulingNodeAffinity value) {
      if (nodeAffinitiesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureNodeAffinitiesIsMutable();
        nodeAffinities_.set(index, value);
        onChanged();
      } else {
        nodeAffinitiesBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder setNodeAffinities(
        int index, com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder builderForValue) {
      if (nodeAffinitiesBuilder_ == null) {
        ensureNodeAffinitiesIsMutable();
        nodeAffinities_.set(index, builderForValue.build());
        onChanged();
      } else {
        nodeAffinitiesBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder addNodeAffinities(com.google.cloud.vmmigration.v1.SchedulingNodeAffinity value) {
      if (nodeAffinitiesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureNodeAffinitiesIsMutable();
        nodeAffinities_.add(value);
        onChanged();
      } else {
        nodeAffinitiesBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder addNodeAffinities(
        int index, com.google.cloud.vmmigration.v1.SchedulingNodeAffinity value) {
      if (nodeAffinitiesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureNodeAffinitiesIsMutable();
        nodeAffinities_.add(index, value);
        onChanged();
      } else {
        nodeAffinitiesBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder addNodeAffinities(
        com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder builderForValue) {
      if (nodeAffinitiesBuilder_ == null) {
        ensureNodeAffinitiesIsMutable();
        nodeAffinities_.add(builderForValue.build());
        onChanged();
      } else {
        nodeAffinitiesBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder addNodeAffinities(
        int index, com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder builderForValue) {
      if (nodeAffinitiesBuilder_ == null) {
        ensureNodeAffinitiesIsMutable();
        nodeAffinities_.add(index, builderForValue.build());
        onChanged();
      } else {
        nodeAffinitiesBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder addAllNodeAffinities(
        java.lang.Iterable<? extends com.google.cloud.vmmigration.v1.SchedulingNodeAffinity>
            values) {
      if (nodeAffinitiesBuilder_ == null) {
        ensureNodeAffinitiesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, nodeAffinities_);
        onChanged();
      } else {
        nodeAffinitiesBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder clearNodeAffinities() {
      if (nodeAffinitiesBuilder_ == null) {
        nodeAffinities_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
      } else {
        nodeAffinitiesBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public Builder removeNodeAffinities(int index) {
      if (nodeAffinitiesBuilder_ == null) {
        ensureNodeAffinitiesIsMutable();
        nodeAffinities_.remove(index);
        onChanged();
      } else {
        nodeAffinitiesBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder getNodeAffinitiesBuilder(
        int index) {
      return getNodeAffinitiesFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public com.google.cloud.vmmigration.v1.SchedulingNodeAffinityOrBuilder
        getNodeAffinitiesOrBuilder(int index) {
      if (nodeAffinitiesBuilder_ == null) {
        return nodeAffinities_.get(index);
      } else {
        return nodeAffinitiesBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public java.util.List<? extends com.google.cloud.vmmigration.v1.SchedulingNodeAffinityOrBuilder>
        getNodeAffinitiesOrBuilderList() {
      if (nodeAffinitiesBuilder_ != null) {
        return nodeAffinitiesBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(nodeAffinities_);
      }
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder
        addNodeAffinitiesBuilder() {
      return getNodeAffinitiesFieldBuilder()
          .addBuilder(com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder addNodeAffinitiesBuilder(
        int index) {
      return getNodeAffinitiesFieldBuilder()
          .addBuilder(
              index, com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * A set of node affinity and anti-affinity configurations for sole tenant
     * nodes.
     * </pre>
     *
     * <code>repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3;
     * </code>
     */
    public java.util.List<com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder>
        getNodeAffinitiesBuilderList() {
      return getNodeAffinitiesFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.vmmigration.v1.SchedulingNodeAffinity,
            com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder,
            com.google.cloud.vmmigration.v1.SchedulingNodeAffinityOrBuilder>
        getNodeAffinitiesFieldBuilder() {
      if (nodeAffinitiesBuilder_ == null) {
        nodeAffinitiesBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.vmmigration.v1.SchedulingNodeAffinity,
                com.google.cloud.vmmigration.v1.SchedulingNodeAffinity.Builder,
                com.google.cloud.vmmigration.v1.SchedulingNodeAffinityOrBuilder>(
                nodeAffinities_,
                ((bitField0_ & 0x00000004) != 0),
                getParentForChildren(),
                isClean());
        nodeAffinities_ = null;
      }
      return nodeAffinitiesBuilder_;
    }

    private int minNodeCpus_;
    /**
     *
     *
     * <pre>
     * The minimum number of virtual CPUs this instance will consume when
     * running on a sole-tenant node. Ignored if no node_affinites are
     * configured.
     * </pre>
     *
     * <code>int32 min_node_cpus = 4;</code>
     *
     * @return The minNodeCpus.
     */
    @java.lang.Override
    public int getMinNodeCpus() {
      return minNodeCpus_;
    }
    /**
     *
     *
     * <pre>
     * The minimum number of virtual CPUs this instance will consume when
     * running on a sole-tenant node. Ignored if no node_affinites are
     * configured.
     * </pre>
     *
     * <code>int32 min_node_cpus = 4;</code>
     *
     * @param value The minNodeCpus to set.
     * @return This builder for chaining.
     */
    public Builder setMinNodeCpus(int value) {

      minNodeCpus_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The minimum number of virtual CPUs this instance will consume when
     * running on a sole-tenant node. Ignored if no node_affinites are
     * configured.
     * </pre>
     *
     * <code>int32 min_node_cpus = 4;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearMinNodeCpus() {
      bitField0_ = (bitField0_ & ~0x00000008);
      minNodeCpus_ = 0;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.vmmigration.v1.ComputeScheduling)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.vmmigration.v1.ComputeScheduling)
  private static final com.google.cloud.vmmigration.v1.ComputeScheduling DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.vmmigration.v1.ComputeScheduling();
  }

  public static com.google.cloud.vmmigration.v1.ComputeScheduling getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<ComputeScheduling> PARSER =
      new com.google.protobuf.AbstractParser<ComputeScheduling>() {
        @java.lang.Override
        public ComputeScheduling parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<ComputeScheduling> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<ComputeScheduling> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.vmmigration.v1.ComputeScheduling getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
