module Network.AWS.S3.GetObjectTorrent
(
getObjectTorrent
, GetObjectTorrent
, gotRequestPayer
, gotBucket
, gotKey
, getObjectTorrentResponse
, GetObjectTorrentResponse
, gotrsRequestCharged
, gotrsStatus
, gotrsBody
) where
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
data GetObjectTorrent = GetObjectTorrent'
{ _gotRequestPayer :: !(Maybe RequestPayer)
, _gotBucket :: !BucketName
, _gotKey :: !ObjectKey
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getObjectTorrent
:: BucketName
-> ObjectKey
-> GetObjectTorrent
getObjectTorrent pBucket_ pKey_ =
GetObjectTorrent'
{ _gotRequestPayer = Nothing
, _gotBucket = pBucket_
, _gotKey = pKey_
}
gotRequestPayer :: Lens' GetObjectTorrent (Maybe RequestPayer)
gotRequestPayer = lens _gotRequestPayer (\ s a -> s{_gotRequestPayer = a});
gotBucket :: Lens' GetObjectTorrent BucketName
gotBucket = lens _gotBucket (\ s a -> s{_gotBucket = a});
gotKey :: Lens' GetObjectTorrent ObjectKey
gotKey = lens _gotKey (\ s a -> s{_gotKey = a});
instance AWSRequest GetObjectTorrent where
type Rs GetObjectTorrent = GetObjectTorrentResponse
request = get s3
response
= receiveBody
(\ s h x ->
GetObjectTorrentResponse' <$>
(h .#? "x-amz-request-charged") <*>
(pure (fromEnum s))
<*> (pure x))
instance ToHeaders GetObjectTorrent where
toHeaders GetObjectTorrent'{..}
= mconcat ["x-amz-request-payer" =# _gotRequestPayer]
instance ToPath GetObjectTorrent where
toPath GetObjectTorrent'{..}
= mconcat ["/", toBS _gotBucket, "/", toBS _gotKey]
instance ToQuery GetObjectTorrent where
toQuery = const (mconcat ["torrent"])
data GetObjectTorrentResponse = GetObjectTorrentResponse'
{ _gotrsRequestCharged :: !(Maybe RequestCharged)
, _gotrsStatus :: !Int
, _gotrsBody :: !RsBody
} deriving (Show,Generic)
getObjectTorrentResponse
:: Int
-> RsBody
-> GetObjectTorrentResponse
getObjectTorrentResponse pStatus_ pBody_ =
GetObjectTorrentResponse'
{ _gotrsRequestCharged = Nothing
, _gotrsStatus = pStatus_
, _gotrsBody = pBody_
}
gotrsRequestCharged :: Lens' GetObjectTorrentResponse (Maybe RequestCharged)
gotrsRequestCharged = lens _gotrsRequestCharged (\ s a -> s{_gotrsRequestCharged = a});
gotrsStatus :: Lens' GetObjectTorrentResponse Int
gotrsStatus = lens _gotrsStatus (\ s a -> s{_gotrsStatus = a});
gotrsBody :: Lens' GetObjectTorrentResponse RsBody
gotrsBody = lens _gotrsBody (\ s a -> s{_gotrsBody = a});