# 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.Certificate do
  @moduledoc """
  A Certificate represents an X.509 certificate used to authenticate HTTPS connections to EKM replicas.

  ## Attributes

  *   `issuer` (*type:* `String.t`, *default:* `nil`) - Output only. The issuer distinguished name in RFC 2253 format. Only present if parsed is true.
  *   `notAfterTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The certificate is not valid after this time. Only present if parsed is true.
  *   `notBeforeTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The certificate is not valid before this time. Only present if parsed is true.
  *   `parsed` (*type:* `boolean()`, *default:* `nil`) - Output only. True if the certificate was parsed successfully.
  *   `rawDer` (*type:* `String.t`, *default:* `nil`) - Required. The raw certificate bytes in DER format.
  *   `serialNumber` (*type:* `String.t`, *default:* `nil`) - Output only. The certificate serial number as a hex string. Only present if parsed is true.
  *   `sha256Fingerprint` (*type:* `String.t`, *default:* `nil`) - Output only. The SHA-256 certificate fingerprint as a hex string. Only present if parsed is true.
  *   `subject` (*type:* `String.t`, *default:* `nil`) - Output only. The subject distinguished name in RFC 2253 format. Only present if parsed is true.
  *   `subjectAlternativeDnsNames` (*type:* `list(String.t)`, *default:* `nil`) - Output only. The subject Alternative DNS names. Only present if parsed is true.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :issuer => String.t() | nil,
          :notAfterTime => DateTime.t() | nil,
          :notBeforeTime => DateTime.t() | nil,
          :parsed => boolean() | nil,
          :rawDer => String.t() | nil,
          :serialNumber => String.t() | nil,
          :sha256Fingerprint => String.t() | nil,
          :subject => String.t() | nil,
          :subjectAlternativeDnsNames => list(String.t()) | nil
        }

  field(:issuer)
  field(:notAfterTime, as: DateTime)
  field(:notBeforeTime, as: DateTime)
  field(:parsed)
  field(:rawDer)
  field(:serialNumber)
  field(:sha256Fingerprint)
  field(:subject)
  field(:subjectAlternativeDnsNames, type: :list)
end

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

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