/*
 * 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/api/servicecontrol/v1/quota_controller.proto

package com.google.api.servicecontrol.v1;

/**
 *
 *
 * <pre>
 * Represents information regarding a quota operation.
 * </pre>
 *
 * Protobuf type {@code google.api.servicecontrol.v1.QuotaOperation}
 */
public final class QuotaOperation extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.api.servicecontrol.v1.QuotaOperation)
    QuotaOperationOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use QuotaOperation.newBuilder() to construct.
  private QuotaOperation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private QuotaOperation() {
    operationId_ = "";
    methodName_ = "";
    consumerId_ = "";
    quotaMetrics_ = java.util.Collections.emptyList();
    quotaMode_ = 0;
  }

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

  @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.api.servicecontrol.v1.QuotaControllerProto
        .internal_static_google_api_servicecontrol_v1_QuotaOperation_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapField internalGetMapField(int number) {
    switch (number) {
      case 4:
        return internalGetLabels();
      default:
        throw new RuntimeException("Invalid map field number: " + number);
    }
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.api.servicecontrol.v1.QuotaControllerProto
        .internal_static_google_api_servicecontrol_v1_QuotaOperation_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.api.servicecontrol.v1.QuotaOperation.class,
            com.google.api.servicecontrol.v1.QuotaOperation.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * Supported quota modes.
   * </pre>
   *
   * Protobuf enum {@code google.api.servicecontrol.v1.QuotaOperation.QuotaMode}
   */
  public enum QuotaMode implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * Guard against implicit default. Must not be used.
     * </pre>
     *
     * <code>UNSPECIFIED = 0;</code>
     */
    UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * For AllocateQuota request, allocates quota for the amount specified in
     * the service configuration or specified using the quota metrics. If the
     * amount is higher than the available quota, allocation error will be
     * returned and no quota will be allocated.
     * If multiple quotas are part of the request, and one fails, none of the
     * quotas are allocated or released.
     * </pre>
     *
     * <code>NORMAL = 1;</code>
     */
    NORMAL(1),
    /**
     *
     *
     * <pre>
     * The operation allocates quota for the amount specified in the service
     * configuration or specified using the quota metrics. If the amount is
     * higher than the available quota, request does not fail but all available
     * quota will be allocated.
     * For rate quota, BEST_EFFORT will continue to deduct from other groups
     * even if one does not have enough quota. For allocation, it will find the
     * minimum available amount across all groups and deduct that amount from
     * all the affected groups.
     * </pre>
     *
     * <code>BEST_EFFORT = 2;</code>
     */
    BEST_EFFORT(2),
    /**
     *
     *
     * <pre>
     * For AllocateQuota request, only checks if there is enough quota
     * available and does not change the available quota. No lock is placed on
     * the available quota either.
     * </pre>
     *
     * <code>CHECK_ONLY = 3;</code>
     */
    CHECK_ONLY(3),
    /**
     *
     *
     * <pre>
     * Unimplemented. When used in AllocateQuotaRequest, this returns the
     * effective quota limit(s) in the response, and no quota check will be
     * performed. Not supported for other requests, and even for
     * AllocateQuotaRequest, this is currently supported only for allowlisted
     * services.
     * </pre>
     *
     * <code>QUERY_ONLY = 4;</code>
     */
    QUERY_ONLY(4),
    /**
     *
     *
     * <pre>
     * The operation allocates quota for the amount specified in the service
     * configuration or specified using the quota metrics. If the requested
     * amount is higher than the available quota, request does not fail and
     * remaining quota would become negative (going over the limit).
     * Not supported for Rate Quota.
     * </pre>
     *
     * <code>ADJUST_ONLY = 5;</code>
     */
    ADJUST_ONLY(5),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * Guard against implicit default. Must not be used.
     * </pre>
     *
     * <code>UNSPECIFIED = 0;</code>
     */
    public static final int UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * For AllocateQuota request, allocates quota for the amount specified in
     * the service configuration or specified using the quota metrics. If the
     * amount is higher than the available quota, allocation error will be
     * returned and no quota will be allocated.
     * If multiple quotas are part of the request, and one fails, none of the
     * quotas are allocated or released.
     * </pre>
     *
     * <code>NORMAL = 1;</code>
     */
    public static final int NORMAL_VALUE = 1;
    /**
     *
     *
     * <pre>
     * The operation allocates quota for the amount specified in the service
     * configuration or specified using the quota metrics. If the amount is
     * higher than the available quota, request does not fail but all available
     * quota will be allocated.
     * For rate quota, BEST_EFFORT will continue to deduct from other groups
     * even if one does not have enough quota. For allocation, it will find the
     * minimum available amount across all groups and deduct that amount from
     * all the affected groups.
     * </pre>
     *
     * <code>BEST_EFFORT = 2;</code>
     */
    public static final int BEST_EFFORT_VALUE = 2;
    /**
     *
     *
     * <pre>
     * For AllocateQuota request, only checks if there is enough quota
     * available and does not change the available quota. No lock is placed on
     * the available quota either.
     * </pre>
     *
     * <code>CHECK_ONLY = 3;</code>
     */
    public static final int CHECK_ONLY_VALUE = 3;
    /**
     *
     *
     * <pre>
     * Unimplemented. When used in AllocateQuotaRequest, this returns the
     * effective quota limit(s) in the response, and no quota check will be
     * performed. Not supported for other requests, and even for
     * AllocateQuotaRequest, this is currently supported only for allowlisted
     * services.
     * </pre>
     *
     * <code>QUERY_ONLY = 4;</code>
     */
    public static final int QUERY_ONLY_VALUE = 4;
    /**
     *
     *
     * <pre>
     * The operation allocates quota for the amount specified in the service
     * configuration or specified using the quota metrics. If the requested
     * amount is higher than the available quota, request does not fail and
     * remaining quota would become negative (going over the limit).
     * Not supported for Rate Quota.
     * </pre>
     *
     * <code>ADJUST_ONLY = 5;</code>
     */
    public static final int ADJUST_ONLY_VALUE = 5;

    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 QuotaMode 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 QuotaMode forNumber(int value) {
      switch (value) {
        case 0:
          return UNSPECIFIED;
        case 1:
          return NORMAL;
        case 2:
          return BEST_EFFORT;
        case 3:
          return CHECK_ONLY;
        case 4:
          return QUERY_ONLY;
        case 5:
          return ADJUST_ONLY;
        default:
          return null;
      }
    }

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

    private static final com.google.protobuf.Internal.EnumLiteMap<QuotaMode> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<QuotaMode>() {
          public QuotaMode findValueByNumber(int number) {
            return QuotaMode.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.api.servicecontrol.v1.QuotaOperation.getDescriptor().getEnumTypes().get(0);
    }

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

    public static QuotaMode 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 QuotaMode(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.api.servicecontrol.v1.QuotaOperation.QuotaMode)
  }

  public static final int OPERATION_ID_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object operationId_ = "";
  /**
   *
   *
   * <pre>
   * Identity of the operation. This is expected to be unique within the scope
   * of the service that generated the operation, and guarantees idempotency in
   * case of retries.
   * In order to ensure best performance and latency in the Quota backends,
   * operation_ids are optimally associated with time, so that related
   * operations can be accessed fast in storage. For this reason, the
   * recommended token for services that intend to operate at a high QPS is
   * Unix time in nanos + UUID
   * </pre>
   *
   * <code>string operation_id = 1;</code>
   *
   * @return The operationId.
   */
  @java.lang.Override
  public java.lang.String getOperationId() {
    java.lang.Object ref = operationId_;
    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();
      operationId_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Identity of the operation. This is expected to be unique within the scope
   * of the service that generated the operation, and guarantees idempotency in
   * case of retries.
   * In order to ensure best performance and latency in the Quota backends,
   * operation_ids are optimally associated with time, so that related
   * operations can be accessed fast in storage. For this reason, the
   * recommended token for services that intend to operate at a high QPS is
   * Unix time in nanos + UUID
   * </pre>
   *
   * <code>string operation_id = 1;</code>
   *
   * @return The bytes for operationId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getOperationIdBytes() {
    java.lang.Object ref = operationId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      operationId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int METHOD_NAME_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private volatile java.lang.Object methodName_ = "";
  /**
   *
   *
   * <pre>
   * Fully qualified name of the API method for which this quota operation is
   * requested. This name is used for matching quota rules or metric rules and
   * billing status rules defined in service configuration.
   * This field should not be set if any of the following is true:
   * (1) the quota operation is performed on non-API resources.
   * (2) quota_metrics is set because the caller is doing quota override.
   * Example of an RPC method name:
   *     google.example.library.v1.LibraryService.CreateShelf
   * </pre>
   *
   * <code>string method_name = 2;</code>
   *
   * @return The methodName.
   */
  @java.lang.Override
  public java.lang.String getMethodName() {
    java.lang.Object ref = methodName_;
    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();
      methodName_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Fully qualified name of the API method for which this quota operation is
   * requested. This name is used for matching quota rules or metric rules and
   * billing status rules defined in service configuration.
   * This field should not be set if any of the following is true:
   * (1) the quota operation is performed on non-API resources.
   * (2) quota_metrics is set because the caller is doing quota override.
   * Example of an RPC method name:
   *     google.example.library.v1.LibraryService.CreateShelf
   * </pre>
   *
   * <code>string method_name = 2;</code>
   *
   * @return The bytes for methodName.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getMethodNameBytes() {
    java.lang.Object ref = methodName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      methodName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CONSUMER_ID_FIELD_NUMBER = 3;

  @SuppressWarnings("serial")
  private volatile java.lang.Object consumerId_ = "";
  /**
   *
   *
   * <pre>
   * Identity of the consumer for whom this quota operation is being performed.
   * This can be in one of the following formats:
   *   project:&lt;project_id&gt;,
   *   project_number:&lt;project_number&gt;,
   *   api_key:&lt;api_key&gt;.
   * </pre>
   *
   * <code>string consumer_id = 3;</code>
   *
   * @return The consumerId.
   */
  @java.lang.Override
  public java.lang.String getConsumerId() {
    java.lang.Object ref = consumerId_;
    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();
      consumerId_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Identity of the consumer for whom this quota operation is being performed.
   * This can be in one of the following formats:
   *   project:&lt;project_id&gt;,
   *   project_number:&lt;project_number&gt;,
   *   api_key:&lt;api_key&gt;.
   * </pre>
   *
   * <code>string consumer_id = 3;</code>
   *
   * @return The bytes for consumerId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getConsumerIdBytes() {
    java.lang.Object ref = consumerId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      consumerId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int LABELS_FIELD_NUMBER = 4;

  private static final class LabelsDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry =
        com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance(
            com.google.api.servicecontrol.v1.QuotaControllerProto
                .internal_static_google_api_servicecontrol_v1_QuotaOperation_LabelsEntry_descriptor,
            com.google.protobuf.WireFormat.FieldType.STRING,
            "",
            com.google.protobuf.WireFormat.FieldType.STRING,
            "");
  }

  @SuppressWarnings("serial")
  private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_;

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
    if (labels_ == null) {
      return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
    }
    return labels_;
  }

  public int getLabelsCount() {
    return internalGetLabels().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * Labels describing the operation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 4;</code>
   */
  @java.lang.Override
  public boolean containsLabels(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    return internalGetLabels().getMap().containsKey(key);
  }
  /** Use {@link #getLabelsMap()} instead. */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getLabels() {
    return getLabelsMap();
  }
  /**
   *
   *
   * <pre>
   * Labels describing the operation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 4;</code>
   */
  @java.lang.Override
  public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
    return internalGetLabels().getMap();
  }
  /**
   *
   *
   * <pre>
   * Labels describing the operation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 4;</code>
   */
  @java.lang.Override
  public /* nullable */ java.lang.String getLabelsOrDefault(
      java.lang.String key,
      /* nullable */
      java.lang.String defaultValue) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * Labels describing the operation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 4;</code>
   */
  @java.lang.Override
  public java.lang.String getLabelsOrThrow(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int QUOTA_METRICS_FIELD_NUMBER = 5;

  @SuppressWarnings("serial")
  private java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> quotaMetrics_;
  /**
   *
   *
   * <pre>
   * Represents information about this operation. Each MetricValueSet
   * corresponds to a metric defined in the service configuration.
   * The data type used in the MetricValueSet must agree with
   * the data type specified in the metric definition.
   * Within a single operation, it is not allowed to have more than one
   * MetricValue instances that have the same metric names and identical
   * label value combinations. If a request has such duplicated MetricValue
   * instances, the entire request is rejected with
   * an invalid argument error.
   * This field is mutually exclusive with method_name.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> getQuotaMetricsList() {
    return quotaMetrics_;
  }
  /**
   *
   *
   * <pre>
   * Represents information about this operation. Each MetricValueSet
   * corresponds to a metric defined in the service configuration.
   * The data type used in the MetricValueSet must agree with
   * the data type specified in the metric definition.
   * Within a single operation, it is not allowed to have more than one
   * MetricValue instances that have the same metric names and identical
   * label value combinations. If a request has such duplicated MetricValue
   * instances, the entire request is rejected with
   * an invalid argument error.
   * This field is mutually exclusive with method_name.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.api.servicecontrol.v1.MetricValueSetOrBuilder>
      getQuotaMetricsOrBuilderList() {
    return quotaMetrics_;
  }
  /**
   *
   *
   * <pre>
   * Represents information about this operation. Each MetricValueSet
   * corresponds to a metric defined in the service configuration.
   * The data type used in the MetricValueSet must agree with
   * the data type specified in the metric definition.
   * Within a single operation, it is not allowed to have more than one
   * MetricValue instances that have the same metric names and identical
   * label value combinations. If a request has such duplicated MetricValue
   * instances, the entire request is rejected with
   * an invalid argument error.
   * This field is mutually exclusive with method_name.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
   */
  @java.lang.Override
  public int getQuotaMetricsCount() {
    return quotaMetrics_.size();
  }
  /**
   *
   *
   * <pre>
   * Represents information about this operation. Each MetricValueSet
   * corresponds to a metric defined in the service configuration.
   * The data type used in the MetricValueSet must agree with
   * the data type specified in the metric definition.
   * Within a single operation, it is not allowed to have more than one
   * MetricValue instances that have the same metric names and identical
   * label value combinations. If a request has such duplicated MetricValue
   * instances, the entire request is rejected with
   * an invalid argument error.
   * This field is mutually exclusive with method_name.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
   */
  @java.lang.Override
  public com.google.api.servicecontrol.v1.MetricValueSet getQuotaMetrics(int index) {
    return quotaMetrics_.get(index);
  }
  /**
   *
   *
   * <pre>
   * Represents information about this operation. Each MetricValueSet
   * corresponds to a metric defined in the service configuration.
   * The data type used in the MetricValueSet must agree with
   * the data type specified in the metric definition.
   * Within a single operation, it is not allowed to have more than one
   * MetricValue instances that have the same metric names and identical
   * label value combinations. If a request has such duplicated MetricValue
   * instances, the entire request is rejected with
   * an invalid argument error.
   * This field is mutually exclusive with method_name.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
   */
  @java.lang.Override
  public com.google.api.servicecontrol.v1.MetricValueSetOrBuilder getQuotaMetricsOrBuilder(
      int index) {
    return quotaMetrics_.get(index);
  }

  public static final int QUOTA_MODE_FIELD_NUMBER = 6;
  private int quotaMode_ = 0;
  /**
   *
   *
   * <pre>
   * Quota mode for this operation.
   * </pre>
   *
   * <code>.google.api.servicecontrol.v1.QuotaOperation.QuotaMode quota_mode = 6;</code>
   *
   * @return The enum numeric value on the wire for quotaMode.
   */
  @java.lang.Override
  public int getQuotaModeValue() {
    return quotaMode_;
  }
  /**
   *
   *
   * <pre>
   * Quota mode for this operation.
   * </pre>
   *
   * <code>.google.api.servicecontrol.v1.QuotaOperation.QuotaMode quota_mode = 6;</code>
   *
   * @return The quotaMode.
   */
  @java.lang.Override
  public com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode getQuotaMode() {
    com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode result =
        com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode.forNumber(quotaMode_);
    return result == null
        ? com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode.UNRECOGNIZED
        : result;
  }

  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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(operationId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, operationId_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(methodName_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, methodName_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(consumerId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, consumerId_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4);
    for (int i = 0; i < quotaMetrics_.size(); i++) {
      output.writeMessage(5, quotaMetrics_.get(i));
    }
    if (quotaMode_
        != com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode.UNSPECIFIED.getNumber()) {
      output.writeEnum(6, quotaMode_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(operationId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, operationId_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(methodName_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, methodName_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(consumerId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, consumerId_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetLabels().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
          LabelsDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, labels__);
    }
    for (int i = 0; i < quotaMetrics_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, quotaMetrics_.get(i));
    }
    if (quotaMode_
        != com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode.UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, quotaMode_);
    }
    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.api.servicecontrol.v1.QuotaOperation)) {
      return super.equals(obj);
    }
    com.google.api.servicecontrol.v1.QuotaOperation other =
        (com.google.api.servicecontrol.v1.QuotaOperation) obj;

    if (!getOperationId().equals(other.getOperationId())) return false;
    if (!getMethodName().equals(other.getMethodName())) return false;
    if (!getConsumerId().equals(other.getConsumerId())) return false;
    if (!internalGetLabels().equals(other.internalGetLabels())) return false;
    if (!getQuotaMetricsList().equals(other.getQuotaMetricsList())) return false;
    if (quotaMode_ != other.quotaMode_) 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) + OPERATION_ID_FIELD_NUMBER;
    hash = (53 * hash) + getOperationId().hashCode();
    hash = (37 * hash) + METHOD_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getMethodName().hashCode();
    hash = (37 * hash) + CONSUMER_ID_FIELD_NUMBER;
    hash = (53 * hash) + getConsumerId().hashCode();
    if (!internalGetLabels().getMap().isEmpty()) {
      hash = (37 * hash) + LABELS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetLabels().hashCode();
    }
    if (getQuotaMetricsCount() > 0) {
      hash = (37 * hash) + QUOTA_METRICS_FIELD_NUMBER;
      hash = (53 * hash) + getQuotaMetricsList().hashCode();
    }
    hash = (37 * hash) + QUOTA_MODE_FIELD_NUMBER;
    hash = (53 * hash) + quotaMode_;
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.api.servicecontrol.v1.QuotaOperation parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.api.servicecontrol.v1.QuotaOperation parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

  public static com.google.api.servicecontrol.v1.QuotaOperation 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.api.servicecontrol.v1.QuotaOperation 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>
   * Represents information regarding a quota operation.
   * </pre>
   *
   * Protobuf type {@code google.api.servicecontrol.v1.QuotaOperation}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.api.servicecontrol.v1.QuotaOperation)
      com.google.api.servicecontrol.v1.QuotaOperationOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.api.servicecontrol.v1.QuotaControllerProto
          .internal_static_google_api_servicecontrol_v1_QuotaOperation_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(int number) {
      switch (number) {
        case 4:
          return internalGetLabels();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(int number) {
      switch (number) {
        case 4:
          return internalGetMutableLabels();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.api.servicecontrol.v1.QuotaControllerProto
          .internal_static_google_api_servicecontrol_v1_QuotaOperation_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.api.servicecontrol.v1.QuotaOperation.class,
              com.google.api.servicecontrol.v1.QuotaOperation.Builder.class);
    }

    // Construct using com.google.api.servicecontrol.v1.QuotaOperation.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      operationId_ = "";
      methodName_ = "";
      consumerId_ = "";
      internalGetMutableLabels().clear();
      if (quotaMetricsBuilder_ == null) {
        quotaMetrics_ = java.util.Collections.emptyList();
      } else {
        quotaMetrics_ = null;
        quotaMetricsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000010);
      quotaMode_ = 0;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.api.servicecontrol.v1.QuotaControllerProto
          .internal_static_google_api_servicecontrol_v1_QuotaOperation_descriptor;
    }

    @java.lang.Override
    public com.google.api.servicecontrol.v1.QuotaOperation getDefaultInstanceForType() {
      return com.google.api.servicecontrol.v1.QuotaOperation.getDefaultInstance();
    }

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

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

    private void buildPartialRepeatedFields(
        com.google.api.servicecontrol.v1.QuotaOperation result) {
      if (quotaMetricsBuilder_ == null) {
        if (((bitField0_ & 0x00000010) != 0)) {
          quotaMetrics_ = java.util.Collections.unmodifiableList(quotaMetrics_);
          bitField0_ = (bitField0_ & ~0x00000010);
        }
        result.quotaMetrics_ = quotaMetrics_;
      } else {
        result.quotaMetrics_ = quotaMetricsBuilder_.build();
      }
    }

    private void buildPartial0(com.google.api.servicecontrol.v1.QuotaOperation result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.operationId_ = operationId_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.methodName_ = methodName_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.consumerId_ = consumerId_;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.labels_ = internalGetLabels();
        result.labels_.makeImmutable();
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.quotaMode_ = quotaMode_;
      }
    }

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

    public Builder mergeFrom(com.google.api.servicecontrol.v1.QuotaOperation other) {
      if (other == com.google.api.servicecontrol.v1.QuotaOperation.getDefaultInstance())
        return this;
      if (!other.getOperationId().isEmpty()) {
        operationId_ = other.operationId_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (!other.getMethodName().isEmpty()) {
        methodName_ = other.methodName_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      if (!other.getConsumerId().isEmpty()) {
        consumerId_ = other.consumerId_;
        bitField0_ |= 0x00000004;
        onChanged();
      }
      internalGetMutableLabels().mergeFrom(other.internalGetLabels());
      bitField0_ |= 0x00000008;
      if (quotaMetricsBuilder_ == null) {
        if (!other.quotaMetrics_.isEmpty()) {
          if (quotaMetrics_.isEmpty()) {
            quotaMetrics_ = other.quotaMetrics_;
            bitField0_ = (bitField0_ & ~0x00000010);
          } else {
            ensureQuotaMetricsIsMutable();
            quotaMetrics_.addAll(other.quotaMetrics_);
          }
          onChanged();
        }
      } else {
        if (!other.quotaMetrics_.isEmpty()) {
          if (quotaMetricsBuilder_.isEmpty()) {
            quotaMetricsBuilder_.dispose();
            quotaMetricsBuilder_ = null;
            quotaMetrics_ = other.quotaMetrics_;
            bitField0_ = (bitField0_ & ~0x00000010);
            quotaMetricsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getQuotaMetricsFieldBuilder()
                    : null;
          } else {
            quotaMetricsBuilder_.addAllMessages(other.quotaMetrics_);
          }
        }
      }
      if (other.quotaMode_ != 0) {
        setQuotaModeValue(other.getQuotaModeValue());
      }
      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 10:
              {
                operationId_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                methodName_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 26:
              {
                consumerId_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000004;
                break;
              } // case 26
            case 34:
              {
                com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
                    input.readMessage(
                        LabelsDefaultEntryHolder.defaultEntry.getParserForType(),
                        extensionRegistry);
                internalGetMutableLabels()
                    .getMutableMap()
                    .put(labels__.getKey(), labels__.getValue());
                bitField0_ |= 0x00000008;
                break;
              } // case 34
            case 42:
              {
                com.google.api.servicecontrol.v1.MetricValueSet m =
                    input.readMessage(
                        com.google.api.servicecontrol.v1.MetricValueSet.parser(),
                        extensionRegistry);
                if (quotaMetricsBuilder_ == null) {
                  ensureQuotaMetricsIsMutable();
                  quotaMetrics_.add(m);
                } else {
                  quotaMetricsBuilder_.addMessage(m);
                }
                break;
              } // case 42
            case 48:
              {
                quotaMode_ = input.readEnum();
                bitField0_ |= 0x00000020;
                break;
              } // case 48
            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 java.lang.Object operationId_ = "";
    /**
     *
     *
     * <pre>
     * Identity of the operation. This is expected to be unique within the scope
     * of the service that generated the operation, and guarantees idempotency in
     * case of retries.
     * In order to ensure best performance and latency in the Quota backends,
     * operation_ids are optimally associated with time, so that related
     * operations can be accessed fast in storage. For this reason, the
     * recommended token for services that intend to operate at a high QPS is
     * Unix time in nanos + UUID
     * </pre>
     *
     * <code>string operation_id = 1;</code>
     *
     * @return The operationId.
     */
    public java.lang.String getOperationId() {
      java.lang.Object ref = operationId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        operationId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Identity of the operation. This is expected to be unique within the scope
     * of the service that generated the operation, and guarantees idempotency in
     * case of retries.
     * In order to ensure best performance and latency in the Quota backends,
     * operation_ids are optimally associated with time, so that related
     * operations can be accessed fast in storage. For this reason, the
     * recommended token for services that intend to operate at a high QPS is
     * Unix time in nanos + UUID
     * </pre>
     *
     * <code>string operation_id = 1;</code>
     *
     * @return The bytes for operationId.
     */
    public com.google.protobuf.ByteString getOperationIdBytes() {
      java.lang.Object ref = operationId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        operationId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Identity of the operation. This is expected to be unique within the scope
     * of the service that generated the operation, and guarantees idempotency in
     * case of retries.
     * In order to ensure best performance and latency in the Quota backends,
     * operation_ids are optimally associated with time, so that related
     * operations can be accessed fast in storage. For this reason, the
     * recommended token for services that intend to operate at a high QPS is
     * Unix time in nanos + UUID
     * </pre>
     *
     * <code>string operation_id = 1;</code>
     *
     * @param value The operationId to set.
     * @return This builder for chaining.
     */
    public Builder setOperationId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      operationId_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identity of the operation. This is expected to be unique within the scope
     * of the service that generated the operation, and guarantees idempotency in
     * case of retries.
     * In order to ensure best performance and latency in the Quota backends,
     * operation_ids are optimally associated with time, so that related
     * operations can be accessed fast in storage. For this reason, the
     * recommended token for services that intend to operate at a high QPS is
     * Unix time in nanos + UUID
     * </pre>
     *
     * <code>string operation_id = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearOperationId() {
      operationId_ = getDefaultInstance().getOperationId();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identity of the operation. This is expected to be unique within the scope
     * of the service that generated the operation, and guarantees idempotency in
     * case of retries.
     * In order to ensure best performance and latency in the Quota backends,
     * operation_ids are optimally associated with time, so that related
     * operations can be accessed fast in storage. For this reason, the
     * recommended token for services that intend to operate at a high QPS is
     * Unix time in nanos + UUID
     * </pre>
     *
     * <code>string operation_id = 1;</code>
     *
     * @param value The bytes for operationId to set.
     * @return This builder for chaining.
     */
    public Builder setOperationIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      operationId_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private java.lang.Object methodName_ = "";
    /**
     *
     *
     * <pre>
     * Fully qualified name of the API method for which this quota operation is
     * requested. This name is used for matching quota rules or metric rules and
     * billing status rules defined in service configuration.
     * This field should not be set if any of the following is true:
     * (1) the quota operation is performed on non-API resources.
     * (2) quota_metrics is set because the caller is doing quota override.
     * Example of an RPC method name:
     *     google.example.library.v1.LibraryService.CreateShelf
     * </pre>
     *
     * <code>string method_name = 2;</code>
     *
     * @return The methodName.
     */
    public java.lang.String getMethodName() {
      java.lang.Object ref = methodName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        methodName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Fully qualified name of the API method for which this quota operation is
     * requested. This name is used for matching quota rules or metric rules and
     * billing status rules defined in service configuration.
     * This field should not be set if any of the following is true:
     * (1) the quota operation is performed on non-API resources.
     * (2) quota_metrics is set because the caller is doing quota override.
     * Example of an RPC method name:
     *     google.example.library.v1.LibraryService.CreateShelf
     * </pre>
     *
     * <code>string method_name = 2;</code>
     *
     * @return The bytes for methodName.
     */
    public com.google.protobuf.ByteString getMethodNameBytes() {
      java.lang.Object ref = methodName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        methodName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Fully qualified name of the API method for which this quota operation is
     * requested. This name is used for matching quota rules or metric rules and
     * billing status rules defined in service configuration.
     * This field should not be set if any of the following is true:
     * (1) the quota operation is performed on non-API resources.
     * (2) quota_metrics is set because the caller is doing quota override.
     * Example of an RPC method name:
     *     google.example.library.v1.LibraryService.CreateShelf
     * </pre>
     *
     * <code>string method_name = 2;</code>
     *
     * @param value The methodName to set.
     * @return This builder for chaining.
     */
    public Builder setMethodName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      methodName_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Fully qualified name of the API method for which this quota operation is
     * requested. This name is used for matching quota rules or metric rules and
     * billing status rules defined in service configuration.
     * This field should not be set if any of the following is true:
     * (1) the quota operation is performed on non-API resources.
     * (2) quota_metrics is set because the caller is doing quota override.
     * Example of an RPC method name:
     *     google.example.library.v1.LibraryService.CreateShelf
     * </pre>
     *
     * <code>string method_name = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearMethodName() {
      methodName_ = getDefaultInstance().getMethodName();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Fully qualified name of the API method for which this quota operation is
     * requested. This name is used for matching quota rules or metric rules and
     * billing status rules defined in service configuration.
     * This field should not be set if any of the following is true:
     * (1) the quota operation is performed on non-API resources.
     * (2) quota_metrics is set because the caller is doing quota override.
     * Example of an RPC method name:
     *     google.example.library.v1.LibraryService.CreateShelf
     * </pre>
     *
     * <code>string method_name = 2;</code>
     *
     * @param value The bytes for methodName to set.
     * @return This builder for chaining.
     */
    public Builder setMethodNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      methodName_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private java.lang.Object consumerId_ = "";
    /**
     *
     *
     * <pre>
     * Identity of the consumer for whom this quota operation is being performed.
     * This can be in one of the following formats:
     *   project:&lt;project_id&gt;,
     *   project_number:&lt;project_number&gt;,
     *   api_key:&lt;api_key&gt;.
     * </pre>
     *
     * <code>string consumer_id = 3;</code>
     *
     * @return The consumerId.
     */
    public java.lang.String getConsumerId() {
      java.lang.Object ref = consumerId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        consumerId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Identity of the consumer for whom this quota operation is being performed.
     * This can be in one of the following formats:
     *   project:&lt;project_id&gt;,
     *   project_number:&lt;project_number&gt;,
     *   api_key:&lt;api_key&gt;.
     * </pre>
     *
     * <code>string consumer_id = 3;</code>
     *
     * @return The bytes for consumerId.
     */
    public com.google.protobuf.ByteString getConsumerIdBytes() {
      java.lang.Object ref = consumerId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        consumerId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Identity of the consumer for whom this quota operation is being performed.
     * This can be in one of the following formats:
     *   project:&lt;project_id&gt;,
     *   project_number:&lt;project_number&gt;,
     *   api_key:&lt;api_key&gt;.
     * </pre>
     *
     * <code>string consumer_id = 3;</code>
     *
     * @param value The consumerId to set.
     * @return This builder for chaining.
     */
    public Builder setConsumerId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      consumerId_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identity of the consumer for whom this quota operation is being performed.
     * This can be in one of the following formats:
     *   project:&lt;project_id&gt;,
     *   project_number:&lt;project_number&gt;,
     *   api_key:&lt;api_key&gt;.
     * </pre>
     *
     * <code>string consumer_id = 3;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearConsumerId() {
      consumerId_ = getDefaultInstance().getConsumerId();
      bitField0_ = (bitField0_ & ~0x00000004);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identity of the consumer for whom this quota operation is being performed.
     * This can be in one of the following formats:
     *   project:&lt;project_id&gt;,
     *   project_number:&lt;project_number&gt;,
     *   api_key:&lt;api_key&gt;.
     * </pre>
     *
     * <code>string consumer_id = 3;</code>
     *
     * @param value The bytes for consumerId to set.
     * @return This builder for chaining.
     */
    public Builder setConsumerIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      consumerId_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_;

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
      if (labels_ == null) {
        return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
      }
      return labels_;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetMutableLabels() {
      if (labels_ == null) {
        labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry);
      }
      if (!labels_.isMutable()) {
        labels_ = labels_.copy();
      }
      bitField0_ |= 0x00000008;
      onChanged();
      return labels_;
    }

    public int getLabelsCount() {
      return internalGetLabels().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * Labels describing the operation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 4;</code>
     */
    @java.lang.Override
    public boolean containsLabels(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetLabels().getMap().containsKey(key);
    }
    /** Use {@link #getLabelsMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getLabels() {
      return getLabelsMap();
    }
    /**
     *
     *
     * <pre>
     * Labels describing the operation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 4;</code>
     */
    @java.lang.Override
    public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
      return internalGetLabels().getMap();
    }
    /**
     *
     *
     * <pre>
     * Labels describing the operation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 4;</code>
     */
    @java.lang.Override
    public /* nullable */ java.lang.String getLabelsOrDefault(
        java.lang.String key,
        /* nullable */
        java.lang.String defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * Labels describing the operation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 4;</code>
     */
    @java.lang.Override
    public java.lang.String getLabelsOrThrow(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearLabels() {
      bitField0_ = (bitField0_ & ~0x00000008);
      internalGetMutableLabels().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Labels describing the operation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 4;</code>
     */
    public Builder removeLabels(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      internalGetMutableLabels().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getMutableLabels() {
      bitField0_ |= 0x00000008;
      return internalGetMutableLabels().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * Labels describing the operation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 4;</code>
     */
    public Builder putLabels(java.lang.String key, java.lang.String value) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      if (value == null) {
        throw new NullPointerException("map value");
      }
      internalGetMutableLabels().getMutableMap().put(key, value);
      bitField0_ |= 0x00000008;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Labels describing the operation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 4;</code>
     */
    public Builder putAllLabels(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableLabels().getMutableMap().putAll(values);
      bitField0_ |= 0x00000008;
      return this;
    }

    private java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> quotaMetrics_ =
        java.util.Collections.emptyList();

    private void ensureQuotaMetricsIsMutable() {
      if (!((bitField0_ & 0x00000010) != 0)) {
        quotaMetrics_ =
            new java.util.ArrayList<com.google.api.servicecontrol.v1.MetricValueSet>(quotaMetrics_);
        bitField0_ |= 0x00000010;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.api.servicecontrol.v1.MetricValueSet,
            com.google.api.servicecontrol.v1.MetricValueSet.Builder,
            com.google.api.servicecontrol.v1.MetricValueSetOrBuilder>
        quotaMetricsBuilder_;

    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> getQuotaMetricsList() {
      if (quotaMetricsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(quotaMetrics_);
      } else {
        return quotaMetricsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public int getQuotaMetricsCount() {
      if (quotaMetricsBuilder_ == null) {
        return quotaMetrics_.size();
      } else {
        return quotaMetricsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet getQuotaMetrics(int index) {
      if (quotaMetricsBuilder_ == null) {
        return quotaMetrics_.get(index);
      } else {
        return quotaMetricsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder setQuotaMetrics(
        int index, com.google.api.servicecontrol.v1.MetricValueSet value) {
      if (quotaMetricsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.set(index, value);
        onChanged();
      } else {
        quotaMetricsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder setQuotaMetrics(
        int index, com.google.api.servicecontrol.v1.MetricValueSet.Builder builderForValue) {
      if (quotaMetricsBuilder_ == null) {
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.set(index, builderForValue.build());
        onChanged();
      } else {
        quotaMetricsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder addQuotaMetrics(com.google.api.servicecontrol.v1.MetricValueSet value) {
      if (quotaMetricsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.add(value);
        onChanged();
      } else {
        quotaMetricsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder addQuotaMetrics(
        int index, com.google.api.servicecontrol.v1.MetricValueSet value) {
      if (quotaMetricsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.add(index, value);
        onChanged();
      } else {
        quotaMetricsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder addQuotaMetrics(
        com.google.api.servicecontrol.v1.MetricValueSet.Builder builderForValue) {
      if (quotaMetricsBuilder_ == null) {
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.add(builderForValue.build());
        onChanged();
      } else {
        quotaMetricsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder addQuotaMetrics(
        int index, com.google.api.servicecontrol.v1.MetricValueSet.Builder builderForValue) {
      if (quotaMetricsBuilder_ == null) {
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.add(index, builderForValue.build());
        onChanged();
      } else {
        quotaMetricsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder addAllQuotaMetrics(
        java.lang.Iterable<? extends com.google.api.servicecontrol.v1.MetricValueSet> values) {
      if (quotaMetricsBuilder_ == null) {
        ensureQuotaMetricsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, quotaMetrics_);
        onChanged();
      } else {
        quotaMetricsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder clearQuotaMetrics() {
      if (quotaMetricsBuilder_ == null) {
        quotaMetrics_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000010);
        onChanged();
      } else {
        quotaMetricsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public Builder removeQuotaMetrics(int index) {
      if (quotaMetricsBuilder_ == null) {
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.remove(index);
        onChanged();
      } else {
        quotaMetricsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet.Builder getQuotaMetricsBuilder(
        int index) {
      return getQuotaMetricsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSetOrBuilder getQuotaMetricsOrBuilder(
        int index) {
      if (quotaMetricsBuilder_ == null) {
        return quotaMetrics_.get(index);
      } else {
        return quotaMetricsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public java.util.List<? extends com.google.api.servicecontrol.v1.MetricValueSetOrBuilder>
        getQuotaMetricsOrBuilderList() {
      if (quotaMetricsBuilder_ != null) {
        return quotaMetricsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(quotaMetrics_);
      }
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet.Builder addQuotaMetricsBuilder() {
      return getQuotaMetricsFieldBuilder()
          .addBuilder(com.google.api.servicecontrol.v1.MetricValueSet.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet.Builder addQuotaMetricsBuilder(
        int index) {
      return getQuotaMetricsFieldBuilder()
          .addBuilder(index, com.google.api.servicecontrol.v1.MetricValueSet.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Represents information about this operation. Each MetricValueSet
     * corresponds to a metric defined in the service configuration.
     * The data type used in the MetricValueSet must agree with
     * the data type specified in the metric definition.
     * Within a single operation, it is not allowed to have more than one
     * MetricValue instances that have the same metric names and identical
     * label value combinations. If a request has such duplicated MetricValue
     * instances, the entire request is rejected with
     * an invalid argument error.
     * This field is mutually exclusive with method_name.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 5;</code>
     */
    public java.util.List<com.google.api.servicecontrol.v1.MetricValueSet.Builder>
        getQuotaMetricsBuilderList() {
      return getQuotaMetricsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.api.servicecontrol.v1.MetricValueSet,
            com.google.api.servicecontrol.v1.MetricValueSet.Builder,
            com.google.api.servicecontrol.v1.MetricValueSetOrBuilder>
        getQuotaMetricsFieldBuilder() {
      if (quotaMetricsBuilder_ == null) {
        quotaMetricsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.api.servicecontrol.v1.MetricValueSet,
                com.google.api.servicecontrol.v1.MetricValueSet.Builder,
                com.google.api.servicecontrol.v1.MetricValueSetOrBuilder>(
                quotaMetrics_, ((bitField0_ & 0x00000010) != 0), getParentForChildren(), isClean());
        quotaMetrics_ = null;
      }
      return quotaMetricsBuilder_;
    }

    private int quotaMode_ = 0;
    /**
     *
     *
     * <pre>
     * Quota mode for this operation.
     * </pre>
     *
     * <code>.google.api.servicecontrol.v1.QuotaOperation.QuotaMode quota_mode = 6;</code>
     *
     * @return The enum numeric value on the wire for quotaMode.
     */
    @java.lang.Override
    public int getQuotaModeValue() {
      return quotaMode_;
    }
    /**
     *
     *
     * <pre>
     * Quota mode for this operation.
     * </pre>
     *
     * <code>.google.api.servicecontrol.v1.QuotaOperation.QuotaMode quota_mode = 6;</code>
     *
     * @param value The enum numeric value on the wire for quotaMode to set.
     * @return This builder for chaining.
     */
    public Builder setQuotaModeValue(int value) {
      quotaMode_ = value;
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quota mode for this operation.
     * </pre>
     *
     * <code>.google.api.servicecontrol.v1.QuotaOperation.QuotaMode quota_mode = 6;</code>
     *
     * @return The quotaMode.
     */
    @java.lang.Override
    public com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode getQuotaMode() {
      com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode result =
          com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode.forNumber(quotaMode_);
      return result == null
          ? com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * Quota mode for this operation.
     * </pre>
     *
     * <code>.google.api.servicecontrol.v1.QuotaOperation.QuotaMode quota_mode = 6;</code>
     *
     * @param value The quotaMode to set.
     * @return This builder for chaining.
     */
    public Builder setQuotaMode(com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000020;
      quotaMode_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quota mode for this operation.
     * </pre>
     *
     * <code>.google.api.servicecontrol.v1.QuotaOperation.QuotaMode quota_mode = 6;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearQuotaMode() {
      bitField0_ = (bitField0_ & ~0x00000020);
      quotaMode_ = 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.api.servicecontrol.v1.QuotaOperation)
  }

  // @@protoc_insertion_point(class_scope:google.api.servicecontrol.v1.QuotaOperation)
  private static final com.google.api.servicecontrol.v1.QuotaOperation DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.api.servicecontrol.v1.QuotaOperation();
  }

  public static com.google.api.servicecontrol.v1.QuotaOperation getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public com.google.api.servicecontrol.v1.QuotaOperation getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
