{-# 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.CloudHSMV2.Types.Certificates
-- 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.CloudHSMV2.Types.Certificates 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

-- | Contains one or more certificates or a certificate signing request
-- (CSR).
--
-- /See:/ 'newCertificates' smart constructor.
data Certificates = Certificates'
  { -- | The HSM hardware certificate issued (signed) by AWS CloudHSM.
    Certificates -> Maybe Text
awsHardwareCertificate :: Prelude.Maybe Prelude.Text,
    -- | The cluster certificate issued (signed) by the issuing certificate
    -- authority (CA) of the cluster\'s owner.
    Certificates -> Maybe Text
clusterCertificate :: Prelude.Maybe Prelude.Text,
    -- | The cluster\'s certificate signing request (CSR). The CSR exists only
    -- when the cluster\'s state is @UNINITIALIZED@.
    Certificates -> Maybe Text
clusterCsr :: Prelude.Maybe Prelude.Text,
    -- | The HSM certificate issued (signed) by the HSM hardware.
    Certificates -> Maybe Text
hsmCertificate :: Prelude.Maybe Prelude.Text,
    -- | The HSM hardware certificate issued (signed) by the hardware
    -- manufacturer.
    Certificates -> Maybe Text
manufacturerHardwareCertificate :: Prelude.Maybe Prelude.Text
  }
  deriving (Certificates -> Certificates -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Certificates -> Certificates -> Bool
$c/= :: Certificates -> Certificates -> Bool
== :: Certificates -> Certificates -> Bool
$c== :: Certificates -> Certificates -> Bool
Prelude.Eq, ReadPrec [Certificates]
ReadPrec Certificates
Int -> ReadS Certificates
ReadS [Certificates]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Certificates]
$creadListPrec :: ReadPrec [Certificates]
readPrec :: ReadPrec Certificates
$creadPrec :: ReadPrec Certificates
readList :: ReadS [Certificates]
$creadList :: ReadS [Certificates]
readsPrec :: Int -> ReadS Certificates
$creadsPrec :: Int -> ReadS Certificates
Prelude.Read, Int -> Certificates -> ShowS
[Certificates] -> ShowS
Certificates -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Certificates] -> ShowS
$cshowList :: [Certificates] -> ShowS
show :: Certificates -> String
$cshow :: Certificates -> String
showsPrec :: Int -> Certificates -> ShowS
$cshowsPrec :: Int -> Certificates -> ShowS
Prelude.Show, forall x. Rep Certificates x -> Certificates
forall x. Certificates -> Rep Certificates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Certificates x -> Certificates
$cfrom :: forall x. Certificates -> Rep Certificates x
Prelude.Generic)

-- |
-- Create a value of 'Certificates' 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:
--
-- 'awsHardwareCertificate', 'certificates_awsHardwareCertificate' - The HSM hardware certificate issued (signed) by AWS CloudHSM.
--
-- 'clusterCertificate', 'certificates_clusterCertificate' - The cluster certificate issued (signed) by the issuing certificate
-- authority (CA) of the cluster\'s owner.
--
-- 'clusterCsr', 'certificates_clusterCsr' - The cluster\'s certificate signing request (CSR). The CSR exists only
-- when the cluster\'s state is @UNINITIALIZED@.
--
-- 'hsmCertificate', 'certificates_hsmCertificate' - The HSM certificate issued (signed) by the HSM hardware.
--
-- 'manufacturerHardwareCertificate', 'certificates_manufacturerHardwareCertificate' - The HSM hardware certificate issued (signed) by the hardware
-- manufacturer.
newCertificates ::
  Certificates
newCertificates :: Certificates
newCertificates =
  Certificates'
    { $sel:awsHardwareCertificate:Certificates' :: Maybe Text
awsHardwareCertificate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:clusterCertificate:Certificates' :: Maybe Text
clusterCertificate = forall a. Maybe a
Prelude.Nothing,
      $sel:clusterCsr:Certificates' :: Maybe Text
clusterCsr = forall a. Maybe a
Prelude.Nothing,
      $sel:hsmCertificate:Certificates' :: Maybe Text
hsmCertificate = forall a. Maybe a
Prelude.Nothing,
      $sel:manufacturerHardwareCertificate:Certificates' :: Maybe Text
manufacturerHardwareCertificate = forall a. Maybe a
Prelude.Nothing
    }

-- | The HSM hardware certificate issued (signed) by AWS CloudHSM.
certificates_awsHardwareCertificate :: Lens.Lens' Certificates (Prelude.Maybe Prelude.Text)
certificates_awsHardwareCertificate :: Lens' Certificates (Maybe Text)
certificates_awsHardwareCertificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificates' {Maybe Text
awsHardwareCertificate :: Maybe Text
$sel:awsHardwareCertificate:Certificates' :: Certificates -> Maybe Text
awsHardwareCertificate} -> Maybe Text
awsHardwareCertificate) (\s :: Certificates
s@Certificates' {} Maybe Text
a -> Certificates
s {$sel:awsHardwareCertificate:Certificates' :: Maybe Text
awsHardwareCertificate = Maybe Text
a} :: Certificates)

-- | The cluster certificate issued (signed) by the issuing certificate
-- authority (CA) of the cluster\'s owner.
certificates_clusterCertificate :: Lens.Lens' Certificates (Prelude.Maybe Prelude.Text)
certificates_clusterCertificate :: Lens' Certificates (Maybe Text)
certificates_clusterCertificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificates' {Maybe Text
clusterCertificate :: Maybe Text
$sel:clusterCertificate:Certificates' :: Certificates -> Maybe Text
clusterCertificate} -> Maybe Text
clusterCertificate) (\s :: Certificates
s@Certificates' {} Maybe Text
a -> Certificates
s {$sel:clusterCertificate:Certificates' :: Maybe Text
clusterCertificate = Maybe Text
a} :: Certificates)

-- | The cluster\'s certificate signing request (CSR). The CSR exists only
-- when the cluster\'s state is @UNINITIALIZED@.
certificates_clusterCsr :: Lens.Lens' Certificates (Prelude.Maybe Prelude.Text)
certificates_clusterCsr :: Lens' Certificates (Maybe Text)
certificates_clusterCsr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificates' {Maybe Text
clusterCsr :: Maybe Text
$sel:clusterCsr:Certificates' :: Certificates -> Maybe Text
clusterCsr} -> Maybe Text
clusterCsr) (\s :: Certificates
s@Certificates' {} Maybe Text
a -> Certificates
s {$sel:clusterCsr:Certificates' :: Maybe Text
clusterCsr = Maybe Text
a} :: Certificates)

-- | The HSM certificate issued (signed) by the HSM hardware.
certificates_hsmCertificate :: Lens.Lens' Certificates (Prelude.Maybe Prelude.Text)
certificates_hsmCertificate :: Lens' Certificates (Maybe Text)
certificates_hsmCertificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificates' {Maybe Text
hsmCertificate :: Maybe Text
$sel:hsmCertificate:Certificates' :: Certificates -> Maybe Text
hsmCertificate} -> Maybe Text
hsmCertificate) (\s :: Certificates
s@Certificates' {} Maybe Text
a -> Certificates
s {$sel:hsmCertificate:Certificates' :: Maybe Text
hsmCertificate = Maybe Text
a} :: Certificates)

-- | The HSM hardware certificate issued (signed) by the hardware
-- manufacturer.
certificates_manufacturerHardwareCertificate :: Lens.Lens' Certificates (Prelude.Maybe Prelude.Text)
certificates_manufacturerHardwareCertificate :: Lens' Certificates (Maybe Text)
certificates_manufacturerHardwareCertificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificates' {Maybe Text
manufacturerHardwareCertificate :: Maybe Text
$sel:manufacturerHardwareCertificate:Certificates' :: Certificates -> Maybe Text
manufacturerHardwareCertificate} -> Maybe Text
manufacturerHardwareCertificate) (\s :: Certificates
s@Certificates' {} Maybe Text
a -> Certificates
s {$sel:manufacturerHardwareCertificate:Certificates' :: Maybe Text
manufacturerHardwareCertificate = Maybe Text
a} :: Certificates)

instance Data.FromJSON Certificates where
  parseJSON :: Value -> Parser Certificates
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Certificates"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Certificates
Certificates'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AwsHardwareCertificate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ClusterCertificate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ClusterCsr")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"HsmCertificate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ManufacturerHardwareCertificate")
      )

instance Prelude.Hashable Certificates where
  hashWithSalt :: Int -> Certificates -> Int
hashWithSalt Int
_salt Certificates' {Maybe Text
manufacturerHardwareCertificate :: Maybe Text
hsmCertificate :: Maybe Text
clusterCsr :: Maybe Text
clusterCertificate :: Maybe Text
awsHardwareCertificate :: Maybe Text
$sel:manufacturerHardwareCertificate:Certificates' :: Certificates -> Maybe Text
$sel:hsmCertificate:Certificates' :: Certificates -> Maybe Text
$sel:clusterCsr:Certificates' :: Certificates -> Maybe Text
$sel:clusterCertificate:Certificates' :: Certificates -> Maybe Text
$sel:awsHardwareCertificate:Certificates' :: Certificates -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsHardwareCertificate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clusterCertificate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clusterCsr
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hsmCertificate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
manufacturerHardwareCertificate

instance Prelude.NFData Certificates where
  rnf :: Certificates -> ()
rnf Certificates' {Maybe Text
manufacturerHardwareCertificate :: Maybe Text
hsmCertificate :: Maybe Text
clusterCsr :: Maybe Text
clusterCertificate :: Maybe Text
awsHardwareCertificate :: Maybe Text
$sel:manufacturerHardwareCertificate:Certificates' :: Certificates -> Maybe Text
$sel:hsmCertificate:Certificates' :: Certificates -> Maybe Text
$sel:clusterCsr:Certificates' :: Certificates -> Maybe Text
$sel:clusterCertificate:Certificates' :: Certificates -> Maybe Text
$sel:awsHardwareCertificate:Certificates' :: Certificates -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsHardwareCertificate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clusterCertificate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clusterCsr
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hsmCertificate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
manufacturerHardwareCertificate