# 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.ClustersConfigDump do
  @moduledoc """
  Envoy's cluster manager fills this message with all currently known clusters. Cluster configuration information can be used to recreate an Envoy configuration by populating all clusters as static clusters or by returning them in a CDS response.

  ## Attributes

  *   `dynamicActiveClusters` (*type:* `list(GoogleApi.TrafficDirector.V3.Model.DynamicCluster.t)`, *default:* `nil`) - The dynamically loaded active clusters. These are clusters that are available to service data plane traffic.
  *   `dynamicWarmingClusters` (*type:* `list(GoogleApi.TrafficDirector.V3.Model.DynamicCluster.t)`, *default:* `nil`) - The dynamically loaded warming clusters. These are clusters 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 clusters should generally be discarded.
  *   `staticClusters` (*type:* `list(GoogleApi.TrafficDirector.V3.Model.StaticCluster.t)`, *default:* `nil`) - The statically loaded cluster configs.
  *   `versionInfo` (*type:* `String.t`, *default:* `nil`) - This is the :ref:`version_info ` in the last processed CDS discovery response. If there are only static bootstrap clusters, this field will be "".
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :dynamicActiveClusters =>
            list(GoogleApi.TrafficDirector.V3.Model.DynamicCluster.t()) | nil,
          :dynamicWarmingClusters =>
            list(GoogleApi.TrafficDirector.V3.Model.DynamicCluster.t()) | nil,
          :staticClusters => list(GoogleApi.TrafficDirector.V3.Model.StaticCluster.t()) | nil,
          :versionInfo => String.t() | nil
        }

  field(:dynamicActiveClusters, as: GoogleApi.TrafficDirector.V3.Model.DynamicCluster, type: :list)

  field(:dynamicWarmingClusters,
    as: GoogleApi.TrafficDirector.V3.Model.DynamicCluster,
    type: :list
  )

  field(:staticClusters, as: GoogleApi.TrafficDirector.V3.Model.StaticCluster, type: :list)
  field(:versionInfo)
end

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

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