# 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.Eventarc.V1.Model.GoogleCloudEventarcV1PipelineRetryPolicy do
  @moduledoc """
  The retry policy configuration for the Pipeline. The pipeline exponentially backs off in case the destination is non responsive or returns a retryable error code. The default semantics are as follows: The backoff starts with a 5 second delay and doubles the delay after each failed attempt (10 seconds, 20 seconds, 40 seconds, etc.). The delay is capped at 60 seconds by default. Please note that if you set the min_retry_delay and max_retry_delay fields to the same value this will make the duration between retries constant.

  ## Attributes

  *   `maxAttempts` (*type:* `integer()`, *default:* `nil`) - Optional. The maximum number of delivery attempts for any message. The value must be between 1 and 100. The default value for this field is 5.
  *   `maxRetryDelay` (*type:* `String.t`, *default:* `nil`) - Optional. The maximum amount of seconds to wait between retry attempts. The value must be between 1 and 600. The default value for this field is 60.
  *   `minRetryDelay` (*type:* `String.t`, *default:* `nil`) - Optional. The minimum amount of seconds to wait between retry attempts. The value must be between 1 and 600. The default value for this field is 5.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :maxAttempts => integer() | nil,
          :maxRetryDelay => String.t() | nil,
          :minRetryDelay => String.t() | nil
        }

  field(:maxAttempts)
  field(:maxRetryDelay)
  field(:minRetryDelay)
end

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

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