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