{-# 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.HsmStatus
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Redshift.Types.HsmStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal

-- | Describes the status of changes to HSM settings.
--
-- /See:/ 'newHsmStatus' smart constructor.
data HsmStatus = HsmStatus'
  { -- | Reports whether the Amazon Redshift cluster has finished applying any
    -- HSM settings changes specified in a modify cluster command.
    --
    -- Values: active, applying
    HsmStatus -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the HSM configuration that contains the
    -- information the Amazon Redshift cluster can use to retrieve and store
    -- keys in an HSM.
    HsmStatus -> Maybe Text
hsmConfigurationIdentifier :: Prelude.Maybe Prelude.Text,
    -- | Specifies the name of the HSM client certificate the Amazon Redshift
    -- cluster uses to retrieve the data encryption keys stored in an HSM.
    HsmStatus -> Maybe Text
hsmClientCertificateIdentifier :: Prelude.Maybe Prelude.Text
  }
  deriving (HsmStatus -> HsmStatus -> Bool
(HsmStatus -> HsmStatus -> Bool)
-> (HsmStatus -> HsmStatus -> Bool) -> Eq HsmStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HsmStatus -> HsmStatus -> Bool
$c/= :: HsmStatus -> HsmStatus -> Bool
== :: HsmStatus -> HsmStatus -> Bool
$c== :: HsmStatus -> HsmStatus -> Bool
Prelude.Eq, ReadPrec [HsmStatus]
ReadPrec HsmStatus
Int -> ReadS HsmStatus
ReadS [HsmStatus]
(Int -> ReadS HsmStatus)
-> ReadS [HsmStatus]
-> ReadPrec HsmStatus
-> ReadPrec [HsmStatus]
-> Read HsmStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HsmStatus]
$creadListPrec :: ReadPrec [HsmStatus]
readPrec :: ReadPrec HsmStatus
$creadPrec :: ReadPrec HsmStatus
readList :: ReadS [HsmStatus]
$creadList :: ReadS [HsmStatus]
readsPrec :: Int -> ReadS HsmStatus
$creadsPrec :: Int -> ReadS HsmStatus
Prelude.Read, Int -> HsmStatus -> ShowS
[HsmStatus] -> ShowS
HsmStatus -> String
(Int -> HsmStatus -> ShowS)
-> (HsmStatus -> String)
-> ([HsmStatus] -> ShowS)
-> Show HsmStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HsmStatus] -> ShowS
$cshowList :: [HsmStatus] -> ShowS
show :: HsmStatus -> String
$cshow :: HsmStatus -> String
showsPrec :: Int -> HsmStatus -> ShowS
$cshowsPrec :: Int -> HsmStatus -> ShowS
Prelude.Show, (forall x. HsmStatus -> Rep HsmStatus x)
-> (forall x. Rep HsmStatus x -> HsmStatus) -> Generic HsmStatus
forall x. Rep HsmStatus x -> HsmStatus
forall x. HsmStatus -> Rep HsmStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HsmStatus x -> HsmStatus
$cfrom :: forall x. HsmStatus -> Rep HsmStatus x
Prelude.Generic)

-- |
-- Create a value of 'HsmStatus' 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:
--
-- 'status', 'hsmStatus_status' - Reports whether the Amazon Redshift cluster has finished applying any
-- HSM settings changes specified in a modify cluster command.
--
-- Values: active, applying
--
-- 'hsmConfigurationIdentifier', 'hsmStatus_hsmConfigurationIdentifier' - Specifies the name of the HSM configuration that contains the
-- information the Amazon Redshift cluster can use to retrieve and store
-- keys in an HSM.
--
-- 'hsmClientCertificateIdentifier', 'hsmStatus_hsmClientCertificateIdentifier' - Specifies the name of the HSM client certificate the Amazon Redshift
-- cluster uses to retrieve the data encryption keys stored in an HSM.
newHsmStatus ::
  HsmStatus
newHsmStatus :: HsmStatus
newHsmStatus =
  HsmStatus' :: Maybe Text -> Maybe Text -> Maybe Text -> HsmStatus
HsmStatus'
    { $sel:status:HsmStatus' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hsmConfigurationIdentifier:HsmStatus' :: Maybe Text
hsmConfigurationIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hsmClientCertificateIdentifier:HsmStatus' :: Maybe Text
hsmClientCertificateIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Reports whether the Amazon Redshift cluster has finished applying any
-- HSM settings changes specified in a modify cluster command.
--
-- Values: active, applying
hsmStatus_status :: Lens.Lens' HsmStatus (Prelude.Maybe Prelude.Text)
hsmStatus_status :: (Maybe Text -> f (Maybe Text)) -> HsmStatus -> f HsmStatus
hsmStatus_status = (HsmStatus -> Maybe Text)
-> (HsmStatus -> Maybe Text -> HsmStatus)
-> Lens HsmStatus HsmStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HsmStatus' {Maybe Text
status :: Maybe Text
$sel:status:HsmStatus' :: HsmStatus -> Maybe Text
status} -> Maybe Text
status) (\s :: HsmStatus
s@HsmStatus' {} Maybe Text
a -> HsmStatus
s {$sel:status:HsmStatus' :: Maybe Text
status = Maybe Text
a} :: HsmStatus)

-- | Specifies the name of the HSM configuration that contains the
-- information the Amazon Redshift cluster can use to retrieve and store
-- keys in an HSM.
hsmStatus_hsmConfigurationIdentifier :: Lens.Lens' HsmStatus (Prelude.Maybe Prelude.Text)
hsmStatus_hsmConfigurationIdentifier :: (Maybe Text -> f (Maybe Text)) -> HsmStatus -> f HsmStatus
hsmStatus_hsmConfigurationIdentifier = (HsmStatus -> Maybe Text)
-> (HsmStatus -> Maybe Text -> HsmStatus)
-> Lens HsmStatus HsmStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HsmStatus' {Maybe Text
hsmConfigurationIdentifier :: Maybe Text
$sel:hsmConfigurationIdentifier:HsmStatus' :: HsmStatus -> Maybe Text
hsmConfigurationIdentifier} -> Maybe Text
hsmConfigurationIdentifier) (\s :: HsmStatus
s@HsmStatus' {} Maybe Text
a -> HsmStatus
s {$sel:hsmConfigurationIdentifier:HsmStatus' :: Maybe Text
hsmConfigurationIdentifier = Maybe Text
a} :: HsmStatus)

-- | Specifies the name of the HSM client certificate the Amazon Redshift
-- cluster uses to retrieve the data encryption keys stored in an HSM.
hsmStatus_hsmClientCertificateIdentifier :: Lens.Lens' HsmStatus (Prelude.Maybe Prelude.Text)
hsmStatus_hsmClientCertificateIdentifier :: (Maybe Text -> f (Maybe Text)) -> HsmStatus -> f HsmStatus
hsmStatus_hsmClientCertificateIdentifier = (HsmStatus -> Maybe Text)
-> (HsmStatus -> Maybe Text -> HsmStatus)
-> Lens HsmStatus HsmStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HsmStatus' {Maybe Text
hsmClientCertificateIdentifier :: Maybe Text
$sel:hsmClientCertificateIdentifier:HsmStatus' :: HsmStatus -> Maybe Text
hsmClientCertificateIdentifier} -> Maybe Text
hsmClientCertificateIdentifier) (\s :: HsmStatus
s@HsmStatus' {} Maybe Text
a -> HsmStatus
s {$sel:hsmClientCertificateIdentifier:HsmStatus' :: Maybe Text
hsmClientCertificateIdentifier = Maybe Text
a} :: HsmStatus)

instance Core.FromXML HsmStatus where
  parseXML :: [Node] -> Either String HsmStatus
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> HsmStatus
HsmStatus'
      (Maybe Text -> Maybe Text -> Maybe Text -> HsmStatus)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> HsmStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
      Either String (Maybe Text -> Maybe Text -> HsmStatus)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> HsmStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"HsmConfigurationIdentifier")
      Either String (Maybe Text -> HsmStatus)
-> Either String (Maybe Text) -> Either String HsmStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"HsmClientCertificateIdentifier")

instance Prelude.Hashable HsmStatus

instance Prelude.NFData HsmStatus