/*
 * Copyright 2023 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>
 * Response message for the AllocateQuota method.
 * </pre>
 *
 * Protobuf type {@code google.api.servicecontrol.v1.AllocateQuotaResponse}
 */
public final class AllocateQuotaResponse extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.api.servicecontrol.v1.AllocateQuotaResponse)
    AllocateQuotaResponseOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use AllocateQuotaResponse.newBuilder() to construct.
  private AllocateQuotaResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private AllocateQuotaResponse() {
    operationId_ = "";
    allocateErrors_ = java.util.Collections.emptyList();
    quotaMetrics_ = java.util.Collections.emptyList();
    serviceConfigId_ = "";
  }

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.api.servicecontrol.v1.QuotaControllerProto
        .internal_static_google_api_servicecontrol_v1_AllocateQuotaResponse_descriptor;
  }

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

  public static final int OPERATION_ID_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object operationId_ = "";
  /**
   *
   *
   * <pre>
   * The same operation_id value used in the AllocateQuotaRequest. Used for
   * logging and diagnostics purposes.
   * </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>
   * The same operation_id value used in the AllocateQuotaRequest. Used for
   * logging and diagnostics purposes.
   * </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 ALLOCATE_ERRORS_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private java.util.List<com.google.api.servicecontrol.v1.QuotaError> allocateErrors_;
  /**
   *
   *
   * <pre>
   * Indicates the decision of the allocate.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.api.servicecontrol.v1.QuotaError> getAllocateErrorsList() {
    return allocateErrors_;
  }
  /**
   *
   *
   * <pre>
   * Indicates the decision of the allocate.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.api.servicecontrol.v1.QuotaErrorOrBuilder>
      getAllocateErrorsOrBuilderList() {
    return allocateErrors_;
  }
  /**
   *
   *
   * <pre>
   * Indicates the decision of the allocate.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
   */
  @java.lang.Override
  public int getAllocateErrorsCount() {
    return allocateErrors_.size();
  }
  /**
   *
   *
   * <pre>
   * Indicates the decision of the allocate.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
   */
  @java.lang.Override
  public com.google.api.servicecontrol.v1.QuotaError getAllocateErrors(int index) {
    return allocateErrors_.get(index);
  }
  /**
   *
   *
   * <pre>
   * Indicates the decision of the allocate.
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
   */
  @java.lang.Override
  public com.google.api.servicecontrol.v1.QuotaErrorOrBuilder getAllocateErrorsOrBuilder(
      int index) {
    return allocateErrors_.get(index);
  }

  public static final int QUOTA_METRICS_FIELD_NUMBER = 3;

  @SuppressWarnings("serial")
  private java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> quotaMetrics_;
  /**
   *
   *
   * <pre>
   * Quota metrics to indicate the result of allocation. Depending on the
   * request, one or more of the following metrics will be included:
   *
   * 1. Per quota group or per quota metric incremental usage will be specified
   * using the following delta metric :
   *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
   *
   * 2. The quota limit reached condition will be specified using the following
   * boolean metric :
   *   "serviceruntime.googleapis.com/quota/exceeded"
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> getQuotaMetricsList() {
    return quotaMetrics_;
  }
  /**
   *
   *
   * <pre>
   * Quota metrics to indicate the result of allocation. Depending on the
   * request, one or more of the following metrics will be included:
   *
   * 1. Per quota group or per quota metric incremental usage will be specified
   * using the following delta metric :
   *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
   *
   * 2. The quota limit reached condition will be specified using the following
   * boolean metric :
   *   "serviceruntime.googleapis.com/quota/exceeded"
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.api.servicecontrol.v1.MetricValueSetOrBuilder>
      getQuotaMetricsOrBuilderList() {
    return quotaMetrics_;
  }
  /**
   *
   *
   * <pre>
   * Quota metrics to indicate the result of allocation. Depending on the
   * request, one or more of the following metrics will be included:
   *
   * 1. Per quota group or per quota metric incremental usage will be specified
   * using the following delta metric :
   *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
   *
   * 2. The quota limit reached condition will be specified using the following
   * boolean metric :
   *   "serviceruntime.googleapis.com/quota/exceeded"
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
   */
  @java.lang.Override
  public int getQuotaMetricsCount() {
    return quotaMetrics_.size();
  }
  /**
   *
   *
   * <pre>
   * Quota metrics to indicate the result of allocation. Depending on the
   * request, one or more of the following metrics will be included:
   *
   * 1. Per quota group or per quota metric incremental usage will be specified
   * using the following delta metric :
   *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
   *
   * 2. The quota limit reached condition will be specified using the following
   * boolean metric :
   *   "serviceruntime.googleapis.com/quota/exceeded"
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
   */
  @java.lang.Override
  public com.google.api.servicecontrol.v1.MetricValueSet getQuotaMetrics(int index) {
    return quotaMetrics_.get(index);
  }
  /**
   *
   *
   * <pre>
   * Quota metrics to indicate the result of allocation. Depending on the
   * request, one or more of the following metrics will be included:
   *
   * 1. Per quota group or per quota metric incremental usage will be specified
   * using the following delta metric :
   *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
   *
   * 2. The quota limit reached condition will be specified using the following
   * boolean metric :
   *   "serviceruntime.googleapis.com/quota/exceeded"
   * </pre>
   *
   * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
   */
  @java.lang.Override
  public com.google.api.servicecontrol.v1.MetricValueSetOrBuilder getQuotaMetricsOrBuilder(
      int index) {
    return quotaMetrics_.get(index);
  }

  public static final int SERVICE_CONFIG_ID_FIELD_NUMBER = 4;

  @SuppressWarnings("serial")
  private volatile java.lang.Object serviceConfigId_ = "";
  /**
   *
   *
   * <pre>
   * ID of the actual config used to process the request.
   * </pre>
   *
   * <code>string service_config_id = 4;</code>
   *
   * @return The serviceConfigId.
   */
  @java.lang.Override
  public java.lang.String getServiceConfigId() {
    java.lang.Object ref = serviceConfigId_;
    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();
      serviceConfigId_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * ID of the actual config used to process the request.
   * </pre>
   *
   * <code>string service_config_id = 4;</code>
   *
   * @return The bytes for serviceConfigId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getServiceConfigIdBytes() {
    java.lang.Object ref = serviceConfigId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      serviceConfigId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  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_);
    }
    for (int i = 0; i < allocateErrors_.size(); i++) {
      output.writeMessage(2, allocateErrors_.get(i));
    }
    for (int i = 0; i < quotaMetrics_.size(); i++) {
      output.writeMessage(3, quotaMetrics_.get(i));
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceConfigId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, serviceConfigId_);
    }
    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_);
    }
    for (int i = 0; i < allocateErrors_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, allocateErrors_.get(i));
    }
    for (int i = 0; i < quotaMetrics_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, quotaMetrics_.get(i));
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceConfigId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, serviceConfigId_);
    }
    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.AllocateQuotaResponse)) {
      return super.equals(obj);
    }
    com.google.api.servicecontrol.v1.AllocateQuotaResponse other =
        (com.google.api.servicecontrol.v1.AllocateQuotaResponse) obj;

    if (!getOperationId().equals(other.getOperationId())) return false;
    if (!getAllocateErrorsList().equals(other.getAllocateErrorsList())) return false;
    if (!getQuotaMetricsList().equals(other.getQuotaMetricsList())) return false;
    if (!getServiceConfigId().equals(other.getServiceConfigId())) 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();
    if (getAllocateErrorsCount() > 0) {
      hash = (37 * hash) + ALLOCATE_ERRORS_FIELD_NUMBER;
      hash = (53 * hash) + getAllocateErrorsList().hashCode();
    }
    if (getQuotaMetricsCount() > 0) {
      hash = (37 * hash) + QUOTA_METRICS_FIELD_NUMBER;
      hash = (53 * hash) + getQuotaMetricsList().hashCode();
    }
    hash = (37 * hash) + SERVICE_CONFIG_ID_FIELD_NUMBER;
    hash = (53 * hash) + getServiceConfigId().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

  public static com.google.api.servicecontrol.v1.AllocateQuotaResponse 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.AllocateQuotaResponse 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.AllocateQuotaResponse 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.AllocateQuotaResponse 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>
   * Response message for the AllocateQuota method.
   * </pre>
   *
   * Protobuf type {@code google.api.servicecontrol.v1.AllocateQuotaResponse}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.api.servicecontrol.v1.AllocateQuotaResponse)
      com.google.api.servicecontrol.v1.AllocateQuotaResponseOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.api.servicecontrol.v1.QuotaControllerProto
          .internal_static_google_api_servicecontrol_v1_AllocateQuotaResponse_descriptor;
    }

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

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      operationId_ = "";
      if (allocateErrorsBuilder_ == null) {
        allocateErrors_ = java.util.Collections.emptyList();
      } else {
        allocateErrors_ = null;
        allocateErrorsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      if (quotaMetricsBuilder_ == null) {
        quotaMetrics_ = java.util.Collections.emptyList();
      } else {
        quotaMetrics_ = null;
        quotaMetricsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000004);
      serviceConfigId_ = "";
      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_AllocateQuotaResponse_descriptor;
    }

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

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

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

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

    private void buildPartial0(com.google.api.servicecontrol.v1.AllocateQuotaResponse result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.operationId_ = operationId_;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.serviceConfigId_ = serviceConfigId_;
      }
    }

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

    public Builder mergeFrom(com.google.api.servicecontrol.v1.AllocateQuotaResponse other) {
      if (other == com.google.api.servicecontrol.v1.AllocateQuotaResponse.getDefaultInstance())
        return this;
      if (!other.getOperationId().isEmpty()) {
        operationId_ = other.operationId_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (allocateErrorsBuilder_ == null) {
        if (!other.allocateErrors_.isEmpty()) {
          if (allocateErrors_.isEmpty()) {
            allocateErrors_ = other.allocateErrors_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureAllocateErrorsIsMutable();
            allocateErrors_.addAll(other.allocateErrors_);
          }
          onChanged();
        }
      } else {
        if (!other.allocateErrors_.isEmpty()) {
          if (allocateErrorsBuilder_.isEmpty()) {
            allocateErrorsBuilder_.dispose();
            allocateErrorsBuilder_ = null;
            allocateErrors_ = other.allocateErrors_;
            bitField0_ = (bitField0_ & ~0x00000002);
            allocateErrorsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getAllocateErrorsFieldBuilder()
                    : null;
          } else {
            allocateErrorsBuilder_.addAllMessages(other.allocateErrors_);
          }
        }
      }
      if (quotaMetricsBuilder_ == null) {
        if (!other.quotaMetrics_.isEmpty()) {
          if (quotaMetrics_.isEmpty()) {
            quotaMetrics_ = other.quotaMetrics_;
            bitField0_ = (bitField0_ & ~0x00000004);
          } else {
            ensureQuotaMetricsIsMutable();
            quotaMetrics_.addAll(other.quotaMetrics_);
          }
          onChanged();
        }
      } else {
        if (!other.quotaMetrics_.isEmpty()) {
          if (quotaMetricsBuilder_.isEmpty()) {
            quotaMetricsBuilder_.dispose();
            quotaMetricsBuilder_ = null;
            quotaMetrics_ = other.quotaMetrics_;
            bitField0_ = (bitField0_ & ~0x00000004);
            quotaMetricsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getQuotaMetricsFieldBuilder()
                    : null;
          } else {
            quotaMetricsBuilder_.addAllMessages(other.quotaMetrics_);
          }
        }
      }
      if (!other.getServiceConfigId().isEmpty()) {
        serviceConfigId_ = other.serviceConfigId_;
        bitField0_ |= 0x00000008;
        onChanged();
      }
      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:
              {
                com.google.api.servicecontrol.v1.QuotaError m =
                    input.readMessage(
                        com.google.api.servicecontrol.v1.QuotaError.parser(), extensionRegistry);
                if (allocateErrorsBuilder_ == null) {
                  ensureAllocateErrorsIsMutable();
                  allocateErrors_.add(m);
                } else {
                  allocateErrorsBuilder_.addMessage(m);
                }
                break;
              } // case 18
            case 26:
              {
                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 26
            case 34:
              {
                serviceConfigId_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000008;
                break;
              } // case 34
            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>
     * The same operation_id value used in the AllocateQuotaRequest. Used for
     * logging and diagnostics purposes.
     * </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>
     * The same operation_id value used in the AllocateQuotaRequest. Used for
     * logging and diagnostics purposes.
     * </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>
     * The same operation_id value used in the AllocateQuotaRequest. Used for
     * logging and diagnostics purposes.
     * </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>
     * The same operation_id value used in the AllocateQuotaRequest. Used for
     * logging and diagnostics purposes.
     * </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>
     * The same operation_id value used in the AllocateQuotaRequest. Used for
     * logging and diagnostics purposes.
     * </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.util.List<com.google.api.servicecontrol.v1.QuotaError> allocateErrors_ =
        java.util.Collections.emptyList();

    private void ensureAllocateErrorsIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        allocateErrors_ =
            new java.util.ArrayList<com.google.api.servicecontrol.v1.QuotaError>(allocateErrors_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.api.servicecontrol.v1.QuotaError,
            com.google.api.servicecontrol.v1.QuotaError.Builder,
            com.google.api.servicecontrol.v1.QuotaErrorOrBuilder>
        allocateErrorsBuilder_;

    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public java.util.List<com.google.api.servicecontrol.v1.QuotaError> getAllocateErrorsList() {
      if (allocateErrorsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(allocateErrors_);
      } else {
        return allocateErrorsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public int getAllocateErrorsCount() {
      if (allocateErrorsBuilder_ == null) {
        return allocateErrors_.size();
      } else {
        return allocateErrorsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public com.google.api.servicecontrol.v1.QuotaError getAllocateErrors(int index) {
      if (allocateErrorsBuilder_ == null) {
        return allocateErrors_.get(index);
      } else {
        return allocateErrorsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder setAllocateErrors(int index, com.google.api.servicecontrol.v1.QuotaError value) {
      if (allocateErrorsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAllocateErrorsIsMutable();
        allocateErrors_.set(index, value);
        onChanged();
      } else {
        allocateErrorsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder setAllocateErrors(
        int index, com.google.api.servicecontrol.v1.QuotaError.Builder builderForValue) {
      if (allocateErrorsBuilder_ == null) {
        ensureAllocateErrorsIsMutable();
        allocateErrors_.set(index, builderForValue.build());
        onChanged();
      } else {
        allocateErrorsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder addAllocateErrors(com.google.api.servicecontrol.v1.QuotaError value) {
      if (allocateErrorsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAllocateErrorsIsMutable();
        allocateErrors_.add(value);
        onChanged();
      } else {
        allocateErrorsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder addAllocateErrors(int index, com.google.api.servicecontrol.v1.QuotaError value) {
      if (allocateErrorsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAllocateErrorsIsMutable();
        allocateErrors_.add(index, value);
        onChanged();
      } else {
        allocateErrorsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder addAllocateErrors(
        com.google.api.servicecontrol.v1.QuotaError.Builder builderForValue) {
      if (allocateErrorsBuilder_ == null) {
        ensureAllocateErrorsIsMutable();
        allocateErrors_.add(builderForValue.build());
        onChanged();
      } else {
        allocateErrorsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder addAllocateErrors(
        int index, com.google.api.servicecontrol.v1.QuotaError.Builder builderForValue) {
      if (allocateErrorsBuilder_ == null) {
        ensureAllocateErrorsIsMutable();
        allocateErrors_.add(index, builderForValue.build());
        onChanged();
      } else {
        allocateErrorsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder addAllAllocateErrors(
        java.lang.Iterable<? extends com.google.api.servicecontrol.v1.QuotaError> values) {
      if (allocateErrorsBuilder_ == null) {
        ensureAllocateErrorsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allocateErrors_);
        onChanged();
      } else {
        allocateErrorsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder clearAllocateErrors() {
      if (allocateErrorsBuilder_ == null) {
        allocateErrors_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        allocateErrorsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public Builder removeAllocateErrors(int index) {
      if (allocateErrorsBuilder_ == null) {
        ensureAllocateErrorsIsMutable();
        allocateErrors_.remove(index);
        onChanged();
      } else {
        allocateErrorsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public com.google.api.servicecontrol.v1.QuotaError.Builder getAllocateErrorsBuilder(int index) {
      return getAllocateErrorsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public com.google.api.servicecontrol.v1.QuotaErrorOrBuilder getAllocateErrorsOrBuilder(
        int index) {
      if (allocateErrorsBuilder_ == null) {
        return allocateErrors_.get(index);
      } else {
        return allocateErrorsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public java.util.List<? extends com.google.api.servicecontrol.v1.QuotaErrorOrBuilder>
        getAllocateErrorsOrBuilderList() {
      if (allocateErrorsBuilder_ != null) {
        return allocateErrorsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(allocateErrors_);
      }
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public com.google.api.servicecontrol.v1.QuotaError.Builder addAllocateErrorsBuilder() {
      return getAllocateErrorsFieldBuilder()
          .addBuilder(com.google.api.servicecontrol.v1.QuotaError.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public com.google.api.servicecontrol.v1.QuotaError.Builder addAllocateErrorsBuilder(int index) {
      return getAllocateErrorsFieldBuilder()
          .addBuilder(index, com.google.api.servicecontrol.v1.QuotaError.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Indicates the decision of the allocate.
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.QuotaError allocate_errors = 2;</code>
     */
    public java.util.List<com.google.api.servicecontrol.v1.QuotaError.Builder>
        getAllocateErrorsBuilderList() {
      return getAllocateErrorsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.api.servicecontrol.v1.QuotaError,
            com.google.api.servicecontrol.v1.QuotaError.Builder,
            com.google.api.servicecontrol.v1.QuotaErrorOrBuilder>
        getAllocateErrorsFieldBuilder() {
      if (allocateErrorsBuilder_ == null) {
        allocateErrorsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.api.servicecontrol.v1.QuotaError,
                com.google.api.servicecontrol.v1.QuotaError.Builder,
                com.google.api.servicecontrol.v1.QuotaErrorOrBuilder>(
                allocateErrors_,
                ((bitField0_ & 0x00000002) != 0),
                getParentForChildren(),
                isClean());
        allocateErrors_ = null;
      }
      return allocateErrorsBuilder_;
    }

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

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

    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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public int getQuotaMetricsCount() {
      if (quotaMetricsBuilder_ == null) {
        return quotaMetrics_.size();
      } else {
        return quotaMetricsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet getQuotaMetrics(int index) {
      if (quotaMetricsBuilder_ == null) {
        return quotaMetrics_.get(index);
      } else {
        return quotaMetricsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public Builder clearQuotaMetrics() {
      if (quotaMetricsBuilder_ == null) {
        quotaMetrics_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
      } else {
        quotaMetricsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public Builder removeQuotaMetrics(int index) {
      if (quotaMetricsBuilder_ == null) {
        ensureQuotaMetricsIsMutable();
        quotaMetrics_.remove(index);
        onChanged();
      } else {
        quotaMetricsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet.Builder getQuotaMetricsBuilder(
        int index) {
      return getQuotaMetricsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSetOrBuilder getQuotaMetricsOrBuilder(
        int index) {
      if (quotaMetricsBuilder_ == null) {
        return quotaMetrics_.get(index);
      } else {
        return quotaMetricsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet.Builder addQuotaMetricsBuilder() {
      return getQuotaMetricsFieldBuilder()
          .addBuilder(com.google.api.servicecontrol.v1.MetricValueSet.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</code>
     */
    public com.google.api.servicecontrol.v1.MetricValueSet.Builder addQuotaMetricsBuilder(
        int index) {
      return getQuotaMetricsFieldBuilder()
          .addBuilder(index, com.google.api.servicecontrol.v1.MetricValueSet.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Quota metrics to indicate the result of allocation. Depending on the
     * request, one or more of the following metrics will be included:
     *
     * 1. Per quota group or per quota metric incremental usage will be specified
     * using the following delta metric :
     *   "serviceruntime.googleapis.com/api/consumer/quota_used_count"
     *
     * 2. The quota limit reached condition will be specified using the following
     * boolean metric :
     *   "serviceruntime.googleapis.com/quota/exceeded"
     * </pre>
     *
     * <code>repeated .google.api.servicecontrol.v1.MetricValueSet quota_metrics = 3;</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_ & 0x00000004) != 0), getParentForChildren(), isClean());
        quotaMetrics_ = null;
      }
      return quotaMetricsBuilder_;
    }

    private java.lang.Object serviceConfigId_ = "";
    /**
     *
     *
     * <pre>
     * ID of the actual config used to process the request.
     * </pre>
     *
     * <code>string service_config_id = 4;</code>
     *
     * @return The serviceConfigId.
     */
    public java.lang.String getServiceConfigId() {
      java.lang.Object ref = serviceConfigId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        serviceConfigId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * ID of the actual config used to process the request.
     * </pre>
     *
     * <code>string service_config_id = 4;</code>
     *
     * @return The bytes for serviceConfigId.
     */
    public com.google.protobuf.ByteString getServiceConfigIdBytes() {
      java.lang.Object ref = serviceConfigId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        serviceConfigId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * ID of the actual config used to process the request.
     * </pre>
     *
     * <code>string service_config_id = 4;</code>
     *
     * @param value The serviceConfigId to set.
     * @return This builder for chaining.
     */
    public Builder setServiceConfigId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      serviceConfigId_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * ID of the actual config used to process the request.
     * </pre>
     *
     * <code>string service_config_id = 4;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearServiceConfigId() {
      serviceConfigId_ = getDefaultInstance().getServiceConfigId();
      bitField0_ = (bitField0_ & ~0x00000008);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * ID of the actual config used to process the request.
     * </pre>
     *
     * <code>string service_config_id = 4;</code>
     *
     * @param value The bytes for serviceConfigId to set.
     * @return This builder for chaining.
     */
    public Builder setServiceConfigIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      serviceConfigId_ = value;
      bitField0_ |= 0x00000008;
      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.AllocateQuotaResponse)
  }

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

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

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

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

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

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