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