module Network.AWS.S3.GetObjectAcl
(
GetObjectAcl
, getObjectAcl
, goaBucket
, goaKey
, goaRequestPayer
, goaVersionId
, GetObjectAclResponse
, getObjectAclResponse
, goarGrants
, goarOwner
, goarRequestCharged
) where
import Network.AWS.Prelude
import Network.AWS.Request.S3
import Network.AWS.S3.Types
import qualified GHC.Exts
data GetObjectAcl = GetObjectAcl
{ _goaBucket :: Text
, _goaKey :: Text
, _goaRequestPayer :: Maybe RequestPayer
, _goaVersionId :: Maybe Text
} deriving (Eq, Read, Show)
getObjectAcl :: Text
-> Text
-> GetObjectAcl
getObjectAcl p1 p2 = GetObjectAcl
{ _goaBucket = p1
, _goaKey = p2
, _goaVersionId = Nothing
, _goaRequestPayer = Nothing
}
goaBucket :: Lens' GetObjectAcl Text
goaBucket = lens _goaBucket (\s a -> s { _goaBucket = a })
goaKey :: Lens' GetObjectAcl Text
goaKey = lens _goaKey (\s a -> s { _goaKey = a })
goaRequestPayer :: Lens' GetObjectAcl (Maybe RequestPayer)
goaRequestPayer = lens _goaRequestPayer (\s a -> s { _goaRequestPayer = a })
goaVersionId :: Lens' GetObjectAcl (Maybe Text)
goaVersionId = lens _goaVersionId (\s a -> s { _goaVersionId = a })
data GetObjectAclResponse = GetObjectAclResponse
{ _goarGrants :: List "Grant" Grant
, _goarOwner :: Maybe Owner
, _goarRequestCharged :: Maybe RequestCharged
} deriving (Eq, Read, Show)
getObjectAclResponse :: GetObjectAclResponse
getObjectAclResponse = GetObjectAclResponse
{ _goarOwner = Nothing
, _goarGrants = mempty
, _goarRequestCharged = Nothing
}
goarGrants :: Lens' GetObjectAclResponse [Grant]
goarGrants = lens _goarGrants (\s a -> s { _goarGrants = a }) . _List
goarOwner :: Lens' GetObjectAclResponse (Maybe Owner)
goarOwner = lens _goarOwner (\s a -> s { _goarOwner = a })
goarRequestCharged :: Lens' GetObjectAclResponse (Maybe RequestCharged)
goarRequestCharged =
lens _goarRequestCharged (\s a -> s { _goarRequestCharged = a })
instance ToPath GetObjectAcl where
toPath GetObjectAcl{..} = mconcat
[ "/"
, toText _goaBucket
, "/"
, toText _goaKey
]
instance ToQuery GetObjectAcl where
toQuery GetObjectAcl{..} = mconcat
[ "acl"
, "versionId" =? _goaVersionId
]
instance ToHeaders GetObjectAcl where
toHeaders GetObjectAcl{..} = mconcat
[ "x-amz-request-payer" =: _goaRequestPayer
]
instance ToXMLRoot GetObjectAcl where
toXMLRoot = const (namespaced ns "GetObjectAcl" [])
instance ToXML GetObjectAcl
instance AWSRequest GetObjectAcl where
type Sv GetObjectAcl = S3
type Rs GetObjectAcl = GetObjectAclResponse
request = get
response = xmlHeaderResponse $ \h x -> GetObjectAclResponse
<$> x .@? "AccessControlList" .!@ mempty
<*> x .@? "Owner"
<*> h ~:? "x-amz-request-charged"