# 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.CloudKMS.V1.Model.ServiceResolver do
  @moduledoc """
  A ServiceResolver represents an EKM replica that can be reached within an EkmConnection.

  ## Attributes

  *   `endpointFilter` (*type:* `String.t`, *default:* `nil`) - Optional. The filter applied to the endpoints of the resolved service. If no filter is specified, all endpoints will be considered. An endpoint will be chosen arbitrarily from the filtered list for each request. For endpoint filter syntax and examples, see https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest.
  *   `hostname` (*type:* `String.t`, *default:* `nil`) - Required. The hostname of the EKM replica used at TLS and HTTP layers.
  *   `serverCertificates` (*type:* `list(GoogleApi.CloudKMS.V1.Model.Certificate.t)`, *default:* `nil`) - Required. A list of leaf server certificates used to authenticate HTTPS connections to the EKM replica. Currently, a maximum of 10 Certificate is supported.
  *   `serviceDirectoryService` (*type:* `String.t`, *default:* `nil`) - Required. The resource name of the Service Directory service pointing to an EKM replica, in the format `projects/*/locations/*/namespaces/*/services/*`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :endpointFilter => String.t() | nil,
          :hostname => String.t() | nil,
          :serverCertificates => list(GoogleApi.CloudKMS.V1.Model.Certificate.t()) | nil,
          :serviceDirectoryService => String.t() | nil
        }

  field(:endpointFilter)
  field(:hostname)
  field(:serverCertificates, as: GoogleApi.CloudKMS.V1.Model.Certificate, type: :list)
  field(:serviceDirectoryService)
end

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

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