{-# 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.VoiceId.Types.ServerSideEncryptionUpdateDetails
-- 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.VoiceId.Types.ServerSideEncryptionUpdateDetails 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.VoiceId.Types.ServerSideEncryptionUpdateStatus

-- | Details about the most recent server-side encryption configuration
-- update. When the server-side encryption configuration is changed,
-- dependency on the old KMS key is removed through an asynchronous
-- process. When this update is complete, the domain’s data can only be
-- accessed using the new KMS key.
--
-- /See:/ 'newServerSideEncryptionUpdateDetails' smart constructor.
data ServerSideEncryptionUpdateDetails = ServerSideEncryptionUpdateDetails'
  { -- | Message explaining the current UpdateStatus. When the UpdateStatus is
    -- FAILED, this message explains the cause of the failure.
    ServerSideEncryptionUpdateDetails -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The previous KMS key ID the domain was encrypted with, before
    -- ServerSideEncryptionConfiguration was updated to a new KMS key ID.
    ServerSideEncryptionUpdateDetails -> Maybe Text
oldKmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Status of the server-side encryption update. During an update, if there
    -- is an issue with the domain\'s current or old KMS key ID, such as an
    -- inaccessible or disabled key, then the status is FAILED. In order to
    -- resolve this, the key needs to be made accessible, and then an
    -- UpdateDomain call with the existing server-side encryption configuration
    -- will re-attempt this update process.
    ServerSideEncryptionUpdateDetails
-> Maybe ServerSideEncryptionUpdateStatus
updateStatus :: Prelude.Maybe ServerSideEncryptionUpdateStatus
  }
  deriving (ServerSideEncryptionUpdateDetails
-> ServerSideEncryptionUpdateDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerSideEncryptionUpdateDetails
-> ServerSideEncryptionUpdateDetails -> Bool
$c/= :: ServerSideEncryptionUpdateDetails
-> ServerSideEncryptionUpdateDetails -> Bool
== :: ServerSideEncryptionUpdateDetails
-> ServerSideEncryptionUpdateDetails -> Bool
$c== :: ServerSideEncryptionUpdateDetails
-> ServerSideEncryptionUpdateDetails -> Bool
Prelude.Eq, ReadPrec [ServerSideEncryptionUpdateDetails]
ReadPrec ServerSideEncryptionUpdateDetails
Int -> ReadS ServerSideEncryptionUpdateDetails
ReadS [ServerSideEncryptionUpdateDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerSideEncryptionUpdateDetails]
$creadListPrec :: ReadPrec [ServerSideEncryptionUpdateDetails]
readPrec :: ReadPrec ServerSideEncryptionUpdateDetails
$creadPrec :: ReadPrec ServerSideEncryptionUpdateDetails
readList :: ReadS [ServerSideEncryptionUpdateDetails]
$creadList :: ReadS [ServerSideEncryptionUpdateDetails]
readsPrec :: Int -> ReadS ServerSideEncryptionUpdateDetails
$creadsPrec :: Int -> ReadS ServerSideEncryptionUpdateDetails
Prelude.Read, Int -> ServerSideEncryptionUpdateDetails -> ShowS
[ServerSideEncryptionUpdateDetails] -> ShowS
ServerSideEncryptionUpdateDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerSideEncryptionUpdateDetails] -> ShowS
$cshowList :: [ServerSideEncryptionUpdateDetails] -> ShowS
show :: ServerSideEncryptionUpdateDetails -> String
$cshow :: ServerSideEncryptionUpdateDetails -> String
showsPrec :: Int -> ServerSideEncryptionUpdateDetails -> ShowS
$cshowsPrec :: Int -> ServerSideEncryptionUpdateDetails -> ShowS
Prelude.Show, forall x.
Rep ServerSideEncryptionUpdateDetails x
-> ServerSideEncryptionUpdateDetails
forall x.
ServerSideEncryptionUpdateDetails
-> Rep ServerSideEncryptionUpdateDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServerSideEncryptionUpdateDetails x
-> ServerSideEncryptionUpdateDetails
$cfrom :: forall x.
ServerSideEncryptionUpdateDetails
-> Rep ServerSideEncryptionUpdateDetails x
Prelude.Generic)

-- |
-- Create a value of 'ServerSideEncryptionUpdateDetails' 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:
--
-- 'message', 'serverSideEncryptionUpdateDetails_message' - Message explaining the current UpdateStatus. When the UpdateStatus is
-- FAILED, this message explains the cause of the failure.
--
-- 'oldKmsKeyId', 'serverSideEncryptionUpdateDetails_oldKmsKeyId' - The previous KMS key ID the domain was encrypted with, before
-- ServerSideEncryptionConfiguration was updated to a new KMS key ID.
--
-- 'updateStatus', 'serverSideEncryptionUpdateDetails_updateStatus' - Status of the server-side encryption update. During an update, if there
-- is an issue with the domain\'s current or old KMS key ID, such as an
-- inaccessible or disabled key, then the status is FAILED. In order to
-- resolve this, the key needs to be made accessible, and then an
-- UpdateDomain call with the existing server-side encryption configuration
-- will re-attempt this update process.
newServerSideEncryptionUpdateDetails ::
  ServerSideEncryptionUpdateDetails
newServerSideEncryptionUpdateDetails :: ServerSideEncryptionUpdateDetails
newServerSideEncryptionUpdateDetails =
  ServerSideEncryptionUpdateDetails'
    { $sel:message:ServerSideEncryptionUpdateDetails' :: Maybe Text
message =
        forall a. Maybe a
Prelude.Nothing,
      $sel:oldKmsKeyId:ServerSideEncryptionUpdateDetails' :: Maybe Text
oldKmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:updateStatus:ServerSideEncryptionUpdateDetails' :: Maybe ServerSideEncryptionUpdateStatus
updateStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | Message explaining the current UpdateStatus. When the UpdateStatus is
-- FAILED, this message explains the cause of the failure.
serverSideEncryptionUpdateDetails_message :: Lens.Lens' ServerSideEncryptionUpdateDetails (Prelude.Maybe Prelude.Text)
serverSideEncryptionUpdateDetails_message :: Lens' ServerSideEncryptionUpdateDetails (Maybe Text)
serverSideEncryptionUpdateDetails_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSideEncryptionUpdateDetails' {Maybe Text
message :: Maybe Text
$sel:message:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails -> Maybe Text
message} -> Maybe Text
message) (\s :: ServerSideEncryptionUpdateDetails
s@ServerSideEncryptionUpdateDetails' {} Maybe Text
a -> ServerSideEncryptionUpdateDetails
s {$sel:message:ServerSideEncryptionUpdateDetails' :: Maybe Text
message = Maybe Text
a} :: ServerSideEncryptionUpdateDetails)

-- | The previous KMS key ID the domain was encrypted with, before
-- ServerSideEncryptionConfiguration was updated to a new KMS key ID.
serverSideEncryptionUpdateDetails_oldKmsKeyId :: Lens.Lens' ServerSideEncryptionUpdateDetails (Prelude.Maybe Prelude.Text)
serverSideEncryptionUpdateDetails_oldKmsKeyId :: Lens' ServerSideEncryptionUpdateDetails (Maybe Text)
serverSideEncryptionUpdateDetails_oldKmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSideEncryptionUpdateDetails' {Maybe Text
oldKmsKeyId :: Maybe Text
$sel:oldKmsKeyId:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails -> Maybe Text
oldKmsKeyId} -> Maybe Text
oldKmsKeyId) (\s :: ServerSideEncryptionUpdateDetails
s@ServerSideEncryptionUpdateDetails' {} Maybe Text
a -> ServerSideEncryptionUpdateDetails
s {$sel:oldKmsKeyId:ServerSideEncryptionUpdateDetails' :: Maybe Text
oldKmsKeyId = Maybe Text
a} :: ServerSideEncryptionUpdateDetails)

-- | Status of the server-side encryption update. During an update, if there
-- is an issue with the domain\'s current or old KMS key ID, such as an
-- inaccessible or disabled key, then the status is FAILED. In order to
-- resolve this, the key needs to be made accessible, and then an
-- UpdateDomain call with the existing server-side encryption configuration
-- will re-attempt this update process.
serverSideEncryptionUpdateDetails_updateStatus :: Lens.Lens' ServerSideEncryptionUpdateDetails (Prelude.Maybe ServerSideEncryptionUpdateStatus)
serverSideEncryptionUpdateDetails_updateStatus :: Lens'
  ServerSideEncryptionUpdateDetails
  (Maybe ServerSideEncryptionUpdateStatus)
serverSideEncryptionUpdateDetails_updateStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSideEncryptionUpdateDetails' {Maybe ServerSideEncryptionUpdateStatus
updateStatus :: Maybe ServerSideEncryptionUpdateStatus
$sel:updateStatus:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails
-> Maybe ServerSideEncryptionUpdateStatus
updateStatus} -> Maybe ServerSideEncryptionUpdateStatus
updateStatus) (\s :: ServerSideEncryptionUpdateDetails
s@ServerSideEncryptionUpdateDetails' {} Maybe ServerSideEncryptionUpdateStatus
a -> ServerSideEncryptionUpdateDetails
s {$sel:updateStatus:ServerSideEncryptionUpdateDetails' :: Maybe ServerSideEncryptionUpdateStatus
updateStatus = Maybe ServerSideEncryptionUpdateStatus
a} :: ServerSideEncryptionUpdateDetails)

instance
  Data.FromJSON
    ServerSideEncryptionUpdateDetails
  where
  parseJSON :: Value -> Parser ServerSideEncryptionUpdateDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServerSideEncryptionUpdateDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ServerSideEncryptionUpdateStatus
-> ServerSideEncryptionUpdateDetails
ServerSideEncryptionUpdateDetails'
            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
"Message")
            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
"OldKmsKeyId")
            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
"UpdateStatus")
      )

instance
  Prelude.Hashable
    ServerSideEncryptionUpdateDetails
  where
  hashWithSalt :: Int -> ServerSideEncryptionUpdateDetails -> Int
hashWithSalt
    Int
_salt
    ServerSideEncryptionUpdateDetails' {Maybe Text
Maybe ServerSideEncryptionUpdateStatus
updateStatus :: Maybe ServerSideEncryptionUpdateStatus
oldKmsKeyId :: Maybe Text
message :: Maybe Text
$sel:updateStatus:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails
-> Maybe ServerSideEncryptionUpdateStatus
$sel:oldKmsKeyId:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails -> Maybe Text
$sel:message:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
oldKmsKeyId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServerSideEncryptionUpdateStatus
updateStatus

instance
  Prelude.NFData
    ServerSideEncryptionUpdateDetails
  where
  rnf :: ServerSideEncryptionUpdateDetails -> ()
rnf ServerSideEncryptionUpdateDetails' {Maybe Text
Maybe ServerSideEncryptionUpdateStatus
updateStatus :: Maybe ServerSideEncryptionUpdateStatus
oldKmsKeyId :: Maybe Text
message :: Maybe Text
$sel:updateStatus:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails
-> Maybe ServerSideEncryptionUpdateStatus
$sel:oldKmsKeyId:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails -> Maybe Text
$sel:message:ServerSideEncryptionUpdateDetails' :: ServerSideEncryptionUpdateDetails -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
oldKmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServerSideEncryptionUpdateStatus
updateStatus