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