{-# 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.ServerSideEncryptionConfiguration
-- 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.ServerSideEncryptionConfiguration 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 configuration containing information about the customer managed key
-- used for encrypting customer data.
--
-- /See:/ 'newServerSideEncryptionConfiguration' smart constructor.
data ServerSideEncryptionConfiguration = ServerSideEncryptionConfiguration'
  { -- | The identifier of the KMS key to use to encrypt data stored by Voice ID.
    -- Voice ID doesn\'t support asymmetric customer managed keys.
    ServerSideEncryptionConfiguration -> Text
kmsKeyId :: Prelude.Text
  }
  deriving (ServerSideEncryptionConfiguration
-> ServerSideEncryptionConfiguration -> Bool
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]
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
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.
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 identifier of the KMS key to use to encrypt data stored by Voice ID.
-- Voice ID doesn\'t support asymmetric customer managed keys.
newServerSideEncryptionConfiguration ::
  -- | 'kmsKeyId'
  Prelude.Text ->
  ServerSideEncryptionConfiguration
newServerSideEncryptionConfiguration :: Text -> ServerSideEncryptionConfiguration
newServerSideEncryptionConfiguration Text
pKmsKeyId_ =
  ServerSideEncryptionConfiguration'
    { $sel:kmsKeyId:ServerSideEncryptionConfiguration' :: Text
kmsKeyId =
        Text
pKmsKeyId_
    }

-- | The identifier of the KMS key to use to encrypt data stored by Voice ID.
-- Voice ID doesn\'t support asymmetric customer managed keys.
serverSideEncryptionConfiguration_kmsKeyId :: Lens.Lens' ServerSideEncryptionConfiguration Prelude.Text
serverSideEncryptionConfiguration_kmsKeyId :: Lens' ServerSideEncryptionConfiguration Text
serverSideEncryptionConfiguration_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSideEncryptionConfiguration' {Text
kmsKeyId :: Text
$sel:kmsKeyId:ServerSideEncryptionConfiguration' :: ServerSideEncryptionConfiguration -> Text
kmsKeyId} -> Text
kmsKeyId) (\s :: ServerSideEncryptionConfiguration
s@ServerSideEncryptionConfiguration' {} Text
a -> ServerSideEncryptionConfiguration
s {$sel:kmsKeyId:ServerSideEncryptionConfiguration' :: Text
kmsKeyId = Text
a} :: ServerSideEncryptionConfiguration)

instance
  Data.FromJSON
    ServerSideEncryptionConfiguration
  where
  parseJSON :: Value -> Parser ServerSideEncryptionConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServerSideEncryptionConfiguration"
      ( \Object
x ->
          Text -> ServerSideEncryptionConfiguration
ServerSideEncryptionConfiguration'
            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
"KmsKeyId")
      )

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

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

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