# 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.Node do
  @moduledoc """
  Identifies a specific Envoy instance. The node identifier is presented to the management server, which may use this identifier to distinguish per Envoy configuration for serving. [#next-free-field: 13]

  ## Attributes

  *   `clientFeatures` (*type:* `list(String.t)`, *default:* `nil`) - Client feature support list. These are well known features described in the Envoy API repository for a given major version of an API. Client features use reverse DNS naming scheme, for example ``com.acme.feature``. See :ref:`the list of features ` that xDS client may support.
  *   `cluster` (*type:* `String.t`, *default:* `nil`) - Defines the local service cluster name where Envoy is running. Though optional, it should be set if any of the following features are used: :ref:`statsd `, :ref:`health check cluster verification `, :ref:`runtime override directory `, :ref:`user agent addition `, :ref:`HTTP global rate limiting `, :ref:`CDS `, and :ref:`HTTP tracing `, either in this message or via :option:`--service-cluster`.
  *   `dynamicParameters` (*type:* `%{optional(String.t) => GoogleApi.TrafficDirector.V3.Model.ContextParams.t}`, *default:* `nil`) - Map from xDS resource type URL to dynamic context parameters. These may vary at runtime (unlike other fields in this message). For example, the xDS client may have a shard identifier that changes during the lifetime of the xDS client. In Envoy, this would be achieved by updating the dynamic context on the Server::Instance's LocalInfo context provider. The shard ID dynamic parameter then appears in this field during future discovery requests.
  *   `extensions` (*type:* `list(GoogleApi.TrafficDirector.V3.Model.Extension.t)`, *default:* `nil`) - List of extensions and their versions supported by the node.
  *   `id` (*type:* `String.t`, *default:* `nil`) - An opaque node identifier for the Envoy node. This also provides the local service node name. It should be set if any of the following features are used: :ref:`statsd `, :ref:`CDS `, and :ref:`HTTP tracing `, either in this message or via :option:`--service-node`.
  *   `listeningAddresses` (*type:* `list(GoogleApi.TrafficDirector.V3.Model.Address.t)`, *default:* `nil`) - Known listening ports on the node as a generic hint to the management server for filtering :ref:`listeners ` to be returned. For example, if there is a listener bound to port 80, the list can optionally contain the SocketAddress ``(0.0.0.0,80)``. The field is optional and just a hint.
  *   `locality` (*type:* `GoogleApi.TrafficDirector.V3.Model.Locality.t`, *default:* `nil`) - Locality specifying where the Envoy instance is running.
  *   `metadata` (*type:* `map()`, *default:* `nil`) - Opaque metadata extending the node identifier. Envoy will pass this directly to the management server.
  *   `userAgentBuildVersion` (*type:* `GoogleApi.TrafficDirector.V3.Model.BuildVersion.t`, *default:* `nil`) - Structured version of the entity requesting config.
  *   `userAgentName` (*type:* `String.t`, *default:* `nil`) - Free-form string that identifies the entity requesting config. E.g. "envoy" or "grpc"
  *   `userAgentVersion` (*type:* `String.t`, *default:* `nil`) - Free-form string that identifies the version of the entity requesting config. E.g. "1.12.2" or "abcd1234", or "SpecialEnvoyBuild"
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :clientFeatures => list(String.t()) | nil,
          :cluster => String.t() | nil,
          :dynamicParameters =>
            %{optional(String.t()) => GoogleApi.TrafficDirector.V3.Model.ContextParams.t()} | nil,
          :extensions => list(GoogleApi.TrafficDirector.V3.Model.Extension.t()) | nil,
          :id => String.t() | nil,
          :listeningAddresses => list(GoogleApi.TrafficDirector.V3.Model.Address.t()) | nil,
          :locality => GoogleApi.TrafficDirector.V3.Model.Locality.t() | nil,
          :metadata => map() | nil,
          :userAgentBuildVersion => GoogleApi.TrafficDirector.V3.Model.BuildVersion.t() | nil,
          :userAgentName => String.t() | nil,
          :userAgentVersion => String.t() | nil
        }

  field(:clientFeatures, type: :list)
  field(:cluster)
  field(:dynamicParameters, as: GoogleApi.TrafficDirector.V3.Model.ContextParams, type: :map)
  field(:extensions, as: GoogleApi.TrafficDirector.V3.Model.Extension, type: :list)
  field(:id)
  field(:listeningAddresses, as: GoogleApi.TrafficDirector.V3.Model.Address, type: :list)
  field(:locality, as: GoogleApi.TrafficDirector.V3.Model.Locality)
  field(:metadata, type: :map)
  field(:userAgentBuildVersion, as: GoogleApi.TrafficDirector.V3.Model.BuildVersion)
  field(:userAgentName)
  field(:userAgentVersion)
end

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

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