# Copyright 2019 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
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ServiceControl.V1.Model.AllocateQuotaResponse do
  @moduledoc """
  Response message for the AllocateQuota method.

  ## Attributes

  *   `allocateErrors` (*type:* `list(GoogleApi.ServiceControl.V1.Model.QuotaError.t)`, *default:* `nil`) - Indicates the decision of the allocate.
  *   `allocateInfo` (*type:* `GoogleApi.ServiceControl.V1.Model.AllocateInfo.t`, *default:* `nil`) - WARNING: DO NOT use this field until this warning message is removed.
  *   `operationId` (*type:* `String.t`, *default:* `nil`) - The same operation_id value used in the AllocateQuotaRequest. Used for logging and diagnostics purposes.
  *   `quotaMetrics` (*type:* `list(GoogleApi.ServiceControl.V1.Model.MetricValueSet.t)`, *default:* `nil`) - 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"
  *   `serviceConfigId` (*type:* `String.t`, *default:* `nil`) - ID of the actual config used to process the request.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allocateErrors => list(GoogleApi.ServiceControl.V1.Model.QuotaError.t()) | nil,
          :allocateInfo => GoogleApi.ServiceControl.V1.Model.AllocateInfo.t() | nil,
          :operationId => String.t() | nil,
          :quotaMetrics => list(GoogleApi.ServiceControl.V1.Model.MetricValueSet.t()) | nil,
          :serviceConfigId => String.t() | nil
        }

  field(:allocateErrors, as: GoogleApi.ServiceControl.V1.Model.QuotaError, type: :list)
  field(:allocateInfo, as: GoogleApi.ServiceControl.V1.Model.AllocateInfo)
  field(:operationId)
  field(:quotaMetrics, as: GoogleApi.ServiceControl.V1.Model.MetricValueSet, type: :list)
  field(:serviceConfigId)
end

defimpl Poison.Decoder, for: GoogleApi.ServiceControl.V1.Model.AllocateQuotaResponse do
  def decode(value, options) do
    GoogleApi.ServiceControl.V1.Model.AllocateQuotaResponse.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ServiceControl.V1.Model.AllocateQuotaResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
