{-# 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.Grantee 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.Type
data Grantee = Grantee'
{
Grantee -> Maybe Text
uri :: Prelude.Maybe Prelude.Text,
Grantee -> Maybe Text
emailAddress :: Prelude.Maybe Prelude.Text,
Grantee -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
Grantee -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Grantee -> Type
type' :: Type
}
deriving (Grantee -> Grantee -> Bool
(Grantee -> Grantee -> Bool)
-> (Grantee -> Grantee -> Bool) -> Eq Grantee
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Grantee -> Grantee -> Bool
$c/= :: Grantee -> Grantee -> Bool
== :: Grantee -> Grantee -> Bool
$c== :: Grantee -> Grantee -> Bool
Prelude.Eq, ReadPrec [Grantee]
ReadPrec Grantee
Int -> ReadS Grantee
ReadS [Grantee]
(Int -> ReadS Grantee)
-> ReadS [Grantee]
-> ReadPrec Grantee
-> ReadPrec [Grantee]
-> Read Grantee
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Grantee]
$creadListPrec :: ReadPrec [Grantee]
readPrec :: ReadPrec Grantee
$creadPrec :: ReadPrec Grantee
readList :: ReadS [Grantee]
$creadList :: ReadS [Grantee]
readsPrec :: Int -> ReadS Grantee
$creadsPrec :: Int -> ReadS Grantee
Prelude.Read, Int -> Grantee -> ShowS
[Grantee] -> ShowS
Grantee -> String
(Int -> Grantee -> ShowS)
-> (Grantee -> String) -> ([Grantee] -> ShowS) -> Show Grantee
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Grantee] -> ShowS
$cshowList :: [Grantee] -> ShowS
show :: Grantee -> String
$cshow :: Grantee -> String
showsPrec :: Int -> Grantee -> ShowS
$cshowsPrec :: Int -> Grantee -> ShowS
Prelude.Show, (forall x. Grantee -> Rep Grantee x)
-> (forall x. Rep Grantee x -> Grantee) -> Generic Grantee
forall x. Rep Grantee x -> Grantee
forall x. Grantee -> Rep Grantee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Grantee x -> Grantee
$cfrom :: forall x. Grantee -> Rep Grantee x
Prelude.Generic)
newGrantee ::
Type ->
Grantee
newGrantee :: Type -> Grantee
newGrantee Type
pType_ =
Grantee' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Type -> Grantee
Grantee'
{ $sel:uri:Grantee' :: Maybe Text
uri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:emailAddress:Grantee' :: Maybe Text
emailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:displayName:Grantee' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:Grantee' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':Grantee' :: Type
type' = Type
pType_
}
grantee_uri :: Lens.Lens' Grantee (Prelude.Maybe Prelude.Text)
grantee_uri :: (Maybe Text -> f (Maybe Text)) -> Grantee -> f Grantee
grantee_uri = (Grantee -> Maybe Text)
-> (Grantee -> Maybe Text -> Grantee)
-> Lens Grantee Grantee (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Grantee' {Maybe Text
uri :: Maybe Text
$sel:uri:Grantee' :: Grantee -> Maybe Text
uri} -> Maybe Text
uri) (\s :: Grantee
s@Grantee' {} Maybe Text
a -> Grantee
s {$sel:uri:Grantee' :: Maybe Text
uri = Maybe Text
a} :: Grantee)
grantee_emailAddress :: Lens.Lens' Grantee (Prelude.Maybe Prelude.Text)
grantee_emailAddress :: (Maybe Text -> f (Maybe Text)) -> Grantee -> f Grantee
grantee_emailAddress = (Grantee -> Maybe Text)
-> (Grantee -> Maybe Text -> Grantee)
-> Lens Grantee Grantee (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Grantee' {Maybe Text
emailAddress :: Maybe Text
$sel:emailAddress:Grantee' :: Grantee -> Maybe Text
emailAddress} -> Maybe Text
emailAddress) (\s :: Grantee
s@Grantee' {} Maybe Text
a -> Grantee
s {$sel:emailAddress:Grantee' :: Maybe Text
emailAddress = Maybe Text
a} :: Grantee)
grantee_displayName :: Lens.Lens' Grantee (Prelude.Maybe Prelude.Text)
grantee_displayName :: (Maybe Text -> f (Maybe Text)) -> Grantee -> f Grantee
grantee_displayName = (Grantee -> Maybe Text)
-> (Grantee -> Maybe Text -> Grantee)
-> Lens Grantee Grantee (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Grantee' {Maybe Text
displayName :: Maybe Text
$sel:displayName:Grantee' :: Grantee -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: Grantee
s@Grantee' {} Maybe Text
a -> Grantee
s {$sel:displayName:Grantee' :: Maybe Text
displayName = Maybe Text
a} :: Grantee)
grantee_id :: Lens.Lens' Grantee (Prelude.Maybe Prelude.Text)
grantee_id :: (Maybe Text -> f (Maybe Text)) -> Grantee -> f Grantee
grantee_id = (Grantee -> Maybe Text)
-> (Grantee -> Maybe Text -> Grantee)
-> Lens Grantee Grantee (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Grantee' {Maybe Text
id :: Maybe Text
$sel:id:Grantee' :: Grantee -> Maybe Text
id} -> Maybe Text
id) (\s :: Grantee
s@Grantee' {} Maybe Text
a -> Grantee
s {$sel:id:Grantee' :: Maybe Text
id = Maybe Text
a} :: Grantee)
grantee_type :: Lens.Lens' Grantee Type
grantee_type :: (Type -> f Type) -> Grantee -> f Grantee
grantee_type = (Grantee -> Type)
-> (Grantee -> Type -> Grantee) -> Lens Grantee Grantee Type Type
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Grantee' {Type
type' :: Type
$sel:type':Grantee' :: Grantee -> Type
type'} -> Type
type') (\s :: Grantee
s@Grantee' {} Type
a -> Grantee
s {$sel:type':Grantee' :: Type
type' = Type
a} :: Grantee)
instance Core.FromXML Grantee where
parseXML :: [Node] -> Either String Grantee
parseXML [Node]
x =
Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Type -> Grantee
Grantee'
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Type -> Grantee)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Maybe Text -> Type -> Grantee)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"URI")
Either
String (Maybe Text -> Maybe Text -> Maybe Text -> Type -> Grantee)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> Type -> Grantee)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EmailAddress")
Either String (Maybe Text -> Maybe Text -> Type -> Grantee)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Type -> Grantee)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DisplayName")
Either String (Maybe Text -> Type -> Grantee)
-> Either String (Maybe Text) -> Either String (Type -> Grantee)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ID")
Either String (Type -> Grantee)
-> Either String Type -> Either String Grantee
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Type
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"xsi:type")
instance Prelude.Hashable Grantee
instance Prelude.NFData Grantee
instance Core.ToXML Grantee where
toXML :: Grantee -> XML
toXML Grantee' {Maybe Text
Type
type' :: Type
id :: Maybe Text
displayName :: Maybe Text
emailAddress :: Maybe Text
uri :: Maybe Text
$sel:type':Grantee' :: Grantee -> Type
$sel:id:Grantee' :: Grantee -> Maybe Text
$sel:displayName:Grantee' :: Grantee -> Maybe Text
$sel:emailAddress:Grantee' :: Grantee -> Maybe Text
$sel:uri:Grantee' :: Grantee -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"URI" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
uri,
Name
"EmailAddress" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
emailAddress,
Name
"DisplayName" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
displayName,
Name
"ID" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
id,
Name
"xsi:type" Name -> Type -> XML
forall a. ToText a => Name -> a -> XML
Core.@@= Type
type'
]