module Network.AWS.S3.ListObjectVersions
(
listObjectVersions
, ListObjectVersions
, lovKeyMarker
, lovPrefix
, lovEncodingType
, lovVersionIdMarker
, lovMaxKeys
, lovDelimiter
, lovBucket
, listObjectVersionsResponse
, ListObjectVersionsResponse
, lovrsNextVersionIdMarker
, lovrsKeyMarker
, lovrsDeleteMarkers
, lovrsPrefix
, lovrsCommonPrefixes
, lovrsEncodingType
, lovrsVersions
, lovrsName
, lovrsNextKeyMarker
, lovrsVersionIdMarker
, lovrsMaxKeys
, lovrsIsTruncated
, lovrsDelimiter
, lovrsResponseStatus
) 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 ListObjectVersions = ListObjectVersions'
{ _lovKeyMarker :: !(Maybe Text)
, _lovPrefix :: !(Maybe Text)
, _lovEncodingType :: !(Maybe EncodingType)
, _lovVersionIdMarker :: !(Maybe Text)
, _lovMaxKeys :: !(Maybe Int)
, _lovDelimiter :: !(Maybe Delimiter)
, _lovBucket :: !BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listObjectVersions
:: BucketName
-> ListObjectVersions
listObjectVersions pBucket_ =
ListObjectVersions'
{ _lovKeyMarker = Nothing
, _lovPrefix = Nothing
, _lovEncodingType = Nothing
, _lovVersionIdMarker = Nothing
, _lovMaxKeys = Nothing
, _lovDelimiter = Nothing
, _lovBucket = pBucket_
}
lovKeyMarker :: Lens' ListObjectVersions (Maybe Text)
lovKeyMarker = lens _lovKeyMarker (\ s a -> s{_lovKeyMarker = a});
lovPrefix :: Lens' ListObjectVersions (Maybe Text)
lovPrefix = lens _lovPrefix (\ s a -> s{_lovPrefix = a});
lovEncodingType :: Lens' ListObjectVersions (Maybe EncodingType)
lovEncodingType = lens _lovEncodingType (\ s a -> s{_lovEncodingType = a});
lovVersionIdMarker :: Lens' ListObjectVersions (Maybe Text)
lovVersionIdMarker = lens _lovVersionIdMarker (\ s a -> s{_lovVersionIdMarker = a});
lovMaxKeys :: Lens' ListObjectVersions (Maybe Int)
lovMaxKeys = lens _lovMaxKeys (\ s a -> s{_lovMaxKeys = a});
lovDelimiter :: Lens' ListObjectVersions (Maybe Delimiter)
lovDelimiter = lens _lovDelimiter (\ s a -> s{_lovDelimiter = a});
lovBucket :: Lens' ListObjectVersions BucketName
lovBucket = lens _lovBucket (\ s a -> s{_lovBucket = a});
instance AWSPager ListObjectVersions where
page rq rs
| stop (rs ^. lovrsIsTruncated) = Nothing
| isNothing (rs ^. lovrsNextKeyMarker) &&
isNothing (rs ^. lovrsNextVersionIdMarker)
= Nothing
| otherwise =
Just $ rq & lovKeyMarker .~ rs ^. lovrsNextKeyMarker
&
lovVersionIdMarker .~ rs ^. lovrsNextVersionIdMarker
instance AWSRequest ListObjectVersions where
type Rs ListObjectVersions =
ListObjectVersionsResponse
request = get s3
response
= receiveXML
(\ s h x ->
ListObjectVersionsResponse' <$>
(x .@? "NextVersionIdMarker") <*> (x .@? "KeyMarker")
<*> (may (parseXMLList "DeleteMarker") x)
<*> (x .@? "Prefix")
<*> (may (parseXMLList "CommonPrefixes") x)
<*> (x .@? "EncodingType")
<*> (may (parseXMLList "Version") x)
<*> (x .@? "Name")
<*> (x .@? "NextKeyMarker")
<*> (x .@? "VersionIdMarker")
<*> (x .@? "MaxKeys")
<*> (x .@? "IsTruncated")
<*> (x .@? "Delimiter")
<*> (pure (fromEnum s)))
instance Hashable ListObjectVersions where
instance NFData ListObjectVersions where
instance ToHeaders ListObjectVersions where
toHeaders = const mempty
instance ToPath ListObjectVersions where
toPath ListObjectVersions'{..}
= mconcat ["/", toBS _lovBucket]
instance ToQuery ListObjectVersions where
toQuery ListObjectVersions'{..}
= mconcat
["key-marker" =: _lovKeyMarker,
"prefix" =: _lovPrefix,
"encoding-type" =: _lovEncodingType,
"version-id-marker" =: _lovVersionIdMarker,
"max-keys" =: _lovMaxKeys,
"delimiter" =: _lovDelimiter, "versions"]
data ListObjectVersionsResponse = ListObjectVersionsResponse'
{ _lovrsNextVersionIdMarker :: !(Maybe Text)
, _lovrsKeyMarker :: !(Maybe Text)
, _lovrsDeleteMarkers :: !(Maybe [DeleteMarkerEntry])
, _lovrsPrefix :: !(Maybe Text)
, _lovrsCommonPrefixes :: !(Maybe [CommonPrefix])
, _lovrsEncodingType :: !(Maybe EncodingType)
, _lovrsVersions :: !(Maybe [ObjectVersion])
, _lovrsName :: !(Maybe BucketName)
, _lovrsNextKeyMarker :: !(Maybe Text)
, _lovrsVersionIdMarker :: !(Maybe Text)
, _lovrsMaxKeys :: !(Maybe Int)
, _lovrsIsTruncated :: !(Maybe Bool)
, _lovrsDelimiter :: !(Maybe Delimiter)
, _lovrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listObjectVersionsResponse
:: Int
-> ListObjectVersionsResponse
listObjectVersionsResponse pResponseStatus_ =
ListObjectVersionsResponse'
{ _lovrsNextVersionIdMarker = Nothing
, _lovrsKeyMarker = Nothing
, _lovrsDeleteMarkers = Nothing
, _lovrsPrefix = Nothing
, _lovrsCommonPrefixes = Nothing
, _lovrsEncodingType = Nothing
, _lovrsVersions = Nothing
, _lovrsName = Nothing
, _lovrsNextKeyMarker = Nothing
, _lovrsVersionIdMarker = Nothing
, _lovrsMaxKeys = Nothing
, _lovrsIsTruncated = Nothing
, _lovrsDelimiter = Nothing
, _lovrsResponseStatus = pResponseStatus_
}
lovrsNextVersionIdMarker :: Lens' ListObjectVersionsResponse (Maybe Text)
lovrsNextVersionIdMarker = lens _lovrsNextVersionIdMarker (\ s a -> s{_lovrsNextVersionIdMarker = a});
lovrsKeyMarker :: Lens' ListObjectVersionsResponse (Maybe Text)
lovrsKeyMarker = lens _lovrsKeyMarker (\ s a -> s{_lovrsKeyMarker = a});
lovrsDeleteMarkers :: Lens' ListObjectVersionsResponse [DeleteMarkerEntry]
lovrsDeleteMarkers = lens _lovrsDeleteMarkers (\ s a -> s{_lovrsDeleteMarkers = a}) . _Default . _Coerce;
lovrsPrefix :: Lens' ListObjectVersionsResponse (Maybe Text)
lovrsPrefix = lens _lovrsPrefix (\ s a -> s{_lovrsPrefix = a});
lovrsCommonPrefixes :: Lens' ListObjectVersionsResponse [CommonPrefix]
lovrsCommonPrefixes = lens _lovrsCommonPrefixes (\ s a -> s{_lovrsCommonPrefixes = a}) . _Default . _Coerce;
lovrsEncodingType :: Lens' ListObjectVersionsResponse (Maybe EncodingType)
lovrsEncodingType = lens _lovrsEncodingType (\ s a -> s{_lovrsEncodingType = a});
lovrsVersions :: Lens' ListObjectVersionsResponse [ObjectVersion]
lovrsVersions = lens _lovrsVersions (\ s a -> s{_lovrsVersions = a}) . _Default . _Coerce;
lovrsName :: Lens' ListObjectVersionsResponse (Maybe BucketName)
lovrsName = lens _lovrsName (\ s a -> s{_lovrsName = a});
lovrsNextKeyMarker :: Lens' ListObjectVersionsResponse (Maybe Text)
lovrsNextKeyMarker = lens _lovrsNextKeyMarker (\ s a -> s{_lovrsNextKeyMarker = a});
lovrsVersionIdMarker :: Lens' ListObjectVersionsResponse (Maybe Text)
lovrsVersionIdMarker = lens _lovrsVersionIdMarker (\ s a -> s{_lovrsVersionIdMarker = a});
lovrsMaxKeys :: Lens' ListObjectVersionsResponse (Maybe Int)
lovrsMaxKeys = lens _lovrsMaxKeys (\ s a -> s{_lovrsMaxKeys = a});
lovrsIsTruncated :: Lens' ListObjectVersionsResponse (Maybe Bool)
lovrsIsTruncated = lens _lovrsIsTruncated (\ s a -> s{_lovrsIsTruncated = a});
lovrsDelimiter :: Lens' ListObjectVersionsResponse (Maybe Delimiter)
lovrsDelimiter = lens _lovrsDelimiter (\ s a -> s{_lovrsDelimiter = a});
lovrsResponseStatus :: Lens' ListObjectVersionsResponse Int
lovrsResponseStatus = lens _lovrsResponseStatus (\ s a -> s{_lovrsResponseStatus = a});
instance NFData ListObjectVersionsResponse where