{-# 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.ObjectLockConfiguration 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.ObjectLockEnabled
import Amazonka.S3.Types.ObjectLockRule
data ObjectLockConfiguration = ObjectLockConfiguration'
{
ObjectLockConfiguration -> Maybe ObjectLockEnabled
objectLockEnabled :: Prelude.Maybe ObjectLockEnabled,
ObjectLockConfiguration -> Maybe ObjectLockRule
rule :: Prelude.Maybe ObjectLockRule
}
deriving (ObjectLockConfiguration -> ObjectLockConfiguration -> Bool
(ObjectLockConfiguration -> ObjectLockConfiguration -> Bool)
-> (ObjectLockConfiguration -> ObjectLockConfiguration -> Bool)
-> Eq ObjectLockConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectLockConfiguration -> ObjectLockConfiguration -> Bool
$c/= :: ObjectLockConfiguration -> ObjectLockConfiguration -> Bool
== :: ObjectLockConfiguration -> ObjectLockConfiguration -> Bool
$c== :: ObjectLockConfiguration -> ObjectLockConfiguration -> Bool
Prelude.Eq, ReadPrec [ObjectLockConfiguration]
ReadPrec ObjectLockConfiguration
Int -> ReadS ObjectLockConfiguration
ReadS [ObjectLockConfiguration]
(Int -> ReadS ObjectLockConfiguration)
-> ReadS [ObjectLockConfiguration]
-> ReadPrec ObjectLockConfiguration
-> ReadPrec [ObjectLockConfiguration]
-> Read ObjectLockConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ObjectLockConfiguration]
$creadListPrec :: ReadPrec [ObjectLockConfiguration]
readPrec :: ReadPrec ObjectLockConfiguration
$creadPrec :: ReadPrec ObjectLockConfiguration
readList :: ReadS [ObjectLockConfiguration]
$creadList :: ReadS [ObjectLockConfiguration]
readsPrec :: Int -> ReadS ObjectLockConfiguration
$creadsPrec :: Int -> ReadS ObjectLockConfiguration
Prelude.Read, Int -> ObjectLockConfiguration -> ShowS
[ObjectLockConfiguration] -> ShowS
ObjectLockConfiguration -> String
(Int -> ObjectLockConfiguration -> ShowS)
-> (ObjectLockConfiguration -> String)
-> ([ObjectLockConfiguration] -> ShowS)
-> Show ObjectLockConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjectLockConfiguration] -> ShowS
$cshowList :: [ObjectLockConfiguration] -> ShowS
show :: ObjectLockConfiguration -> String
$cshow :: ObjectLockConfiguration -> String
showsPrec :: Int -> ObjectLockConfiguration -> ShowS
$cshowsPrec :: Int -> ObjectLockConfiguration -> ShowS
Prelude.Show, (forall x.
ObjectLockConfiguration -> Rep ObjectLockConfiguration x)
-> (forall x.
Rep ObjectLockConfiguration x -> ObjectLockConfiguration)
-> Generic ObjectLockConfiguration
forall x. Rep ObjectLockConfiguration x -> ObjectLockConfiguration
forall x. ObjectLockConfiguration -> Rep ObjectLockConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ObjectLockConfiguration x -> ObjectLockConfiguration
$cfrom :: forall x. ObjectLockConfiguration -> Rep ObjectLockConfiguration x
Prelude.Generic)
newObjectLockConfiguration ::
ObjectLockConfiguration
newObjectLockConfiguration :: ObjectLockConfiguration
newObjectLockConfiguration =
ObjectLockConfiguration' :: Maybe ObjectLockEnabled
-> Maybe ObjectLockRule -> ObjectLockConfiguration
ObjectLockConfiguration'
{ $sel:objectLockEnabled:ObjectLockConfiguration' :: Maybe ObjectLockEnabled
objectLockEnabled =
Maybe ObjectLockEnabled
forall a. Maybe a
Prelude.Nothing,
$sel:rule:ObjectLockConfiguration' :: Maybe ObjectLockRule
rule = Maybe ObjectLockRule
forall a. Maybe a
Prelude.Nothing
}
objectLockConfiguration_objectLockEnabled :: Lens.Lens' ObjectLockConfiguration (Prelude.Maybe ObjectLockEnabled)
objectLockConfiguration_objectLockEnabled :: (Maybe ObjectLockEnabled -> f (Maybe ObjectLockEnabled))
-> ObjectLockConfiguration -> f ObjectLockConfiguration
objectLockConfiguration_objectLockEnabled = (ObjectLockConfiguration -> Maybe ObjectLockEnabled)
-> (ObjectLockConfiguration
-> Maybe ObjectLockEnabled -> ObjectLockConfiguration)
-> Lens
ObjectLockConfiguration
ObjectLockConfiguration
(Maybe ObjectLockEnabled)
(Maybe ObjectLockEnabled)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectLockConfiguration' {Maybe ObjectLockEnabled
objectLockEnabled :: Maybe ObjectLockEnabled
$sel:objectLockEnabled:ObjectLockConfiguration' :: ObjectLockConfiguration -> Maybe ObjectLockEnabled
objectLockEnabled} -> Maybe ObjectLockEnabled
objectLockEnabled) (\s :: ObjectLockConfiguration
s@ObjectLockConfiguration' {} Maybe ObjectLockEnabled
a -> ObjectLockConfiguration
s {$sel:objectLockEnabled:ObjectLockConfiguration' :: Maybe ObjectLockEnabled
objectLockEnabled = Maybe ObjectLockEnabled
a} :: ObjectLockConfiguration)
objectLockConfiguration_rule :: Lens.Lens' ObjectLockConfiguration (Prelude.Maybe ObjectLockRule)
objectLockConfiguration_rule :: (Maybe ObjectLockRule -> f (Maybe ObjectLockRule))
-> ObjectLockConfiguration -> f ObjectLockConfiguration
objectLockConfiguration_rule = (ObjectLockConfiguration -> Maybe ObjectLockRule)
-> (ObjectLockConfiguration
-> Maybe ObjectLockRule -> ObjectLockConfiguration)
-> Lens
ObjectLockConfiguration
ObjectLockConfiguration
(Maybe ObjectLockRule)
(Maybe ObjectLockRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectLockConfiguration' {Maybe ObjectLockRule
rule :: Maybe ObjectLockRule
$sel:rule:ObjectLockConfiguration' :: ObjectLockConfiguration -> Maybe ObjectLockRule
rule} -> Maybe ObjectLockRule
rule) (\s :: ObjectLockConfiguration
s@ObjectLockConfiguration' {} Maybe ObjectLockRule
a -> ObjectLockConfiguration
s {$sel:rule:ObjectLockConfiguration' :: Maybe ObjectLockRule
rule = Maybe ObjectLockRule
a} :: ObjectLockConfiguration)
instance Core.FromXML ObjectLockConfiguration where
parseXML :: [Node] -> Either String ObjectLockConfiguration
parseXML [Node]
x =
Maybe ObjectLockEnabled
-> Maybe ObjectLockRule -> ObjectLockConfiguration
ObjectLockConfiguration'
(Maybe ObjectLockEnabled
-> Maybe ObjectLockRule -> ObjectLockConfiguration)
-> Either String (Maybe ObjectLockEnabled)
-> Either String (Maybe ObjectLockRule -> ObjectLockConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ObjectLockEnabled)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ObjectLockEnabled")
Either String (Maybe ObjectLockRule -> ObjectLockConfiguration)
-> Either String (Maybe ObjectLockRule)
-> Either String ObjectLockConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ObjectLockRule)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Rule")
instance Prelude.Hashable ObjectLockConfiguration
instance Prelude.NFData ObjectLockConfiguration
instance Core.ToXML ObjectLockConfiguration where
toXML :: ObjectLockConfiguration -> XML
toXML ObjectLockConfiguration' {Maybe ObjectLockEnabled
Maybe ObjectLockRule
rule :: Maybe ObjectLockRule
objectLockEnabled :: Maybe ObjectLockEnabled
$sel:rule:ObjectLockConfiguration' :: ObjectLockConfiguration -> Maybe ObjectLockRule
$sel:objectLockEnabled:ObjectLockConfiguration' :: ObjectLockConfiguration -> Maybe ObjectLockEnabled
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"ObjectLockEnabled" Name -> Maybe ObjectLockEnabled -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ObjectLockEnabled
objectLockEnabled,
Name
"Rule" Name -> Maybe ObjectLockRule -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ObjectLockRule
rule
]