# 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.TrafficDirector.V3.Model.DynamicListener do
  @moduledoc """
  Describes a dynamically loaded listener via the LDS API. [#next-free-field: 7]

  ## Attributes

  *   `activeState` (*type:* `GoogleApi.TrafficDirector.V3.Model.DynamicListenerState.t`, *default:* `nil`) - The listener state for any active listener by this name. These are listeners that are available to service data plane traffic.
  *   `clientStatus` (*type:* `String.t`, *default:* `nil`) - The client status of this resource. [#not-implemented-hide:]
  *   `drainingState` (*type:* `GoogleApi.TrafficDirector.V3.Model.DynamicListenerState.t`, *default:* `nil`) - The listener state for any draining listener by this name. These are listeners that are currently undergoing draining in preparation to stop servicing data plane traffic. Note that if attempting to recreate an Envoy configuration from a configuration dump, the draining listeners should generally be discarded.
  *   `errorState` (*type:* `GoogleApi.TrafficDirector.V3.Model.UpdateFailureState.t`, *default:* `nil`) - Set if the last update failed, cleared after the next successful update. The ``error_state`` field contains the rejected version of this particular resource along with the reason and timestamp. For successfully updated or acknowledged resource, this field should be empty.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name or unique id of this listener, pulled from the DynamicListenerState config.
  *   `warmingState` (*type:* `GoogleApi.TrafficDirector.V3.Model.DynamicListenerState.t`, *default:* `nil`) - The listener state for any warming listener by this name. These are listeners that are currently undergoing warming in preparation to service data plane traffic. Note that if attempting to recreate an Envoy configuration from a configuration dump, the warming listeners should generally be discarded.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :activeState => GoogleApi.TrafficDirector.V3.Model.DynamicListenerState.t() | nil,
          :clientStatus => String.t() | nil,
          :drainingState => GoogleApi.TrafficDirector.V3.Model.DynamicListenerState.t() | nil,
          :errorState => GoogleApi.TrafficDirector.V3.Model.UpdateFailureState.t() | nil,
          :name => String.t() | nil,
          :warmingState => GoogleApi.TrafficDirector.V3.Model.DynamicListenerState.t() | nil
        }

  field(:activeState, as: GoogleApi.TrafficDirector.V3.Model.DynamicListenerState)
  field(:clientStatus)
  field(:drainingState, as: GoogleApi.TrafficDirector.V3.Model.DynamicListenerState)
  field(:errorState, as: GoogleApi.TrafficDirector.V3.Model.UpdateFailureState)
  field(:name)
  field(:warmingState, as: GoogleApi.TrafficDirector.V3.Model.DynamicListenerState)
end

defimpl Poison.Decoder, for: GoogleApi.TrafficDirector.V3.Model.DynamicListener do
  def decode(value, options) do
    GoogleApi.TrafficDirector.V3.Model.DynamicListener.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.TrafficDirector.V3.Model.DynamicListener do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
