{-# 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 #-}
module Amazonka.KeySpaces.Types.EncryptionSpecification where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KeySpaces.Types.EncryptionType
import qualified Amazonka.Prelude as Prelude
data EncryptionSpecification = EncryptionSpecification'
{
EncryptionSpecification -> Maybe Text
kmsKeyIdentifier :: Prelude.Maybe Prelude.Text,
EncryptionSpecification -> EncryptionType
type' :: EncryptionType
}
deriving (EncryptionSpecification -> EncryptionSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionSpecification -> EncryptionSpecification -> Bool
$c/= :: EncryptionSpecification -> EncryptionSpecification -> Bool
== :: EncryptionSpecification -> EncryptionSpecification -> Bool
$c== :: EncryptionSpecification -> EncryptionSpecification -> Bool
Prelude.Eq, ReadPrec [EncryptionSpecification]
ReadPrec EncryptionSpecification
Int -> ReadS EncryptionSpecification
ReadS [EncryptionSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncryptionSpecification]
$creadListPrec :: ReadPrec [EncryptionSpecification]
readPrec :: ReadPrec EncryptionSpecification
$creadPrec :: ReadPrec EncryptionSpecification
readList :: ReadS [EncryptionSpecification]
$creadList :: ReadS [EncryptionSpecification]
readsPrec :: Int -> ReadS EncryptionSpecification
$creadsPrec :: Int -> ReadS EncryptionSpecification
Prelude.Read, Int -> EncryptionSpecification -> ShowS
[EncryptionSpecification] -> ShowS
EncryptionSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionSpecification] -> ShowS
$cshowList :: [EncryptionSpecification] -> ShowS
show :: EncryptionSpecification -> String
$cshow :: EncryptionSpecification -> String
showsPrec :: Int -> EncryptionSpecification -> ShowS
$cshowsPrec :: Int -> EncryptionSpecification -> ShowS
Prelude.Show, forall x. Rep EncryptionSpecification x -> EncryptionSpecification
forall x. EncryptionSpecification -> Rep EncryptionSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EncryptionSpecification x -> EncryptionSpecification
$cfrom :: forall x. EncryptionSpecification -> Rep EncryptionSpecification x
Prelude.Generic)
newEncryptionSpecification ::
EncryptionType ->
EncryptionSpecification
newEncryptionSpecification :: EncryptionType -> EncryptionSpecification
newEncryptionSpecification EncryptionType
pType_ =
EncryptionSpecification'
{ $sel:kmsKeyIdentifier:EncryptionSpecification' :: Maybe Text
kmsKeyIdentifier =
forall a. Maybe a
Prelude.Nothing,
$sel:type':EncryptionSpecification' :: EncryptionType
type' = EncryptionType
pType_
}
encryptionSpecification_kmsKeyIdentifier :: Lens.Lens' EncryptionSpecification (Prelude.Maybe Prelude.Text)
encryptionSpecification_kmsKeyIdentifier :: Lens' EncryptionSpecification (Maybe Text)
encryptionSpecification_kmsKeyIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionSpecification' {Maybe Text
kmsKeyIdentifier :: Maybe Text
$sel:kmsKeyIdentifier:EncryptionSpecification' :: EncryptionSpecification -> Maybe Text
kmsKeyIdentifier} -> Maybe Text
kmsKeyIdentifier) (\s :: EncryptionSpecification
s@EncryptionSpecification' {} Maybe Text
a -> EncryptionSpecification
s {$sel:kmsKeyIdentifier:EncryptionSpecification' :: Maybe Text
kmsKeyIdentifier = Maybe Text
a} :: EncryptionSpecification)
encryptionSpecification_type :: Lens.Lens' EncryptionSpecification EncryptionType
encryptionSpecification_type :: Lens' EncryptionSpecification EncryptionType
encryptionSpecification_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionSpecification' {EncryptionType
type' :: EncryptionType
$sel:type':EncryptionSpecification' :: EncryptionSpecification -> EncryptionType
type'} -> EncryptionType
type') (\s :: EncryptionSpecification
s@EncryptionSpecification' {} EncryptionType
a -> EncryptionSpecification
s {$sel:type':EncryptionSpecification' :: EncryptionType
type' = EncryptionType
a} :: EncryptionSpecification)
instance Data.FromJSON EncryptionSpecification where
parseJSON :: Value -> Parser EncryptionSpecification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EncryptionSpecification"
( \Object
x ->
Maybe Text -> EncryptionType -> EncryptionSpecification
EncryptionSpecification'
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
"kmsKeyIdentifier")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
)
instance Prelude.Hashable EncryptionSpecification where
hashWithSalt :: Int -> EncryptionSpecification -> Int
hashWithSalt Int
_salt EncryptionSpecification' {Maybe Text
EncryptionType
type' :: EncryptionType
kmsKeyIdentifier :: Maybe Text
$sel:type':EncryptionSpecification' :: EncryptionSpecification -> EncryptionType
$sel:kmsKeyIdentifier:EncryptionSpecification' :: EncryptionSpecification -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyIdentifier
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EncryptionType
type'
instance Prelude.NFData EncryptionSpecification where
rnf :: EncryptionSpecification -> ()
rnf EncryptionSpecification' {Maybe Text
EncryptionType
type' :: EncryptionType
kmsKeyIdentifier :: Maybe Text
$sel:type':EncryptionSpecification' :: EncryptionSpecification -> EncryptionType
$sel:kmsKeyIdentifier:EncryptionSpecification' :: EncryptionSpecification -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EncryptionType
type'
instance Data.ToJSON EncryptionSpecification where
toJSON :: EncryptionSpecification -> Value
toJSON EncryptionSpecification' {Maybe Text
EncryptionType
type' :: EncryptionType
kmsKeyIdentifier :: Maybe Text
$sel:type':EncryptionSpecification' :: EncryptionSpecification -> EncryptionType
$sel:kmsKeyIdentifier:EncryptionSpecification' :: EncryptionSpecification -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"kmsKeyIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyIdentifier,
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EncryptionType
type')
]
)