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