module Network.AWS.S3.GetObjectACL
(
getObjectACL
, GetObjectACL
, goaVersionId
, goaRequestPayer
, goaBucket
, goaKey
, getObjectACLResponse
, GetObjectACLResponse
, goarsRequestCharged
, goarsGrants
, goarsOwner
, goarsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
data GetObjectACL = GetObjectACL'
{ _goaVersionId :: !(Maybe ObjectVersionId)
, _goaRequestPayer :: !(Maybe RequestPayer)
, _goaBucket :: !BucketName
, _goaKey :: !ObjectKey
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getObjectACL
:: BucketName
-> ObjectKey
-> GetObjectACL
getObjectACL pBucket_ pKey_ =
GetObjectACL'
{ _goaVersionId = Nothing
, _goaRequestPayer = Nothing
, _goaBucket = pBucket_
, _goaKey = pKey_
}
goaVersionId :: Lens' GetObjectACL (Maybe ObjectVersionId)
goaVersionId = lens _goaVersionId (\ s a -> s{_goaVersionId = a});
goaRequestPayer :: Lens' GetObjectACL (Maybe RequestPayer)
goaRequestPayer = lens _goaRequestPayer (\ s a -> s{_goaRequestPayer = a});
goaBucket :: Lens' GetObjectACL BucketName
goaBucket = lens _goaBucket (\ s a -> s{_goaBucket = a});
goaKey :: Lens' GetObjectACL ObjectKey
goaKey = lens _goaKey (\ s a -> s{_goaKey = a});
instance AWSRequest GetObjectACL where
type Rs GetObjectACL = GetObjectACLResponse
request = get s3
response
= receiveXML
(\ s h x ->
GetObjectACLResponse' <$>
(h .#? "x-amz-request-charged") <*>
(x .@? "AccessControlList" .!@ mempty >>=
may (parseXMLList "Grant"))
<*> (x .@? "Owner")
<*> (pure (fromEnum s)))
instance Hashable GetObjectACL where
instance NFData GetObjectACL where
instance ToHeaders GetObjectACL where
toHeaders GetObjectACL'{..}
= mconcat ["x-amz-request-payer" =# _goaRequestPayer]
instance ToPath GetObjectACL where
toPath GetObjectACL'{..}
= mconcat ["/", toBS _goaBucket, "/", toBS _goaKey]
instance ToQuery GetObjectACL where
toQuery GetObjectACL'{..}
= mconcat ["versionId" =: _goaVersionId, "acl"]
data GetObjectACLResponse = GetObjectACLResponse'
{ _goarsRequestCharged :: !(Maybe RequestCharged)
, _goarsGrants :: !(Maybe [Grant])
, _goarsOwner :: !(Maybe Owner)
, _goarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getObjectACLResponse
:: Int
-> GetObjectACLResponse
getObjectACLResponse pResponseStatus_ =
GetObjectACLResponse'
{ _goarsRequestCharged = Nothing
, _goarsGrants = Nothing
, _goarsOwner = Nothing
, _goarsResponseStatus = pResponseStatus_
}
goarsRequestCharged :: Lens' GetObjectACLResponse (Maybe RequestCharged)
goarsRequestCharged = lens _goarsRequestCharged (\ s a -> s{_goarsRequestCharged = a});
goarsGrants :: Lens' GetObjectACLResponse [Grant]
goarsGrants = lens _goarsGrants (\ s a -> s{_goarsGrants = a}) . _Default . _Coerce;
goarsOwner :: Lens' GetObjectACLResponse (Maybe Owner)
goarsOwner = lens _goarsOwner (\ s a -> s{_goarsOwner = a});
goarsResponseStatus :: Lens' GetObjectACLResponse Int
goarsResponseStatus = lens _goarsResponseStatus (\ s a -> s{_goarsResponseStatus = a});
instance NFData GetObjectACLResponse where