{-# 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.MQ.Types.EncryptionOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EncryptionOptions = EncryptionOptions'
{
EncryptionOptions -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
EncryptionOptions -> Bool
useAwsOwnedKey :: Prelude.Bool
}
deriving (EncryptionOptions -> EncryptionOptions -> Bool
(EncryptionOptions -> EncryptionOptions -> Bool)
-> (EncryptionOptions -> EncryptionOptions -> Bool)
-> Eq EncryptionOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionOptions -> EncryptionOptions -> Bool
$c/= :: EncryptionOptions -> EncryptionOptions -> Bool
== :: EncryptionOptions -> EncryptionOptions -> Bool
$c== :: EncryptionOptions -> EncryptionOptions -> Bool
Prelude.Eq, ReadPrec [EncryptionOptions]
ReadPrec EncryptionOptions
Int -> ReadS EncryptionOptions
ReadS [EncryptionOptions]
(Int -> ReadS EncryptionOptions)
-> ReadS [EncryptionOptions]
-> ReadPrec EncryptionOptions
-> ReadPrec [EncryptionOptions]
-> Read EncryptionOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncryptionOptions]
$creadListPrec :: ReadPrec [EncryptionOptions]
readPrec :: ReadPrec EncryptionOptions
$creadPrec :: ReadPrec EncryptionOptions
readList :: ReadS [EncryptionOptions]
$creadList :: ReadS [EncryptionOptions]
readsPrec :: Int -> ReadS EncryptionOptions
$creadsPrec :: Int -> ReadS EncryptionOptions
Prelude.Read, Int -> EncryptionOptions -> ShowS
[EncryptionOptions] -> ShowS
EncryptionOptions -> String
(Int -> EncryptionOptions -> ShowS)
-> (EncryptionOptions -> String)
-> ([EncryptionOptions] -> ShowS)
-> Show EncryptionOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionOptions] -> ShowS
$cshowList :: [EncryptionOptions] -> ShowS
show :: EncryptionOptions -> String
$cshow :: EncryptionOptions -> String
showsPrec :: Int -> EncryptionOptions -> ShowS
$cshowsPrec :: Int -> EncryptionOptions -> ShowS
Prelude.Show, (forall x. EncryptionOptions -> Rep EncryptionOptions x)
-> (forall x. Rep EncryptionOptions x -> EncryptionOptions)
-> Generic EncryptionOptions
forall x. Rep EncryptionOptions x -> EncryptionOptions
forall x. EncryptionOptions -> Rep EncryptionOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EncryptionOptions x -> EncryptionOptions
$cfrom :: forall x. EncryptionOptions -> Rep EncryptionOptions x
Prelude.Generic)
newEncryptionOptions ::
Prelude.Bool ->
EncryptionOptions
newEncryptionOptions :: Bool -> EncryptionOptions
newEncryptionOptions Bool
pUseAwsOwnedKey_ =
EncryptionOptions' :: Maybe Text -> Bool -> EncryptionOptions
EncryptionOptions'
{ $sel:kmsKeyId:EncryptionOptions' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:useAwsOwnedKey:EncryptionOptions' :: Bool
useAwsOwnedKey = Bool
pUseAwsOwnedKey_
}
encryptionOptions_kmsKeyId :: Lens.Lens' EncryptionOptions (Prelude.Maybe Prelude.Text)
encryptionOptions_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> EncryptionOptions -> f EncryptionOptions
encryptionOptions_kmsKeyId = (EncryptionOptions -> Maybe Text)
-> (EncryptionOptions -> Maybe Text -> EncryptionOptions)
-> Lens
EncryptionOptions EncryptionOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionOptions' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:EncryptionOptions' :: EncryptionOptions -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: EncryptionOptions
s@EncryptionOptions' {} Maybe Text
a -> EncryptionOptions
s {$sel:kmsKeyId:EncryptionOptions' :: Maybe Text
kmsKeyId = Maybe Text
a} :: EncryptionOptions)
encryptionOptions_useAwsOwnedKey :: Lens.Lens' EncryptionOptions Prelude.Bool
encryptionOptions_useAwsOwnedKey :: (Bool -> f Bool) -> EncryptionOptions -> f EncryptionOptions
encryptionOptions_useAwsOwnedKey = (EncryptionOptions -> Bool)
-> (EncryptionOptions -> Bool -> EncryptionOptions)
-> Lens EncryptionOptions EncryptionOptions Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionOptions' {Bool
useAwsOwnedKey :: Bool
$sel:useAwsOwnedKey:EncryptionOptions' :: EncryptionOptions -> Bool
useAwsOwnedKey} -> Bool
useAwsOwnedKey) (\s :: EncryptionOptions
s@EncryptionOptions' {} Bool
a -> EncryptionOptions
s {$sel:useAwsOwnedKey:EncryptionOptions' :: Bool
useAwsOwnedKey = Bool
a} :: EncryptionOptions)
instance Core.FromJSON EncryptionOptions where
parseJSON :: Value -> Parser EncryptionOptions
parseJSON =
String
-> (Object -> Parser EncryptionOptions)
-> Value
-> Parser EncryptionOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EncryptionOptions"
( \Object
x ->
Maybe Text -> Bool -> EncryptionOptions
EncryptionOptions'
(Maybe Text -> Bool -> EncryptionOptions)
-> Parser (Maybe Text) -> Parser (Bool -> EncryptionOptions)
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")
Parser (Bool -> EncryptionOptions)
-> Parser Bool -> Parser EncryptionOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"useAwsOwnedKey")
)
instance Prelude.Hashable EncryptionOptions
instance Prelude.NFData EncryptionOptions
instance Core.ToJSON EncryptionOptions where
toJSON :: EncryptionOptions -> Value
toJSON EncryptionOptions' {Bool
Maybe Text
useAwsOwnedKey :: Bool
kmsKeyId :: Maybe Text
$sel:useAwsOwnedKey:EncryptionOptions' :: EncryptionOptions -> Bool
$sel:kmsKeyId:EncryptionOptions' :: EncryptionOptions -> 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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"useAwsOwnedKey" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
useAwsOwnedKey)
]
)