module Aws.S3.Commands.GetBucketObjectVersions
where

import           Aws.Core
import           Aws.S3.Core
import           Control.Applicative
import           Data.ByteString.Char8 ({- IsString -})
import           Data.Maybe
import           Text.XML.Cursor       (($/), (&|), (&//))
import qualified Data.ByteString.Char8 as B8
import qualified Data.Text             as T
import qualified Data.Text.Encoding    as T
import qualified Data.Traversable
import           Prelude
import qualified Network.HTTP.Types    as HTTP
import qualified Text.XML.Cursor       as Cu
import qualified Text.XML              as XML

data GetBucketObjectVersions
    = GetBucketObjectVersions {
        GetBucketObjectVersions -> Bucket
gbovBucket          :: Bucket
      , GetBucketObjectVersions -> Maybe Bucket
gbovDelimiter       :: Maybe T.Text
      , GetBucketObjectVersions -> Maybe Bucket
gbovKeyMarker       :: Maybe T.Text
      , GetBucketObjectVersions -> Maybe Int
gbovMaxKeys         :: Maybe Int
      , GetBucketObjectVersions -> Maybe Bucket
gbovPrefix          :: Maybe T.Text
      , GetBucketObjectVersions -> Maybe Bucket
gbovVersionIdMarker :: Maybe T.Text
      }
    deriving (Int -> GetBucketObjectVersions -> ShowS
[GetBucketObjectVersions] -> ShowS
GetBucketObjectVersions -> String
(Int -> GetBucketObjectVersions -> ShowS)
-> (GetBucketObjectVersions -> String)
-> ([GetBucketObjectVersions] -> ShowS)
-> Show GetBucketObjectVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketObjectVersions] -> ShowS
$cshowList :: [GetBucketObjectVersions] -> ShowS
show :: GetBucketObjectVersions -> String
$cshow :: GetBucketObjectVersions -> String
showsPrec :: Int -> GetBucketObjectVersions -> ShowS
$cshowsPrec :: Int -> GetBucketObjectVersions -> ShowS
Show)

getBucketObjectVersions :: Bucket -> GetBucketObjectVersions
getBucketObjectVersions :: Bucket -> GetBucketObjectVersions
getBucketObjectVersions Bucket
bucket
    = GetBucketObjectVersions :: Bucket
-> Maybe Bucket
-> Maybe Bucket
-> Maybe Int
-> Maybe Bucket
-> Maybe Bucket
-> GetBucketObjectVersions
GetBucketObjectVersions {
        gbovBucket :: Bucket
gbovBucket          = Bucket
bucket
      , gbovDelimiter :: Maybe Bucket
gbovDelimiter       = Maybe Bucket
forall a. Maybe a
Nothing
      , gbovKeyMarker :: Maybe Bucket
gbovKeyMarker       = Maybe Bucket
forall a. Maybe a
Nothing
      , gbovMaxKeys :: Maybe Int
gbovMaxKeys         = Maybe Int
forall a. Maybe a
Nothing
      , gbovPrefix :: Maybe Bucket
gbovPrefix          = Maybe Bucket
forall a. Maybe a
Nothing
      , gbovVersionIdMarker :: Maybe Bucket
gbovVersionIdMarker = Maybe Bucket
forall a. Maybe a
Nothing
      }

data GetBucketObjectVersionsResponse
    = GetBucketObjectVersionsResponse {
        GetBucketObjectVersionsResponse -> Bucket
gbovrName                :: Bucket
      , GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrDelimiter           :: Maybe T.Text
      , GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrKeyMarker           :: Maybe T.Text
      , GetBucketObjectVersionsResponse -> Maybe Int
gbovrMaxKeys             :: Maybe Int
      , GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrPrefix              :: Maybe T.Text
      , GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrVersionIdMarker     :: Maybe T.Text
      , GetBucketObjectVersionsResponse -> [ObjectVersionInfo]
gbovrContents            :: [ObjectVersionInfo]
      , GetBucketObjectVersionsResponse -> [Bucket]
gbovrCommonPrefixes      :: [T.Text]
      , GetBucketObjectVersionsResponse -> Bool
gbovrIsTruncated         :: Bool
      , GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrNextKeyMarker       :: Maybe T.Text
      , GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrNextVersionIdMarker :: Maybe T.Text
      }
    deriving (Int -> GetBucketObjectVersionsResponse -> ShowS
[GetBucketObjectVersionsResponse] -> ShowS
GetBucketObjectVersionsResponse -> String
(Int -> GetBucketObjectVersionsResponse -> ShowS)
-> (GetBucketObjectVersionsResponse -> String)
-> ([GetBucketObjectVersionsResponse] -> ShowS)
-> Show GetBucketObjectVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketObjectVersionsResponse] -> ShowS
$cshowList :: [GetBucketObjectVersionsResponse] -> ShowS
show :: GetBucketObjectVersionsResponse -> String
$cshow :: GetBucketObjectVersionsResponse -> String
showsPrec :: Int -> GetBucketObjectVersionsResponse -> ShowS
$cshowsPrec :: Int -> GetBucketObjectVersionsResponse -> ShowS
Show)

-- | ServiceConfiguration: 'S3Configuration'
instance SignQuery GetBucketObjectVersions where
    type ServiceConfiguration GetBucketObjectVersions = S3Configuration
    signQuery :: GetBucketObjectVersions
-> ServiceConfiguration GetBucketObjectVersions queryType
-> SignatureData
-> SignedQuery
signQuery GetBucketObjectVersions {Maybe Int
Maybe Bucket
Bucket
gbovVersionIdMarker :: Maybe Bucket
gbovPrefix :: Maybe Bucket
gbovMaxKeys :: Maybe Int
gbovKeyMarker :: Maybe Bucket
gbovDelimiter :: Maybe Bucket
gbovBucket :: Bucket
gbovVersionIdMarker :: GetBucketObjectVersions -> Maybe Bucket
gbovPrefix :: GetBucketObjectVersions -> Maybe Bucket
gbovMaxKeys :: GetBucketObjectVersions -> Maybe Int
gbovKeyMarker :: GetBucketObjectVersions -> Maybe Bucket
gbovDelimiter :: GetBucketObjectVersions -> Maybe Bucket
gbovBucket :: GetBucketObjectVersions -> Bucket
..} = S3Query
-> S3Configuration queryType -> SignatureData -> SignedQuery
forall qt.
S3Query -> S3Configuration qt -> SignatureData -> SignedQuery
s3SignQuery S3Query :: Method
-> Maybe ByteString
-> Maybe ByteString
-> Query
-> Query
-> Maybe ByteString
-> Maybe (Digest MD5)
-> RequestHeaders
-> RequestHeaders
-> Maybe RequestBody
-> S3Query
S3Query {
                                 s3QMethod :: Method
s3QMethod = Method
Get
                               , s3QBucket :: Maybe ByteString
s3QBucket = ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ Bucket -> ByteString
T.encodeUtf8 Bucket
gbovBucket
                               , s3QObject :: Maybe ByteString
s3QObject = Maybe ByteString
forall a. Maybe a
Nothing
                               , s3QSubresources :: Query
s3QSubresources = [ (ByteString
"versions", Maybe ByteString
forall a. Maybe a
Nothing) ]
                               , s3QQuery :: Query
s3QQuery = [Maybe (ByteString, Bucket)] -> Query
forall a. QueryLike a => a -> Query
HTTP.toQuery [
                                              (ByteString
"delimiter" :: B8.ByteString ,) (Bucket -> (ByteString, Bucket))
-> Maybe Bucket -> Maybe (ByteString, Bucket)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bucket
gbovDelimiter
                                            , (ByteString
"key-marker",) (Bucket -> (ByteString, Bucket))
-> Maybe Bucket -> Maybe (ByteString, Bucket)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bucket
gbovKeyMarker
                                            , (ByteString
"max-keys",) (Bucket -> (ByteString, Bucket))
-> (Int -> Bucket) -> Int -> (ByteString, Bucket)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bucket
T.pack (String -> Bucket) -> (Int -> String) -> Int -> Bucket
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall a. Show a => a -> String
show (Int -> (ByteString, Bucket))
-> Maybe Int -> Maybe (ByteString, Bucket)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Int
gbovMaxKeys
                                            , (ByteString
"prefix",) (Bucket -> (ByteString, Bucket))
-> Maybe Bucket -> Maybe (ByteString, Bucket)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bucket
gbovPrefix
                                            , (ByteString
"version-id-marker",) (Bucket -> (ByteString, Bucket))
-> Maybe Bucket -> Maybe (ByteString, Bucket)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bucket
gbovVersionIdMarker
                                            ]
                               , s3QContentType :: Maybe ByteString
s3QContentType = Maybe ByteString
forall a. Maybe a
Nothing
                               , s3QContentMd5 :: Maybe (Digest MD5)
s3QContentMd5 = Maybe (Digest MD5)
forall a. Maybe a
Nothing
                               , s3QAmzHeaders :: RequestHeaders
s3QAmzHeaders = []
                               , s3QOtherHeaders :: RequestHeaders
s3QOtherHeaders = []
                               , s3QRequestBody :: Maybe RequestBody
s3QRequestBody = Maybe RequestBody
forall a. Maybe a
Nothing
                               }

instance ResponseConsumer r GetBucketObjectVersionsResponse where
    type ResponseMetadata GetBucketObjectVersionsResponse = S3Metadata

    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata GetBucketObjectVersionsResponse)
-> HTTPResponseConsumer GetBucketObjectVersionsResponse
responseConsumer Request
_ r
_ = (Cursor -> Response S3Metadata GetBucketObjectVersionsResponse)
-> IORef S3Metadata
-> HTTPResponseConsumer GetBucketObjectVersionsResponse
forall a.
(Cursor -> Response S3Metadata a)
-> IORef S3Metadata -> HTTPResponseConsumer a
s3XmlResponseConsumer Cursor -> Response S3Metadata GetBucketObjectVersionsResponse
forall (m :: * -> *).
MonadThrow m =>
Cursor -> m GetBucketObjectVersionsResponse
parse
        where parse :: Cursor -> m GetBucketObjectVersionsResponse
parse Cursor
cursor
                  = do Bucket
name <- String -> [Bucket] -> m Bucket
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Name" ([Bucket] -> m Bucket) -> [Bucket] -> m Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"Name"
                       let delimiter :: Maybe Bucket
delimiter = [Bucket] -> Maybe Bucket
forall a. [a] -> Maybe a
listToMaybe ([Bucket] -> Maybe Bucket) -> [Bucket] -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"Delimiter"
                       let keyMarker :: Maybe Bucket
keyMarker = [Bucket] -> Maybe Bucket
forall a. [a] -> Maybe a
listToMaybe ([Bucket] -> Maybe Bucket) -> [Bucket] -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"KeyMarker"
                       let versionMarker :: Maybe Bucket
versionMarker = [Bucket] -> Maybe Bucket
forall a. [a] -> Maybe a
listToMaybe ([Bucket] -> Maybe Bucket) -> [Bucket] -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"VersionIdMarker"
                       Maybe Int
maxKeys <- Maybe (m Int) -> m (Maybe Int)
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
Data.Traversable.sequence (Maybe (m Int) -> m (Maybe Int))
-> ([m Int] -> Maybe (m Int)) -> [m Int] -> m (Maybe Int)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [m Int] -> Maybe (m Int)
forall a. [a] -> Maybe a
listToMaybe ([m Int] -> m (Maybe Int)) -> [m Int] -> m (Maybe Int)
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m Int]) -> [m Int]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"MaxKeys" (Cursor -> [Bucket]) -> (Bucket -> m Int) -> Cursor -> [m Int]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Bucket -> m Int
forall (m :: * -> *) a. (MonadThrow m, Num a) => Bucket -> m a
textReadInt
                       let truncated :: Bool
truncated = Bool -> (Bucket -> Bool) -> Maybe Bucket -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
True (Bucket -> Bucket -> Bool
forall a. Eq a => a -> a -> Bool
/= Bucket
"false") (Maybe Bucket -> Bool) -> Maybe Bucket -> Bool
forall a b. (a -> b) -> a -> b
$ [Bucket] -> Maybe Bucket
forall a. [a] -> Maybe a
listToMaybe ([Bucket] -> Maybe Bucket) -> [Bucket] -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"IsTruncated"
                       let nextKeyMarker :: Maybe Bucket
nextKeyMarker = [Bucket] -> Maybe Bucket
forall a. [a] -> Maybe a
listToMaybe ([Bucket] -> Maybe Bucket) -> [Bucket] -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"NextKeyMarker"
                       let nextVersionMarker :: Maybe Bucket
nextVersionMarker = [Bucket] -> Maybe Bucket
forall a. [a] -> Maybe a
listToMaybe ([Bucket] -> Maybe Bucket) -> [Bucket] -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"NextVersionIdMarker"
                       let prefix :: Maybe Bucket
prefix = [Bucket] -> Maybe Bucket
forall a. [a] -> Maybe a
listToMaybe ([Bucket] -> Maybe Bucket) -> [Bucket] -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Cursor -> [Bucket]
elContent Bucket
"Prefix"
                       [ObjectVersionInfo]
contents <- [m ObjectVersionInfo] -> m [ObjectVersionInfo]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence ([m ObjectVersionInfo] -> m [ObjectVersionInfo])
-> [m ObjectVersionInfo] -> m [ObjectVersionInfo]
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor
-> (Cursor -> [m ObjectVersionInfo]) -> [m ObjectVersionInfo]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ (Name -> Bool) -> Axis
forall b. Boolean b => (Name -> b) -> Axis
Cu.checkName Name -> Bool
objectNodeName Axis
-> (Cursor -> m ObjectVersionInfo)
-> Cursor
-> [m ObjectVersionInfo]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Cursor -> m ObjectVersionInfo
forall (m :: * -> *). MonadThrow m => Cursor -> m ObjectVersionInfo
parseObjectVersionInfo
                       let commonPrefixes :: [Bucket]
commonPrefixes = Cursor
cursor Cursor -> (Cursor -> [Bucket]) -> [Bucket]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Bucket -> Axis
Cu.laxElement Bucket
"CommonPrefixes" Axis -> (Cursor -> [Bucket]) -> Cursor -> [Bucket]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&// Cursor -> [Bucket]
Cu.content
                       GetBucketObjectVersionsResponse
-> m GetBucketObjectVersionsResponse
forall (m :: * -> *) a. Monad m => a -> m a
return GetBucketObjectVersionsResponse :: Bucket
-> Maybe Bucket
-> Maybe Bucket
-> Maybe Int
-> Maybe Bucket
-> Maybe Bucket
-> [ObjectVersionInfo]
-> [Bucket]
-> Bool
-> Maybe Bucket
-> Maybe Bucket
-> GetBucketObjectVersionsResponse
GetBucketObjectVersionsResponse{
                                                gbovrName :: Bucket
gbovrName                = Bucket
name
                                              , gbovrDelimiter :: Maybe Bucket
gbovrDelimiter           = Maybe Bucket
delimiter
                                              , gbovrKeyMarker :: Maybe Bucket
gbovrKeyMarker           = Maybe Bucket
keyMarker
                                              , gbovrMaxKeys :: Maybe Int
gbovrMaxKeys             = Maybe Int
maxKeys
                                              , gbovrPrefix :: Maybe Bucket
gbovrPrefix              = Maybe Bucket
prefix
                                              , gbovrVersionIdMarker :: Maybe Bucket
gbovrVersionIdMarker     = Maybe Bucket
versionMarker
                                              , gbovrContents :: [ObjectVersionInfo]
gbovrContents            = [ObjectVersionInfo]
contents
                                              , gbovrCommonPrefixes :: [Bucket]
gbovrCommonPrefixes      = [Bucket]
commonPrefixes
                                              , gbovrIsTruncated :: Bool
gbovrIsTruncated         = Bool
truncated
                                              , gbovrNextKeyMarker :: Maybe Bucket
gbovrNextKeyMarker       = Maybe Bucket
nextKeyMarker
                                              , gbovrNextVersionIdMarker :: Maybe Bucket
gbovrNextVersionIdMarker = Maybe Bucket
nextVersionMarker
                                              }
              objectNodeName :: Name -> Bool
objectNodeName Name
n = let fn :: Bucket
fn = Bucket -> Bucket
T.toCaseFold (Bucket -> Bucket) -> Bucket -> Bucket
forall a b. (a -> b) -> a -> b
$ Name -> Bucket
XML.nameLocalName Name
n
                                  in Bucket
fn Bucket -> Bucket -> Bool
forall a. Eq a => a -> a -> Bool
== Bucket -> Bucket
T.toCaseFold Bucket
"Version" Bool -> Bool -> Bool
|| Bucket
fn Bucket -> Bucket -> Bool
forall a. Eq a => a -> a -> Bool
== Bucket -> Bucket
T.toCaseFold Bucket
"DeleteMarker"

instance Transaction GetBucketObjectVersions GetBucketObjectVersionsResponse

instance IteratedTransaction GetBucketObjectVersions GetBucketObjectVersionsResponse where
    nextIteratedRequest :: GetBucketObjectVersions
-> GetBucketObjectVersionsResponse -> Maybe GetBucketObjectVersions
nextIteratedRequest GetBucketObjectVersions
request GetBucketObjectVersionsResponse
response
        = case (GetBucketObjectVersionsResponse -> Bool
gbovrIsTruncated GetBucketObjectVersionsResponse
response, GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrNextKeyMarker GetBucketObjectVersionsResponse
response, GetBucketObjectVersionsResponse -> Maybe Bucket
gbovrNextVersionIdMarker GetBucketObjectVersionsResponse
response, GetBucketObjectVersionsResponse -> [ObjectVersionInfo]
gbovrContents GetBucketObjectVersionsResponse
response) of
            (Bool
True, Just Bucket
keyMarker, Just Bucket
versionMarker, [ObjectVersionInfo]
_             ) -> GetBucketObjectVersions -> Maybe GetBucketObjectVersions
forall a. a -> Maybe a
Just (GetBucketObjectVersions -> Maybe GetBucketObjectVersions)
-> GetBucketObjectVersions -> Maybe GetBucketObjectVersions
forall a b. (a -> b) -> a -> b
$ GetBucketObjectVersions
request { gbovKeyMarker :: Maybe Bucket
gbovKeyMarker = Bucket -> Maybe Bucket
forall a. a -> Maybe a
Just Bucket
keyMarker, gbovVersionIdMarker :: Maybe Bucket
gbovVersionIdMarker = Bucket -> Maybe Bucket
forall a. a -> Maybe a
Just Bucket
versionMarker }
            (Bool
True, Maybe Bucket
Nothing,        Maybe Bucket
Nothing,            contents :: [ObjectVersionInfo]
contents@(ObjectVersionInfo
_:[ObjectVersionInfo]
_)) -> GetBucketObjectVersions -> Maybe GetBucketObjectVersions
forall a. a -> Maybe a
Just (GetBucketObjectVersions -> Maybe GetBucketObjectVersions)
-> GetBucketObjectVersions -> Maybe GetBucketObjectVersions
forall a b. (a -> b) -> a -> b
$ GetBucketObjectVersions
request { gbovKeyMarker :: Maybe Bucket
gbovKeyMarker = Bucket -> Maybe Bucket
forall a. a -> Maybe a
Just (Bucket -> Maybe Bucket) -> Bucket -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ ObjectVersionInfo -> Bucket
oviKey (ObjectVersionInfo -> Bucket) -> ObjectVersionInfo -> Bucket
forall a b. (a -> b) -> a -> b
$ [ObjectVersionInfo] -> ObjectVersionInfo
forall a. [a] -> a
last [ObjectVersionInfo]
contents, gbovVersionIdMarker :: Maybe Bucket
gbovVersionIdMarker = Bucket -> Maybe Bucket
forall a. a -> Maybe a
Just (Bucket -> Maybe Bucket) -> Bucket -> Maybe Bucket
forall a b. (a -> b) -> a -> b
$ ObjectVersionInfo -> Bucket
oviVersionId (ObjectVersionInfo -> Bucket) -> ObjectVersionInfo -> Bucket
forall a b. (a -> b) -> a -> b
$ [ObjectVersionInfo] -> ObjectVersionInfo
forall a. [a] -> a
last [ObjectVersionInfo]
contents }
            (Bool
_,    Maybe Bucket
_,              Maybe Bucket
_,                  [ObjectVersionInfo]
_             ) -> Maybe GetBucketObjectVersions
forall a. Maybe a
Nothing

instance ListResponse GetBucketObjectVersionsResponse ObjectVersionInfo where
    listResponse :: GetBucketObjectVersionsResponse -> [ObjectVersionInfo]
listResponse = GetBucketObjectVersionsResponse -> [ObjectVersionInfo]
gbovrContents

instance AsMemoryResponse GetBucketObjectVersionsResponse where
    type MemoryResponse GetBucketObjectVersionsResponse = GetBucketObjectVersionsResponse
    loadToMemory :: GetBucketObjectVersionsResponse
-> ResourceT IO (MemoryResponse GetBucketObjectVersionsResponse)
loadToMemory = GetBucketObjectVersionsResponse
-> ResourceT IO (MemoryResponse GetBucketObjectVersionsResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return