# 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.GenericXdsConfig do
  @moduledoc """
  GenericXdsConfig is used to specify the config status and the dump of any xDS resource identified by their type URL. It is the generalized version of the now deprecated ListenersConfigDump, ClustersConfigDump etc [#next-free-field: 10]

  ## Attributes

  *   `clientStatus` (*type:* `String.t`, *default:* `nil`) - Per xDS resource status from the view of a xDS client
  *   `configStatus` (*type:* `String.t`, *default:* `nil`) - Per xDS resource config status. It is generated by management servers. It will not be present if the CSDS server is an xDS client.
  *   `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. [#not-implemented-hide:]
  *   `isStaticResource` (*type:* `boolean()`, *default:* `nil`) - Is static resource is true if it is specified in the config supplied through the file at the startup.
  *   `lastUpdated` (*type:* `DateTime.t`, *default:* `nil`) - Timestamp when the xDS resource was last updated
  *   `name` (*type:* `String.t`, *default:* `nil`) - Name of the xDS resource
  *   `typeUrl` (*type:* `String.t`, *default:* `nil`) - Type_url represents the fully qualified name of xDS resource type like envoy.v3.Cluster, envoy.v3.ClusterLoadAssignment etc.
  *   `versionInfo` (*type:* `String.t`, *default:* `nil`) - This is the :ref:`version_info ` in the last processed xDS discovery response. If there are only static bootstrap listeners, this field will be ""
  *   `xdsConfig` (*type:* `map()`, *default:* `nil`) - The xDS resource config. Actual content depends on the type
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :clientStatus => String.t() | nil,
          :configStatus => String.t() | nil,
          :errorState => GoogleApi.TrafficDirector.V3.Model.UpdateFailureState.t() | nil,
          :isStaticResource => boolean() | nil,
          :lastUpdated => DateTime.t() | nil,
          :name => String.t() | nil,
          :typeUrl => String.t() | nil,
          :versionInfo => String.t() | nil,
          :xdsConfig => map() | nil
        }

  field(:clientStatus)
  field(:configStatus)
  field(:errorState, as: GoogleApi.TrafficDirector.V3.Model.UpdateFailureState)
  field(:isStaticResource)
  field(:lastUpdated, as: DateTime)
  field(:name)
  field(:typeUrl)
  field(:versionInfo)
  field(:xdsConfig, type: :map)
end

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

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