# 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.NetworkSecurity.V1.Model.MTLSPolicy do
  @moduledoc """
  Specification of the MTLSPolicy.

  ## Attributes

  *   `clientValidationCa` (*type:* `list(GoogleApi.NetworkSecurity.V1.Model.ValidationCA.t)`, *default:* `nil`) - Required if the policy is to be used with Traffic Director. For Application Load Balancers it must be empty. Defines the mechanism to obtain the Certificate Authority certificate to validate the client certificate.
  *   `clientValidationMode` (*type:* `String.t`, *default:* `nil`) - When the client presents an invalid certificate or no certificate to the load balancer, the `client_validation_mode` specifies how the client connection is handled. Required if the policy is to be used with the Application Load Balancers. For Traffic Director it must be empty.
  *   `clientValidationTrustConfig` (*type:* `String.t`, *default:* `nil`) - Reference to the TrustConfig from certificatemanager.googleapis.com namespace. If specified, the chain validation will be performed against certificates configured in the given TrustConfig. Allowed only if the policy is to be used with Application Load Balancers.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :clientValidationCa => list(GoogleApi.NetworkSecurity.V1.Model.ValidationCA.t()) | nil,
          :clientValidationMode => String.t() | nil,
          :clientValidationTrustConfig => String.t() | nil
        }

  field(:clientValidationCa, as: GoogleApi.NetworkSecurity.V1.Model.ValidationCA, type: :list)
  field(:clientValidationMode)
  field(:clientValidationTrustConfig)
end

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

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