{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
{ $sel:kmsKeyArn:S3EncryptionConfiguration' :: Maybe Text
kmsKeyArn =
forall a. Maybe a
Prelude.Nothing,
$sel:objectEncryptionType:S3EncryptionConfiguration' :: S3ObjectEncryptionType
objectEncryptionType = S3ObjectEncryptionType
pObjectEncryptionType_
}
s3EncryptionConfiguration_kmsKeyArn :: Lens.Lens' S3EncryptionConfiguration (Prelude.Maybe Prelude.Text)
s3EncryptionConfiguration_kmsKeyArn :: Lens' S3EncryptionConfiguration (Maybe Text)
s3EncryptionConfiguration_kmsKeyArn = 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 :: Lens' S3EncryptionConfiguration S3ObjectEncryptionType
s3EncryptionConfiguration_objectEncryptionType = 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 Data.FromJSON S3EncryptionConfiguration where
parseJSON :: Value -> Parser S3EncryptionConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"S3EncryptionConfiguration"
( \Object
x ->
Maybe Text -> S3ObjectEncryptionType -> S3EncryptionConfiguration
S3EncryptionConfiguration'
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
"KmsKeyArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ObjectEncryptionType")
)
instance Prelude.Hashable S3EncryptionConfiguration where
hashWithSalt :: Int -> S3EncryptionConfiguration -> Int
hashWithSalt Int
_salt S3EncryptionConfiguration' {Maybe Text
S3ObjectEncryptionType
objectEncryptionType :: S3ObjectEncryptionType
kmsKeyArn :: Maybe Text
$sel:objectEncryptionType:S3EncryptionConfiguration' :: S3EncryptionConfiguration -> S3ObjectEncryptionType
$sel:kmsKeyArn:S3EncryptionConfiguration' :: S3EncryptionConfiguration -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3ObjectEncryptionType
objectEncryptionType
instance Prelude.NFData S3EncryptionConfiguration where
rnf :: S3EncryptionConfiguration -> ()
rnf S3EncryptionConfiguration' {Maybe Text
S3ObjectEncryptionType
objectEncryptionType :: S3ObjectEncryptionType
kmsKeyArn :: Maybe Text
$sel:objectEncryptionType:S3EncryptionConfiguration' :: S3EncryptionConfiguration -> S3ObjectEncryptionType
$sel:kmsKeyArn:S3EncryptionConfiguration' :: S3EncryptionConfiguration -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf S3ObjectEncryptionType
objectEncryptionType
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"KmsKeyArn" 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
kmsKeyArn,
forall a. a -> Maybe a
Prelude.Just
( Key
"ObjectEncryptionType"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3ObjectEncryptionType
objectEncryptionType
)
]
)