{-# 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.Redshift.Types.HsmClientCertificate
-- 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.Redshift.Types.HsmClientCertificate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.Tag

-- | Returns information about an HSM client certificate. The certificate is
-- stored in a secure Hardware Storage Module (HSM), and used by the Amazon
-- Redshift cluster to encrypt data files.
--
-- /See:/ 'newHsmClientCertificate' smart constructor.
data HsmClientCertificate = HsmClientCertificate'
  { -- | The identifier of the HSM client certificate.
    HsmClientCertificate -> Maybe Text
hsmClientCertificateIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The public key that the Amazon Redshift cluster will use to connect to
    -- the HSM. You must register the public key in the HSM.
    HsmClientCertificate -> Maybe Text
hsmClientCertificatePublicKey :: Prelude.Maybe Prelude.Text,
    -- | The list of tags for the HSM client certificate.
    HsmClientCertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (HsmClientCertificate -> HsmClientCertificate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HsmClientCertificate -> HsmClientCertificate -> Bool
$c/= :: HsmClientCertificate -> HsmClientCertificate -> Bool
== :: HsmClientCertificate -> HsmClientCertificate -> Bool
$c== :: HsmClientCertificate -> HsmClientCertificate -> Bool
Prelude.Eq, ReadPrec [HsmClientCertificate]
ReadPrec HsmClientCertificate
Int -> ReadS HsmClientCertificate
ReadS [HsmClientCertificate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HsmClientCertificate]
$creadListPrec :: ReadPrec [HsmClientCertificate]
readPrec :: ReadPrec HsmClientCertificate
$creadPrec :: ReadPrec HsmClientCertificate
readList :: ReadS [HsmClientCertificate]
$creadList :: ReadS [HsmClientCertificate]
readsPrec :: Int -> ReadS HsmClientCertificate
$creadsPrec :: Int -> ReadS HsmClientCertificate
Prelude.Read, Int -> HsmClientCertificate -> ShowS
[HsmClientCertificate] -> ShowS
HsmClientCertificate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HsmClientCertificate] -> ShowS
$cshowList :: [HsmClientCertificate] -> ShowS
show :: HsmClientCertificate -> String
$cshow :: HsmClientCertificate -> String
showsPrec :: Int -> HsmClientCertificate -> ShowS
$cshowsPrec :: Int -> HsmClientCertificate -> ShowS
Prelude.Show, forall x. Rep HsmClientCertificate x -> HsmClientCertificate
forall x. HsmClientCertificate -> Rep HsmClientCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HsmClientCertificate x -> HsmClientCertificate
$cfrom :: forall x. HsmClientCertificate -> Rep HsmClientCertificate x
Prelude.Generic)

-- |
-- Create a value of 'HsmClientCertificate' 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:
--
-- 'hsmClientCertificateIdentifier', 'hsmClientCertificate_hsmClientCertificateIdentifier' - The identifier of the HSM client certificate.
--
-- 'hsmClientCertificatePublicKey', 'hsmClientCertificate_hsmClientCertificatePublicKey' - The public key that the Amazon Redshift cluster will use to connect to
-- the HSM. You must register the public key in the HSM.
--
-- 'tags', 'hsmClientCertificate_tags' - The list of tags for the HSM client certificate.
newHsmClientCertificate ::
  HsmClientCertificate
newHsmClientCertificate :: HsmClientCertificate
newHsmClientCertificate =
  HsmClientCertificate'
    { $sel:hsmClientCertificateIdentifier:HsmClientCertificate' :: Maybe Text
hsmClientCertificateIdentifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:hsmClientCertificatePublicKey:HsmClientCertificate' :: Maybe Text
hsmClientCertificatePublicKey = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:HsmClientCertificate' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the HSM client certificate.
hsmClientCertificate_hsmClientCertificateIdentifier :: Lens.Lens' HsmClientCertificate (Prelude.Maybe Prelude.Text)
hsmClientCertificate_hsmClientCertificateIdentifier :: Lens' HsmClientCertificate (Maybe Text)
hsmClientCertificate_hsmClientCertificateIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HsmClientCertificate' {Maybe Text
hsmClientCertificateIdentifier :: Maybe Text
$sel:hsmClientCertificateIdentifier:HsmClientCertificate' :: HsmClientCertificate -> Maybe Text
hsmClientCertificateIdentifier} -> Maybe Text
hsmClientCertificateIdentifier) (\s :: HsmClientCertificate
s@HsmClientCertificate' {} Maybe Text
a -> HsmClientCertificate
s {$sel:hsmClientCertificateIdentifier:HsmClientCertificate' :: Maybe Text
hsmClientCertificateIdentifier = Maybe Text
a} :: HsmClientCertificate)

-- | The public key that the Amazon Redshift cluster will use to connect to
-- the HSM. You must register the public key in the HSM.
hsmClientCertificate_hsmClientCertificatePublicKey :: Lens.Lens' HsmClientCertificate (Prelude.Maybe Prelude.Text)
hsmClientCertificate_hsmClientCertificatePublicKey :: Lens' HsmClientCertificate (Maybe Text)
hsmClientCertificate_hsmClientCertificatePublicKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HsmClientCertificate' {Maybe Text
hsmClientCertificatePublicKey :: Maybe Text
$sel:hsmClientCertificatePublicKey:HsmClientCertificate' :: HsmClientCertificate -> Maybe Text
hsmClientCertificatePublicKey} -> Maybe Text
hsmClientCertificatePublicKey) (\s :: HsmClientCertificate
s@HsmClientCertificate' {} Maybe Text
a -> HsmClientCertificate
s {$sel:hsmClientCertificatePublicKey:HsmClientCertificate' :: Maybe Text
hsmClientCertificatePublicKey = Maybe Text
a} :: HsmClientCertificate)

-- | The list of tags for the HSM client certificate.
hsmClientCertificate_tags :: Lens.Lens' HsmClientCertificate (Prelude.Maybe [Tag])
hsmClientCertificate_tags :: Lens' HsmClientCertificate (Maybe [Tag])
hsmClientCertificate_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HsmClientCertificate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:HsmClientCertificate' :: HsmClientCertificate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: HsmClientCertificate
s@HsmClientCertificate' {} Maybe [Tag]
a -> HsmClientCertificate
s {$sel:tags:HsmClientCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: HsmClientCertificate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromXML HsmClientCertificate where
  parseXML :: [Node] -> Either String HsmClientCertificate
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe [Tag] -> HsmClientCertificate
HsmClientCertificate'
      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
"HsmClientCertificateIdentifier")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"HsmClientCertificatePublicKey")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Tags"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"Tag")
                  )

instance Prelude.Hashable HsmClientCertificate where
  hashWithSalt :: Int -> HsmClientCertificate -> Int
hashWithSalt Int
_salt HsmClientCertificate' {Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
hsmClientCertificatePublicKey :: Maybe Text
hsmClientCertificateIdentifier :: Maybe Text
$sel:tags:HsmClientCertificate' :: HsmClientCertificate -> Maybe [Tag]
$sel:hsmClientCertificatePublicKey:HsmClientCertificate' :: HsmClientCertificate -> Maybe Text
$sel:hsmClientCertificateIdentifier:HsmClientCertificate' :: HsmClientCertificate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hsmClientCertificateIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hsmClientCertificatePublicKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData HsmClientCertificate where
  rnf :: HsmClientCertificate -> ()
rnf HsmClientCertificate' {Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
hsmClientCertificatePublicKey :: Maybe Text
hsmClientCertificateIdentifier :: Maybe Text
$sel:tags:HsmClientCertificate' :: HsmClientCertificate -> Maybe [Tag]
$sel:hsmClientCertificatePublicKey:HsmClientCertificate' :: HsmClientCertificate -> Maybe Text
$sel:hsmClientCertificateIdentifier:HsmClientCertificate' :: HsmClientCertificate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hsmClientCertificateIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hsmClientCertificatePublicKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags