{-# 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.Kafka.Types.EncryptionAtRest
-- 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.Kafka.Types.EncryptionAtRest 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

-- | The data-volume encryption details.
--
-- /See:/ 'newEncryptionAtRest' smart constructor.
data EncryptionAtRest = EncryptionAtRest'
  { -- | The ARN of the AWS KMS key for encrypting data at rest. If you don\'t
    -- specify a KMS key, MSK creates one for you and uses it.
    EncryptionAtRest -> Text
dataVolumeKMSKeyId :: Prelude.Text
  }
  deriving (EncryptionAtRest -> EncryptionAtRest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionAtRest -> EncryptionAtRest -> Bool
$c/= :: EncryptionAtRest -> EncryptionAtRest -> Bool
== :: EncryptionAtRest -> EncryptionAtRest -> Bool
$c== :: EncryptionAtRest -> EncryptionAtRest -> Bool
Prelude.Eq, ReadPrec [EncryptionAtRest]
ReadPrec EncryptionAtRest
Int -> ReadS EncryptionAtRest
ReadS [EncryptionAtRest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncryptionAtRest]
$creadListPrec :: ReadPrec [EncryptionAtRest]
readPrec :: ReadPrec EncryptionAtRest
$creadPrec :: ReadPrec EncryptionAtRest
readList :: ReadS [EncryptionAtRest]
$creadList :: ReadS [EncryptionAtRest]
readsPrec :: Int -> ReadS EncryptionAtRest
$creadsPrec :: Int -> ReadS EncryptionAtRest
Prelude.Read, Int -> EncryptionAtRest -> ShowS
[EncryptionAtRest] -> ShowS
EncryptionAtRest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionAtRest] -> ShowS
$cshowList :: [EncryptionAtRest] -> ShowS
show :: EncryptionAtRest -> String
$cshow :: EncryptionAtRest -> String
showsPrec :: Int -> EncryptionAtRest -> ShowS
$cshowsPrec :: Int -> EncryptionAtRest -> ShowS
Prelude.Show, forall x. Rep EncryptionAtRest x -> EncryptionAtRest
forall x. EncryptionAtRest -> Rep EncryptionAtRest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EncryptionAtRest x -> EncryptionAtRest
$cfrom :: forall x. EncryptionAtRest -> Rep EncryptionAtRest x
Prelude.Generic)

-- |
-- Create a value of 'EncryptionAtRest' 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:
--
-- 'dataVolumeKMSKeyId', 'encryptionAtRest_dataVolumeKMSKeyId' - The ARN of the AWS KMS key for encrypting data at rest. If you don\'t
-- specify a KMS key, MSK creates one for you and uses it.
newEncryptionAtRest ::
  -- | 'dataVolumeKMSKeyId'
  Prelude.Text ->
  EncryptionAtRest
newEncryptionAtRest :: Text -> EncryptionAtRest
newEncryptionAtRest Text
pDataVolumeKMSKeyId_ =
  EncryptionAtRest'
    { $sel:dataVolumeKMSKeyId:EncryptionAtRest' :: Text
dataVolumeKMSKeyId =
        Text
pDataVolumeKMSKeyId_
    }

-- | The ARN of the AWS KMS key for encrypting data at rest. If you don\'t
-- specify a KMS key, MSK creates one for you and uses it.
encryptionAtRest_dataVolumeKMSKeyId :: Lens.Lens' EncryptionAtRest Prelude.Text
encryptionAtRest_dataVolumeKMSKeyId :: Lens' EncryptionAtRest Text
encryptionAtRest_dataVolumeKMSKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionAtRest' {Text
dataVolumeKMSKeyId :: Text
$sel:dataVolumeKMSKeyId:EncryptionAtRest' :: EncryptionAtRest -> Text
dataVolumeKMSKeyId} -> Text
dataVolumeKMSKeyId) (\s :: EncryptionAtRest
s@EncryptionAtRest' {} Text
a -> EncryptionAtRest
s {$sel:dataVolumeKMSKeyId:EncryptionAtRest' :: Text
dataVolumeKMSKeyId = Text
a} :: EncryptionAtRest)

instance Data.FromJSON EncryptionAtRest where
  parseJSON :: Value -> Parser EncryptionAtRest
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EncryptionAtRest"
      ( \Object
x ->
          Text -> EncryptionAtRest
EncryptionAtRest'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"dataVolumeKMSKeyId")
      )

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

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

instance Data.ToJSON EncryptionAtRest where
  toJSON :: EncryptionAtRest -> Value
toJSON EncryptionAtRest' {Text
dataVolumeKMSKeyId :: Text
$sel:dataVolumeKMSKeyId:EncryptionAtRest' :: EncryptionAtRest -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"dataVolumeKMSKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
dataVolumeKMSKeyId)
          ]
      )