{-# 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.Wisdom.Types.ServerSideEncryptionConfiguration
-- 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.Wisdom.Types.ServerSideEncryptionConfiguration where

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

-- | The KMS key used for encryption.
--
-- /See:/ 'newServerSideEncryptionConfiguration' smart constructor.
data ServerSideEncryptionConfiguration = ServerSideEncryptionConfiguration'
  { -- | The KMS key. For information about valid ID values, see
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id Key identifiers (KeyId)>
    -- in the /AWS Key Management Service Developer Guide/.
    ServerSideEncryptionConfiguration -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text
  }
  deriving (ServerSideEncryptionConfiguration
-> ServerSideEncryptionConfiguration -> Bool
(ServerSideEncryptionConfiguration
 -> ServerSideEncryptionConfiguration -> Bool)
-> (ServerSideEncryptionConfiguration
    -> ServerSideEncryptionConfiguration -> Bool)
-> Eq ServerSideEncryptionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerSideEncryptionConfiguration
-> ServerSideEncryptionConfiguration -> Bool
$c/= :: ServerSideEncryptionConfiguration
-> ServerSideEncryptionConfiguration -> Bool
== :: ServerSideEncryptionConfiguration
-> ServerSideEncryptionConfiguration -> Bool
$c== :: ServerSideEncryptionConfiguration
-> ServerSideEncryptionConfiguration -> Bool
Prelude.Eq, ReadPrec [ServerSideEncryptionConfiguration]
ReadPrec ServerSideEncryptionConfiguration
Int -> ReadS ServerSideEncryptionConfiguration
ReadS [ServerSideEncryptionConfiguration]
(Int -> ReadS ServerSideEncryptionConfiguration)
-> ReadS [ServerSideEncryptionConfiguration]
-> ReadPrec ServerSideEncryptionConfiguration
-> ReadPrec [ServerSideEncryptionConfiguration]
-> Read ServerSideEncryptionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerSideEncryptionConfiguration]
$creadListPrec :: ReadPrec [ServerSideEncryptionConfiguration]
readPrec :: ReadPrec ServerSideEncryptionConfiguration
$creadPrec :: ReadPrec ServerSideEncryptionConfiguration
readList :: ReadS [ServerSideEncryptionConfiguration]
$creadList :: ReadS [ServerSideEncryptionConfiguration]
readsPrec :: Int -> ReadS ServerSideEncryptionConfiguration
$creadsPrec :: Int -> ReadS ServerSideEncryptionConfiguration
Prelude.Read, Int -> ServerSideEncryptionConfiguration -> ShowS
[ServerSideEncryptionConfiguration] -> ShowS
ServerSideEncryptionConfiguration -> String
(Int -> ServerSideEncryptionConfiguration -> ShowS)
-> (ServerSideEncryptionConfiguration -> String)
-> ([ServerSideEncryptionConfiguration] -> ShowS)
-> Show ServerSideEncryptionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerSideEncryptionConfiguration] -> ShowS
$cshowList :: [ServerSideEncryptionConfiguration] -> ShowS
show :: ServerSideEncryptionConfiguration -> String
$cshow :: ServerSideEncryptionConfiguration -> String
showsPrec :: Int -> ServerSideEncryptionConfiguration -> ShowS
$cshowsPrec :: Int -> ServerSideEncryptionConfiguration -> ShowS
Prelude.Show, (forall x.
 ServerSideEncryptionConfiguration
 -> Rep ServerSideEncryptionConfiguration x)
-> (forall x.
    Rep ServerSideEncryptionConfiguration x
    -> ServerSideEncryptionConfiguration)
-> Generic ServerSideEncryptionConfiguration
forall x.
Rep ServerSideEncryptionConfiguration x
-> ServerSideEncryptionConfiguration
forall x.
ServerSideEncryptionConfiguration
-> Rep ServerSideEncryptionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServerSideEncryptionConfiguration x
-> ServerSideEncryptionConfiguration
$cfrom :: forall x.
ServerSideEncryptionConfiguration
-> Rep ServerSideEncryptionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ServerSideEncryptionConfiguration' 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:
--
-- 'kmsKeyId', 'serverSideEncryptionConfiguration_kmsKeyId' - The KMS key. For information about valid ID values, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id Key identifiers (KeyId)>
-- in the /AWS Key Management Service Developer Guide/.
newServerSideEncryptionConfiguration ::
  ServerSideEncryptionConfiguration
newServerSideEncryptionConfiguration :: ServerSideEncryptionConfiguration
newServerSideEncryptionConfiguration =
  ServerSideEncryptionConfiguration' :: Maybe Text -> ServerSideEncryptionConfiguration
ServerSideEncryptionConfiguration'
    { $sel:kmsKeyId:ServerSideEncryptionConfiguration' :: Maybe Text
kmsKeyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The KMS key. For information about valid ID values, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id Key identifiers (KeyId)>
-- in the /AWS Key Management Service Developer Guide/.
serverSideEncryptionConfiguration_kmsKeyId :: Lens.Lens' ServerSideEncryptionConfiguration (Prelude.Maybe Prelude.Text)
serverSideEncryptionConfiguration_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> ServerSideEncryptionConfiguration
-> f ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration_kmsKeyId = (ServerSideEncryptionConfiguration -> Maybe Text)
-> (ServerSideEncryptionConfiguration
    -> Maybe Text -> ServerSideEncryptionConfiguration)
-> Lens
     ServerSideEncryptionConfiguration
     ServerSideEncryptionConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSideEncryptionConfiguration' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:ServerSideEncryptionConfiguration' :: ServerSideEncryptionConfiguration -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: ServerSideEncryptionConfiguration
s@ServerSideEncryptionConfiguration' {} Maybe Text
a -> ServerSideEncryptionConfiguration
s {$sel:kmsKeyId:ServerSideEncryptionConfiguration' :: Maybe Text
kmsKeyId = Maybe Text
a} :: ServerSideEncryptionConfiguration)

instance
  Core.FromJSON
    ServerSideEncryptionConfiguration
  where
  parseJSON :: Value -> Parser ServerSideEncryptionConfiguration
parseJSON =
    String
-> (Object -> Parser ServerSideEncryptionConfiguration)
-> Value
-> Parser ServerSideEncryptionConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServerSideEncryptionConfiguration"
      ( \Object
x ->
          Maybe Text -> ServerSideEncryptionConfiguration
ServerSideEncryptionConfiguration'
            (Maybe Text -> ServerSideEncryptionConfiguration)
-> Parser (Maybe Text) -> Parser ServerSideEncryptionConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"kmsKeyId")
      )

instance
  Prelude.Hashable
    ServerSideEncryptionConfiguration

instance
  Prelude.NFData
    ServerSideEncryptionConfiguration

instance
  Core.ToJSON
    ServerSideEncryptionConfiguration
  where
  toJSON :: ServerSideEncryptionConfiguration -> Value
toJSON ServerSideEncryptionConfiguration' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:ServerSideEncryptionConfiguration' :: ServerSideEncryptionConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"kmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId]
      )