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