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

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

-- | The configuration containing information about the customer-managed KMS
-- Key used for encrypting customer data.
--
-- /See:/ 'newServerSideEncryptionConfiguration' smart constructor.
data ServerSideEncryptionConfiguration = ServerSideEncryptionConfiguration'
  { -- | The identifier of the KMS Key you want Voice ID to use to encrypt your
    -- data.
    ServerSideEncryptionConfiguration -> Text
kmsKeyId :: 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 identifier of the KMS Key you want Voice ID to use to encrypt your
-- data.
newServerSideEncryptionConfiguration ::
  -- | 'kmsKeyId'
  Prelude.Text ->
  ServerSideEncryptionConfiguration
newServerSideEncryptionConfiguration :: Text -> ServerSideEncryptionConfiguration
newServerSideEncryptionConfiguration Text
pKmsKeyId_ =
  ServerSideEncryptionConfiguration' :: Text -> ServerSideEncryptionConfiguration
ServerSideEncryptionConfiguration'
    { $sel:kmsKeyId:ServerSideEncryptionConfiguration' :: Text
kmsKeyId =
        Text
pKmsKeyId_
    }

-- | The identifier of the KMS Key you want Voice ID to use to encrypt your
-- data.
serverSideEncryptionConfiguration_kmsKeyId :: Lens.Lens' ServerSideEncryptionConfiguration Prelude.Text
serverSideEncryptionConfiguration_kmsKeyId :: (Text -> f Text)
-> ServerSideEncryptionConfiguration
-> f ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration_kmsKeyId = (ServerSideEncryptionConfiguration -> Text)
-> (ServerSideEncryptionConfiguration
    -> Text -> ServerSideEncryptionConfiguration)
-> Lens
     ServerSideEncryptionConfiguration
     ServerSideEncryptionConfiguration
     Text
     Text
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
  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 ->
          Text -> ServerSideEncryptionConfiguration
ServerSideEncryptionConfiguration'
            (Text -> ServerSideEncryptionConfiguration)
-> Parser Text -> Parser ServerSideEncryptionConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"KmsKeyId")
      )

instance
  Prelude.Hashable
    ServerSideEncryptionConfiguration

instance
  Prelude.NFData
    ServerSideEncryptionConfiguration

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