{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EC2.Types.CertificateAuthentication
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EC2.Types.CertificateAuthentication where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Information about the client certificate used for authentication.
--
-- /See:/ 'newCertificateAuthentication' smart constructor.
data CertificateAuthentication = CertificateAuthentication'
  { -- | The ARN of the client certificate.
    CertificateAuthentication -> Maybe Text
clientRootCertificateChain :: Prelude.Maybe Prelude.Text
  }
  deriving (CertificateAuthentication -> CertificateAuthentication -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CertificateAuthentication -> CertificateAuthentication -> Bool
$c/= :: CertificateAuthentication -> CertificateAuthentication -> Bool
== :: CertificateAuthentication -> CertificateAuthentication -> Bool
$c== :: CertificateAuthentication -> CertificateAuthentication -> Bool
Prelude.Eq, ReadPrec [CertificateAuthentication]
ReadPrec CertificateAuthentication
Int -> ReadS CertificateAuthentication
ReadS [CertificateAuthentication]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CertificateAuthentication]
$creadListPrec :: ReadPrec [CertificateAuthentication]
readPrec :: ReadPrec CertificateAuthentication
$creadPrec :: ReadPrec CertificateAuthentication
readList :: ReadS [CertificateAuthentication]
$creadList :: ReadS [CertificateAuthentication]
readsPrec :: Int -> ReadS CertificateAuthentication
$creadsPrec :: Int -> ReadS CertificateAuthentication
Prelude.Read, Int -> CertificateAuthentication -> ShowS
[CertificateAuthentication] -> ShowS
CertificateAuthentication -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CertificateAuthentication] -> ShowS
$cshowList :: [CertificateAuthentication] -> ShowS
show :: CertificateAuthentication -> String
$cshow :: CertificateAuthentication -> String
showsPrec :: Int -> CertificateAuthentication -> ShowS
$cshowsPrec :: Int -> CertificateAuthentication -> ShowS
Prelude.Show, forall x.
Rep CertificateAuthentication x -> CertificateAuthentication
forall x.
CertificateAuthentication -> Rep CertificateAuthentication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CertificateAuthentication x -> CertificateAuthentication
$cfrom :: forall x.
CertificateAuthentication -> Rep CertificateAuthentication x
Prelude.Generic)

-- |
-- Create a value of 'CertificateAuthentication' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'clientRootCertificateChain', 'certificateAuthentication_clientRootCertificateChain' - The ARN of the client certificate.
newCertificateAuthentication ::
  CertificateAuthentication
newCertificateAuthentication :: CertificateAuthentication
newCertificateAuthentication =
  CertificateAuthentication'
    { $sel:clientRootCertificateChain:CertificateAuthentication' :: Maybe Text
clientRootCertificateChain =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the client certificate.
certificateAuthentication_clientRootCertificateChain :: Lens.Lens' CertificateAuthentication (Prelude.Maybe Prelude.Text)
certificateAuthentication_clientRootCertificateChain :: Lens' CertificateAuthentication (Maybe Text)
certificateAuthentication_clientRootCertificateChain = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateAuthentication' {Maybe Text
clientRootCertificateChain :: Maybe Text
$sel:clientRootCertificateChain:CertificateAuthentication' :: CertificateAuthentication -> Maybe Text
clientRootCertificateChain} -> Maybe Text
clientRootCertificateChain) (\s :: CertificateAuthentication
s@CertificateAuthentication' {} Maybe Text
a -> CertificateAuthentication
s {$sel:clientRootCertificateChain:CertificateAuthentication' :: Maybe Text
clientRootCertificateChain = Maybe Text
a} :: CertificateAuthentication)

instance Data.FromXML CertificateAuthentication where
  parseXML :: [Node] -> Either String CertificateAuthentication
parseXML [Node]
x =
    Maybe Text -> CertificateAuthentication
CertificateAuthentication'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"clientRootCertificateChain")

instance Prelude.Hashable CertificateAuthentication where
  hashWithSalt :: Int -> CertificateAuthentication -> Int
hashWithSalt Int
_salt CertificateAuthentication' {Maybe Text
clientRootCertificateChain :: Maybe Text
$sel:clientRootCertificateChain:CertificateAuthentication' :: CertificateAuthentication -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRootCertificateChain

instance Prelude.NFData CertificateAuthentication where
  rnf :: CertificateAuthentication -> ()
rnf CertificateAuthentication' {Maybe Text
clientRootCertificateChain :: Maybe Text
$sel:clientRootCertificateChain:CertificateAuthentication' :: CertificateAuthentication -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRootCertificateChain