{-# 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.S3.Types.ServerSideEncryptionRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.ServerSideEncryptionByDefault
data ServerSideEncryptionRule = ServerSideEncryptionRule'
{
ServerSideEncryptionRule -> Maybe ServerSideEncryptionByDefault
applyServerSideEncryptionByDefault :: Prelude.Maybe ServerSideEncryptionByDefault,
ServerSideEncryptionRule -> Maybe Bool
bucketKeyEnabled :: Prelude.Maybe Prelude.Bool
}
deriving (ServerSideEncryptionRule -> ServerSideEncryptionRule -> Bool
(ServerSideEncryptionRule -> ServerSideEncryptionRule -> Bool)
-> (ServerSideEncryptionRule -> ServerSideEncryptionRule -> Bool)
-> Eq ServerSideEncryptionRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerSideEncryptionRule -> ServerSideEncryptionRule -> Bool
$c/= :: ServerSideEncryptionRule -> ServerSideEncryptionRule -> Bool
== :: ServerSideEncryptionRule -> ServerSideEncryptionRule -> Bool
$c== :: ServerSideEncryptionRule -> ServerSideEncryptionRule -> Bool
Prelude.Eq, Int -> ServerSideEncryptionRule -> ShowS
[ServerSideEncryptionRule] -> ShowS
ServerSideEncryptionRule -> String
(Int -> ServerSideEncryptionRule -> ShowS)
-> (ServerSideEncryptionRule -> String)
-> ([ServerSideEncryptionRule] -> ShowS)
-> Show ServerSideEncryptionRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerSideEncryptionRule] -> ShowS
$cshowList :: [ServerSideEncryptionRule] -> ShowS
show :: ServerSideEncryptionRule -> String
$cshow :: ServerSideEncryptionRule -> String
showsPrec :: Int -> ServerSideEncryptionRule -> ShowS
$cshowsPrec :: Int -> ServerSideEncryptionRule -> ShowS
Prelude.Show, (forall x.
ServerSideEncryptionRule -> Rep ServerSideEncryptionRule x)
-> (forall x.
Rep ServerSideEncryptionRule x -> ServerSideEncryptionRule)
-> Generic ServerSideEncryptionRule
forall x.
Rep ServerSideEncryptionRule x -> ServerSideEncryptionRule
forall x.
ServerSideEncryptionRule -> Rep ServerSideEncryptionRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServerSideEncryptionRule x -> ServerSideEncryptionRule
$cfrom :: forall x.
ServerSideEncryptionRule -> Rep ServerSideEncryptionRule x
Prelude.Generic)
newServerSideEncryptionRule ::
ServerSideEncryptionRule
newServerSideEncryptionRule :: ServerSideEncryptionRule
newServerSideEncryptionRule =
ServerSideEncryptionRule' :: Maybe ServerSideEncryptionByDefault
-> Maybe Bool -> ServerSideEncryptionRule
ServerSideEncryptionRule'
{ $sel:applyServerSideEncryptionByDefault:ServerSideEncryptionRule' :: Maybe ServerSideEncryptionByDefault
applyServerSideEncryptionByDefault =
Maybe ServerSideEncryptionByDefault
forall a. Maybe a
Prelude.Nothing,
$sel:bucketKeyEnabled:ServerSideEncryptionRule' :: Maybe Bool
bucketKeyEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
serverSideEncryptionRule_applyServerSideEncryptionByDefault :: Lens.Lens' ServerSideEncryptionRule (Prelude.Maybe ServerSideEncryptionByDefault)
serverSideEncryptionRule_applyServerSideEncryptionByDefault :: (Maybe ServerSideEncryptionByDefault
-> f (Maybe ServerSideEncryptionByDefault))
-> ServerSideEncryptionRule -> f ServerSideEncryptionRule
serverSideEncryptionRule_applyServerSideEncryptionByDefault = (ServerSideEncryptionRule -> Maybe ServerSideEncryptionByDefault)
-> (ServerSideEncryptionRule
-> Maybe ServerSideEncryptionByDefault -> ServerSideEncryptionRule)
-> Lens
ServerSideEncryptionRule
ServerSideEncryptionRule
(Maybe ServerSideEncryptionByDefault)
(Maybe ServerSideEncryptionByDefault)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSideEncryptionRule' {Maybe ServerSideEncryptionByDefault
applyServerSideEncryptionByDefault :: Maybe ServerSideEncryptionByDefault
$sel:applyServerSideEncryptionByDefault:ServerSideEncryptionRule' :: ServerSideEncryptionRule -> Maybe ServerSideEncryptionByDefault
applyServerSideEncryptionByDefault} -> Maybe ServerSideEncryptionByDefault
applyServerSideEncryptionByDefault) (\s :: ServerSideEncryptionRule
s@ServerSideEncryptionRule' {} Maybe ServerSideEncryptionByDefault
a -> ServerSideEncryptionRule
s {$sel:applyServerSideEncryptionByDefault:ServerSideEncryptionRule' :: Maybe ServerSideEncryptionByDefault
applyServerSideEncryptionByDefault = Maybe ServerSideEncryptionByDefault
a} :: ServerSideEncryptionRule)
serverSideEncryptionRule_bucketKeyEnabled :: Lens.Lens' ServerSideEncryptionRule (Prelude.Maybe Prelude.Bool)
serverSideEncryptionRule_bucketKeyEnabled :: (Maybe Bool -> f (Maybe Bool))
-> ServerSideEncryptionRule -> f ServerSideEncryptionRule
serverSideEncryptionRule_bucketKeyEnabled = (ServerSideEncryptionRule -> Maybe Bool)
-> (ServerSideEncryptionRule
-> Maybe Bool -> ServerSideEncryptionRule)
-> Lens
ServerSideEncryptionRule
ServerSideEncryptionRule
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSideEncryptionRule' {Maybe Bool
bucketKeyEnabled :: Maybe Bool
$sel:bucketKeyEnabled:ServerSideEncryptionRule' :: ServerSideEncryptionRule -> Maybe Bool
bucketKeyEnabled} -> Maybe Bool
bucketKeyEnabled) (\s :: ServerSideEncryptionRule
s@ServerSideEncryptionRule' {} Maybe Bool
a -> ServerSideEncryptionRule
s {$sel:bucketKeyEnabled:ServerSideEncryptionRule' :: Maybe Bool
bucketKeyEnabled = Maybe Bool
a} :: ServerSideEncryptionRule)
instance Core.FromXML ServerSideEncryptionRule where
parseXML :: [Node] -> Either String ServerSideEncryptionRule
parseXML [Node]
x =
Maybe ServerSideEncryptionByDefault
-> Maybe Bool -> ServerSideEncryptionRule
ServerSideEncryptionRule'
(Maybe ServerSideEncryptionByDefault
-> Maybe Bool -> ServerSideEncryptionRule)
-> Either String (Maybe ServerSideEncryptionByDefault)
-> Either String (Maybe Bool -> ServerSideEncryptionRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node]
-> Text -> Either String (Maybe ServerSideEncryptionByDefault)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ApplyServerSideEncryptionByDefault")
Either String (Maybe Bool -> ServerSideEncryptionRule)
-> Either String (Maybe Bool)
-> Either String ServerSideEncryptionRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"BucketKeyEnabled")
instance Prelude.Hashable ServerSideEncryptionRule
instance Prelude.NFData ServerSideEncryptionRule
instance Core.ToXML ServerSideEncryptionRule where
toXML :: ServerSideEncryptionRule -> XML
toXML ServerSideEncryptionRule' {Maybe Bool
Maybe ServerSideEncryptionByDefault
bucketKeyEnabled :: Maybe Bool
applyServerSideEncryptionByDefault :: Maybe ServerSideEncryptionByDefault
$sel:bucketKeyEnabled:ServerSideEncryptionRule' :: ServerSideEncryptionRule -> Maybe Bool
$sel:applyServerSideEncryptionByDefault:ServerSideEncryptionRule' :: ServerSideEncryptionRule -> Maybe ServerSideEncryptionByDefault
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"ApplyServerSideEncryptionByDefault"
Name -> Maybe ServerSideEncryptionByDefault -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ServerSideEncryptionByDefault
applyServerSideEncryptionByDefault,
Name
"BucketKeyEnabled" Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
bucketKeyEnabled
]