{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.S3.ListMultipartUploads
(
listMultipartUploads
, ListMultipartUploads
, lmuKeyMarker
, lmuPrefix
, lmuEncodingType
, lmuUploadIdMarker
, lmuMaxUploads
, lmuDelimiter
, lmuBucket
, listMultipartUploadsResponse
, ListMultipartUploadsResponse
, lmursKeyMarker
, lmursPrefix
, lmursCommonPrefixes
, lmursEncodingType
, lmursBucket
, lmursUploadIdMarker
, lmursMaxUploads
, lmursNextKeyMarker
, lmursUploads
, lmursIsTruncated
, lmursNextUploadIdMarker
, lmursDelimiter
, lmursResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
data ListMultipartUploads = ListMultipartUploads'
{ _lmuKeyMarker :: !(Maybe Text)
, _lmuPrefix :: !(Maybe Text)
, _lmuEncodingType :: !(Maybe EncodingType)
, _lmuUploadIdMarker :: !(Maybe Text)
, _lmuMaxUploads :: !(Maybe Int)
, _lmuDelimiter :: !(Maybe Delimiter)
, _lmuBucket :: !BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listMultipartUploads
:: BucketName
-> ListMultipartUploads
listMultipartUploads pBucket_ =
ListMultipartUploads'
{ _lmuKeyMarker = Nothing
, _lmuPrefix = Nothing
, _lmuEncodingType = Nothing
, _lmuUploadIdMarker = Nothing
, _lmuMaxUploads = Nothing
, _lmuDelimiter = Nothing
, _lmuBucket = pBucket_
}
lmuKeyMarker :: Lens' ListMultipartUploads (Maybe Text)
lmuKeyMarker = lens _lmuKeyMarker (\ s a -> s{_lmuKeyMarker = a})
lmuPrefix :: Lens' ListMultipartUploads (Maybe Text)
lmuPrefix = lens _lmuPrefix (\ s a -> s{_lmuPrefix = a})
lmuEncodingType :: Lens' ListMultipartUploads (Maybe EncodingType)
lmuEncodingType = lens _lmuEncodingType (\ s a -> s{_lmuEncodingType = a})
lmuUploadIdMarker :: Lens' ListMultipartUploads (Maybe Text)
lmuUploadIdMarker = lens _lmuUploadIdMarker (\ s a -> s{_lmuUploadIdMarker = a})
lmuMaxUploads :: Lens' ListMultipartUploads (Maybe Int)
lmuMaxUploads = lens _lmuMaxUploads (\ s a -> s{_lmuMaxUploads = a})
lmuDelimiter :: Lens' ListMultipartUploads (Maybe Delimiter)
lmuDelimiter = lens _lmuDelimiter (\ s a -> s{_lmuDelimiter = a})
lmuBucket :: Lens' ListMultipartUploads BucketName
lmuBucket = lens _lmuBucket (\ s a -> s{_lmuBucket = a})
instance AWSPager ListMultipartUploads where
page rq rs
| stop (rs ^. lmursIsTruncated) = Nothing
| isNothing (rs ^. lmursNextKeyMarker) &&
isNothing (rs ^. lmursNextUploadIdMarker)
= Nothing
| otherwise =
Just $ rq & lmuKeyMarker .~ rs ^. lmursNextKeyMarker
& lmuUploadIdMarker .~ rs ^. lmursNextUploadIdMarker
instance AWSRequest ListMultipartUploads where
type Rs ListMultipartUploads =
ListMultipartUploadsResponse
request = get s3
response
= receiveXML
(\ s h x ->
ListMultipartUploadsResponse' <$>
(x .@? "KeyMarker") <*> (x .@? "Prefix") <*>
(may (parseXMLList "CommonPrefixes") x)
<*> (x .@? "EncodingType")
<*> (x .@? "Bucket")
<*> (x .@? "UploadIdMarker")
<*> (x .@? "MaxUploads")
<*> (x .@? "NextKeyMarker")
<*> (may (parseXMLList "Upload") x)
<*> (x .@? "IsTruncated")
<*> (x .@? "NextUploadIdMarker")
<*> (x .@? "Delimiter")
<*> (pure (fromEnum s)))
instance Hashable ListMultipartUploads where
instance NFData ListMultipartUploads where
instance ToHeaders ListMultipartUploads where
toHeaders = const mempty
instance ToPath ListMultipartUploads where
toPath ListMultipartUploads'{..}
= mconcat ["/", toBS _lmuBucket]
instance ToQuery ListMultipartUploads where
toQuery ListMultipartUploads'{..}
= mconcat
["key-marker" =: _lmuKeyMarker,
"prefix" =: _lmuPrefix,
"encoding-type" =: _lmuEncodingType,
"upload-id-marker" =: _lmuUploadIdMarker,
"max-uploads" =: _lmuMaxUploads,
"delimiter" =: _lmuDelimiter, "uploads"]
data ListMultipartUploadsResponse = ListMultipartUploadsResponse'
{ _lmursKeyMarker :: !(Maybe Text)
, _lmursPrefix :: !(Maybe Text)
, _lmursCommonPrefixes :: !(Maybe [CommonPrefix])
, _lmursEncodingType :: !(Maybe EncodingType)
, _lmursBucket :: !(Maybe BucketName)
, _lmursUploadIdMarker :: !(Maybe Text)
, _lmursMaxUploads :: !(Maybe Int)
, _lmursNextKeyMarker :: !(Maybe Text)
, _lmursUploads :: !(Maybe [MultipartUpload])
, _lmursIsTruncated :: !(Maybe Bool)
, _lmursNextUploadIdMarker :: !(Maybe Text)
, _lmursDelimiter :: !(Maybe Delimiter)
, _lmursResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listMultipartUploadsResponse
:: Int
-> ListMultipartUploadsResponse
listMultipartUploadsResponse pResponseStatus_ =
ListMultipartUploadsResponse'
{ _lmursKeyMarker = Nothing
, _lmursPrefix = Nothing
, _lmursCommonPrefixes = Nothing
, _lmursEncodingType = Nothing
, _lmursBucket = Nothing
, _lmursUploadIdMarker = Nothing
, _lmursMaxUploads = Nothing
, _lmursNextKeyMarker = Nothing
, _lmursUploads = Nothing
, _lmursIsTruncated = Nothing
, _lmursNextUploadIdMarker = Nothing
, _lmursDelimiter = Nothing
, _lmursResponseStatus = pResponseStatus_
}
lmursKeyMarker :: Lens' ListMultipartUploadsResponse (Maybe Text)
lmursKeyMarker = lens _lmursKeyMarker (\ s a -> s{_lmursKeyMarker = a})
lmursPrefix :: Lens' ListMultipartUploadsResponse (Maybe Text)
lmursPrefix = lens _lmursPrefix (\ s a -> s{_lmursPrefix = a})
lmursCommonPrefixes :: Lens' ListMultipartUploadsResponse [CommonPrefix]
lmursCommonPrefixes = lens _lmursCommonPrefixes (\ s a -> s{_lmursCommonPrefixes = a}) . _Default . _Coerce
lmursEncodingType :: Lens' ListMultipartUploadsResponse (Maybe EncodingType)
lmursEncodingType = lens _lmursEncodingType (\ s a -> s{_lmursEncodingType = a})
lmursBucket :: Lens' ListMultipartUploadsResponse (Maybe BucketName)
lmursBucket = lens _lmursBucket (\ s a -> s{_lmursBucket = a})
lmursUploadIdMarker :: Lens' ListMultipartUploadsResponse (Maybe Text)
lmursUploadIdMarker = lens _lmursUploadIdMarker (\ s a -> s{_lmursUploadIdMarker = a})
lmursMaxUploads :: Lens' ListMultipartUploadsResponse (Maybe Int)
lmursMaxUploads = lens _lmursMaxUploads (\ s a -> s{_lmursMaxUploads = a})
lmursNextKeyMarker :: Lens' ListMultipartUploadsResponse (Maybe Text)
lmursNextKeyMarker = lens _lmursNextKeyMarker (\ s a -> s{_lmursNextKeyMarker = a})
lmursUploads :: Lens' ListMultipartUploadsResponse [MultipartUpload]
lmursUploads = lens _lmursUploads (\ s a -> s{_lmursUploads = a}) . _Default . _Coerce
lmursIsTruncated :: Lens' ListMultipartUploadsResponse (Maybe Bool)
lmursIsTruncated = lens _lmursIsTruncated (\ s a -> s{_lmursIsTruncated = a})
lmursNextUploadIdMarker :: Lens' ListMultipartUploadsResponse (Maybe Text)
lmursNextUploadIdMarker = lens _lmursNextUploadIdMarker (\ s a -> s{_lmursNextUploadIdMarker = a})
lmursDelimiter :: Lens' ListMultipartUploadsResponse (Maybe Delimiter)
lmursDelimiter = lens _lmursDelimiter (\ s a -> s{_lmursDelimiter = a})
lmursResponseStatus :: Lens' ListMultipartUploadsResponse Int
lmursResponseStatus = lens _lmursResponseStatus (\ s a -> s{_lmursResponseStatus = a})
instance NFData ListMultipartUploadsResponse where