/*
 * 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/compute/v1/compute.proto

package com.google.cloud.compute.v1;

/**
 *
 *
 * <pre>
 * This message defines settings for a consistent hash style load balancer.
 * </pre>
 *
 * Protobuf type {@code google.cloud.compute.v1.ConsistentHashLoadBalancerSettings}
 */
public final class ConsistentHashLoadBalancerSettings extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.compute.v1.ConsistentHashLoadBalancerSettings)
    ConsistentHashLoadBalancerSettingsOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use ConsistentHashLoadBalancerSettings.newBuilder() to construct.
  private ConsistentHashLoadBalancerSettings(
      com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private ConsistentHashLoadBalancerSettings() {
    httpHeaderName_ = "";
  }

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

  @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.compute.v1.Compute
        .internal_static_google_cloud_compute_v1_ConsistentHashLoadBalancerSettings_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.compute.v1.Compute
        .internal_static_google_cloud_compute_v1_ConsistentHashLoadBalancerSettings_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings.class,
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings.Builder.class);
  }

  private int bitField0_;
  public static final int HTTP_COOKIE_FIELD_NUMBER = 6673915;
  private com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie httpCookie_;
  /**
   *
   *
   * <pre>
   * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
   * </pre>
   *
   * <code>
   * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
   * </code>
   *
   * @return Whether the httpCookie field is set.
   */
  @java.lang.Override
  public boolean hasHttpCookie() {
    return ((bitField0_ & 0x00000001) != 0);
  }
  /**
   *
   *
   * <pre>
   * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
   * </pre>
   *
   * <code>
   * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
   * </code>
   *
   * @return The httpCookie.
   */
  @java.lang.Override
  public com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie getHttpCookie() {
    return httpCookie_ == null
        ? com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie
            .getDefaultInstance()
        : httpCookie_;
  }
  /**
   *
   *
   * <pre>
   * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
   * </pre>
   *
   * <code>
   * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookieOrBuilder
      getHttpCookieOrBuilder() {
    return httpCookie_ == null
        ? com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie
            .getDefaultInstance()
        : httpCookie_;
  }

  public static final int HTTP_HEADER_NAME_FIELD_NUMBER = 234798022;

  @SuppressWarnings("serial")
  private volatile java.lang.Object httpHeaderName_ = "";
  /**
   *
   *
   * <pre>
   * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
   * </pre>
   *
   * <code>optional string http_header_name = 234798022;</code>
   *
   * @return Whether the httpHeaderName field is set.
   */
  @java.lang.Override
  public boolean hasHttpHeaderName() {
    return ((bitField0_ & 0x00000002) != 0);
  }
  /**
   *
   *
   * <pre>
   * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
   * </pre>
   *
   * <code>optional string http_header_name = 234798022;</code>
   *
   * @return The httpHeaderName.
   */
  @java.lang.Override
  public java.lang.String getHttpHeaderName() {
    java.lang.Object ref = httpHeaderName_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      httpHeaderName_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
   * </pre>
   *
   * <code>optional string http_header_name = 234798022;</code>
   *
   * @return The bytes for httpHeaderName.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getHttpHeaderNameBytes() {
    java.lang.Object ref = httpHeaderName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      httpHeaderName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int MINIMUM_RING_SIZE_FIELD_NUMBER = 234380735;
  private long minimumRingSize_ = 0L;
  /**
   *
   *
   * <pre>
   * The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load distributions. If the number of hosts in the load balancing pool is larger than the ring size, each host will be assigned a single virtual node.
   * </pre>
   *
   * <code>optional int64 minimum_ring_size = 234380735;</code>
   *
   * @return Whether the minimumRingSize field is set.
   */
  @java.lang.Override
  public boolean hasMinimumRingSize() {
    return ((bitField0_ & 0x00000004) != 0);
  }
  /**
   *
   *
   * <pre>
   * The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load distributions. If the number of hosts in the load balancing pool is larger than the ring size, each host will be assigned a single virtual node.
   * </pre>
   *
   * <code>optional int64 minimum_ring_size = 234380735;</code>
   *
   * @return The minimumRingSize.
   */
  @java.lang.Override
  public long getMinimumRingSize() {
    return minimumRingSize_;
  }

  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 (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(6673915, getHttpCookie());
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      output.writeInt64(234380735, minimumRingSize_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 234798022, httpHeaderName_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(6673915, getHttpCookie());
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeInt64Size(234380735, minimumRingSize_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(234798022, httpHeaderName_);
    }
    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.compute.v1.ConsistentHashLoadBalancerSettings)) {
      return super.equals(obj);
    }
    com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings other =
        (com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings) obj;

    if (hasHttpCookie() != other.hasHttpCookie()) return false;
    if (hasHttpCookie()) {
      if (!getHttpCookie().equals(other.getHttpCookie())) return false;
    }
    if (hasHttpHeaderName() != other.hasHttpHeaderName()) return false;
    if (hasHttpHeaderName()) {
      if (!getHttpHeaderName().equals(other.getHttpHeaderName())) return false;
    }
    if (hasMinimumRingSize() != other.hasMinimumRingSize()) return false;
    if (hasMinimumRingSize()) {
      if (getMinimumRingSize() != other.getMinimumRingSize()) 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();
    if (hasHttpCookie()) {
      hash = (37 * hash) + HTTP_COOKIE_FIELD_NUMBER;
      hash = (53 * hash) + getHttpCookie().hashCode();
    }
    if (hasHttpHeaderName()) {
      hash = (37 * hash) + HTTP_HEADER_NAME_FIELD_NUMBER;
      hash = (53 * hash) + getHttpHeaderName().hashCode();
    }
    if (hasMinimumRingSize()) {
      hash = (37 * hash) + MINIMUM_RING_SIZE_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMinimumRingSize());
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings 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.compute.v1.ConsistentHashLoadBalancerSettings parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings 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.compute.v1.ConsistentHashLoadBalancerSettings parseFrom(
      byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings 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.compute.v1.ConsistentHashLoadBalancerSettings parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings 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.compute.v1.ConsistentHashLoadBalancerSettings parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings 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.compute.v1.ConsistentHashLoadBalancerSettings 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>
   * This message defines settings for a consistent hash style load balancer.
   * </pre>
   *
   * Protobuf type {@code google.cloud.compute.v1.ConsistentHashLoadBalancerSettings}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.compute.v1.ConsistentHashLoadBalancerSettings)
      com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.compute.v1.Compute
          .internal_static_google_cloud_compute_v1_ConsistentHashLoadBalancerSettings_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.compute.v1.Compute
          .internal_static_google_cloud_compute_v1_ConsistentHashLoadBalancerSettings_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings.class,
              com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings.Builder.class);
    }

    // Construct using com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
        getHttpCookieFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      httpCookie_ = null;
      if (httpCookieBuilder_ != null) {
        httpCookieBuilder_.dispose();
        httpCookieBuilder_ = null;
      }
      httpHeaderName_ = "";
      minimumRingSize_ = 0L;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.compute.v1.Compute
          .internal_static_google_cloud_compute_v1_ConsistentHashLoadBalancerSettings_descriptor;
    }

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

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

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

    private void buildPartial0(
        com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings result) {
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.httpCookie_ = httpCookieBuilder_ == null ? httpCookie_ : httpCookieBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.httpHeaderName_ = httpHeaderName_;
        to_bitField0_ |= 0x00000002;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.minimumRingSize_ = minimumRingSize_;
        to_bitField0_ |= 0x00000004;
      }
      result.bitField0_ |= to_bitField0_;
    }

    @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.compute.v1.ConsistentHashLoadBalancerSettings) {
        return mergeFrom((com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings other) {
      if (other
          == com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings.getDefaultInstance())
        return this;
      if (other.hasHttpCookie()) {
        mergeHttpCookie(other.getHttpCookie());
      }
      if (other.hasHttpHeaderName()) {
        httpHeaderName_ = other.httpHeaderName_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      if (other.hasMinimumRingSize()) {
        setMinimumRingSize(other.getMinimumRingSize());
      }
      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 53391322:
              {
                input.readMessage(getHttpCookieFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000001;
                break;
              } // case 53391322
            case 1875045880:
              {
                minimumRingSize_ = input.readInt64();
                bitField0_ |= 0x00000004;
                break;
              } // case 1875045880
            case 1878384178:
              {
                httpHeaderName_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 1878384178
            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 com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie httpCookie_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie,
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie.Builder,
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookieOrBuilder>
        httpCookieBuilder_;
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     *
     * @return Whether the httpCookie field is set.
     */
    public boolean hasHttpCookie() {
      return ((bitField0_ & 0x00000001) != 0);
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     *
     * @return The httpCookie.
     */
    public com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie
        getHttpCookie() {
      if (httpCookieBuilder_ == null) {
        return httpCookie_ == null
            ? com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie
                .getDefaultInstance()
            : httpCookie_;
      } else {
        return httpCookieBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     */
    public Builder setHttpCookie(
        com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie value) {
      if (httpCookieBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        httpCookie_ = value;
      } else {
        httpCookieBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     */
    public Builder setHttpCookie(
        com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie.Builder
            builderForValue) {
      if (httpCookieBuilder_ == null) {
        httpCookie_ = builderForValue.build();
      } else {
        httpCookieBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     */
    public Builder mergeHttpCookie(
        com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie value) {
      if (httpCookieBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)
            && httpCookie_ != null
            && httpCookie_
                != com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie
                    .getDefaultInstance()) {
          getHttpCookieBuilder().mergeFrom(value);
        } else {
          httpCookie_ = value;
        }
      } else {
        httpCookieBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     */
    public Builder clearHttpCookie() {
      bitField0_ = (bitField0_ & ~0x00000001);
      httpCookie_ = null;
      if (httpCookieBuilder_ != null) {
        httpCookieBuilder_.dispose();
        httpCookieBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     */
    public com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie.Builder
        getHttpCookieBuilder() {
      bitField0_ |= 0x00000001;
      onChanged();
      return getHttpCookieFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     */
    public com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookieOrBuilder
        getHttpCookieOrBuilder() {
      if (httpCookieBuilder_ != null) {
        return httpCookieBuilder_.getMessageOrBuilder();
      } else {
        return httpCookie_ == null
            ? com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie
                .getDefaultInstance()
            : httpCookie_;
      }
    }
    /**
     *
     *
     * <pre>
     * Hash is based on HTTP Cookie. This field describes a HTTP cookie that will be used as the hash key for the consistent hash load balancer. If the cookie is not present, it will be generated. This field is applicable if the sessionAffinity is set to HTTP_COOKIE. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.
     * </pre>
     *
     * <code>
     * optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915;
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie,
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie.Builder,
            com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookieOrBuilder>
        getHttpCookieFieldBuilder() {
      if (httpCookieBuilder_ == null) {
        httpCookieBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie,
                com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie.Builder,
                com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookieOrBuilder>(
                getHttpCookie(), getParentForChildren(), isClean());
        httpCookie_ = null;
      }
      return httpCookieBuilder_;
    }

    private java.lang.Object httpHeaderName_ = "";
    /**
     *
     *
     * <pre>
     * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
     * </pre>
     *
     * <code>optional string http_header_name = 234798022;</code>
     *
     * @return Whether the httpHeaderName field is set.
     */
    public boolean hasHttpHeaderName() {
      return ((bitField0_ & 0x00000002) != 0);
    }
    /**
     *
     *
     * <pre>
     * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
     * </pre>
     *
     * <code>optional string http_header_name = 234798022;</code>
     *
     * @return The httpHeaderName.
     */
    public java.lang.String getHttpHeaderName() {
      java.lang.Object ref = httpHeaderName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        httpHeaderName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
     * </pre>
     *
     * <code>optional string http_header_name = 234798022;</code>
     *
     * @return The bytes for httpHeaderName.
     */
    public com.google.protobuf.ByteString getHttpHeaderNameBytes() {
      java.lang.Object ref = httpHeaderName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        httpHeaderName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
     * </pre>
     *
     * <code>optional string http_header_name = 234798022;</code>
     *
     * @param value The httpHeaderName to set.
     * @return This builder for chaining.
     */
    public Builder setHttpHeaderName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      httpHeaderName_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
     * </pre>
     *
     * <code>optional string http_header_name = 234798022;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearHttpHeaderName() {
      httpHeaderName_ = getDefaultInstance().getHttpHeaderName();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD.
     * </pre>
     *
     * <code>optional string http_header_name = 234798022;</code>
     *
     * @param value The bytes for httpHeaderName to set.
     * @return This builder for chaining.
     */
    public Builder setHttpHeaderNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      httpHeaderName_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private long minimumRingSize_;
    /**
     *
     *
     * <pre>
     * The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load distributions. If the number of hosts in the load balancing pool is larger than the ring size, each host will be assigned a single virtual node.
     * </pre>
     *
     * <code>optional int64 minimum_ring_size = 234380735;</code>
     *
     * @return Whether the minimumRingSize field is set.
     */
    @java.lang.Override
    public boolean hasMinimumRingSize() {
      return ((bitField0_ & 0x00000004) != 0);
    }
    /**
     *
     *
     * <pre>
     * The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load distributions. If the number of hosts in the load balancing pool is larger than the ring size, each host will be assigned a single virtual node.
     * </pre>
     *
     * <code>optional int64 minimum_ring_size = 234380735;</code>
     *
     * @return The minimumRingSize.
     */
    @java.lang.Override
    public long getMinimumRingSize() {
      return minimumRingSize_;
    }
    /**
     *
     *
     * <pre>
     * The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load distributions. If the number of hosts in the load balancing pool is larger than the ring size, each host will be assigned a single virtual node.
     * </pre>
     *
     * <code>optional int64 minimum_ring_size = 234380735;</code>
     *
     * @param value The minimumRingSize to set.
     * @return This builder for chaining.
     */
    public Builder setMinimumRingSize(long value) {

      minimumRingSize_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load distributions. If the number of hosts in the load balancing pool is larger than the ring size, each host will be assigned a single virtual node.
     * </pre>
     *
     * <code>optional int64 minimum_ring_size = 234380735;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearMinimumRingSize() {
      bitField0_ = (bitField0_ & ~0x00000004);
      minimumRingSize_ = 0L;
      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.compute.v1.ConsistentHashLoadBalancerSettings)
  }

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

  static {
    DEFAULT_INSTANCE = new com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings();
  }

  public static com.google.cloud.compute.v1.ConsistentHashLoadBalancerSettings
      getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<ConsistentHashLoadBalancerSettings> PARSER =
      new com.google.protobuf.AbstractParser<ConsistentHashLoadBalancerSettings>() {
        @java.lang.Override
        public ConsistentHashLoadBalancerSettings 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<ConsistentHashLoadBalancerSettings> parser() {
    return PARSER;
  }

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

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