{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:enabled:EncryptionAtRestOptions' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
$sel:kmsKeyId:EncryptionAtRestOptions' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing
}
encryptionAtRestOptions_enabled :: Lens.Lens' EncryptionAtRestOptions (Prelude.Maybe Prelude.Bool)
encryptionAtRestOptions_enabled :: Lens' EncryptionAtRestOptions (Maybe Bool)
encryptionAtRestOptions_enabled = 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 :: Lens' EncryptionAtRestOptions (Maybe Text)
encryptionAtRestOptions_kmsKeyId = 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 Data.FromJSON EncryptionAtRestOptions where
parseJSON :: Value -> Parser EncryptionAtRestOptions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EncryptionAtRestOptions"
( \Object
x ->
Maybe Bool -> Maybe Text -> EncryptionAtRestOptions
EncryptionAtRestOptions'
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
"Enabled")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"KmsKeyId")
)
instance Prelude.Hashable EncryptionAtRestOptions where
hashWithSalt :: Int -> EncryptionAtRestOptions -> Int
hashWithSalt Int
_salt EncryptionAtRestOptions' {Maybe Bool
Maybe Text
kmsKeyId :: Maybe Text
enabled :: Maybe Bool
$sel:kmsKeyId:EncryptionAtRestOptions' :: EncryptionAtRestOptions -> Maybe Text
$sel:enabled:EncryptionAtRestOptions' :: EncryptionAtRestOptions -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
instance Prelude.NFData EncryptionAtRestOptions where
rnf :: EncryptionAtRestOptions -> ()
rnf EncryptionAtRestOptions' {Maybe Bool
Maybe Text
kmsKeyId :: Maybe Text
enabled :: Maybe Bool
$sel:kmsKeyId:EncryptionAtRestOptions' :: EncryptionAtRestOptions -> Maybe Text
$sel:enabled:EncryptionAtRestOptions' :: EncryptionAtRestOptions -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Enabled" 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 Bool
enabled,
(Key
"KmsKeyId" 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
kmsKeyId
]
)