module Aws.SimpleDb.Commands.Domain where

import           Aws.Core
import           Aws.SimpleDb.Core
import           Control.Applicative
import           Data.Maybe
import           Data.Time
import           Data.Time.Clock.POSIX
import           Prelude
import           Text.XML.Cursor       (($//), (&|))
import qualified Data.Text             as T
import qualified Data.Text.Encoding    as T

data CreateDomain
    = CreateDomain {
        CreateDomain -> Text
cdDomainName :: T.Text
      }
    deriving (Int -> CreateDomain -> ShowS
[CreateDomain] -> ShowS
CreateDomain -> String
(Int -> CreateDomain -> ShowS)
-> (CreateDomain -> String)
-> ([CreateDomain] -> ShowS)
-> Show CreateDomain
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateDomain -> ShowS
showsPrec :: Int -> CreateDomain -> ShowS
$cshow :: CreateDomain -> String
show :: CreateDomain -> String
$cshowList :: [CreateDomain] -> ShowS
showList :: [CreateDomain] -> ShowS
Show)

data CreateDomainResponse 
    = CreateDomainResponse
    deriving (Int -> CreateDomainResponse -> ShowS
[CreateDomainResponse] -> ShowS
CreateDomainResponse -> String
(Int -> CreateDomainResponse -> ShowS)
-> (CreateDomainResponse -> String)
-> ([CreateDomainResponse] -> ShowS)
-> Show CreateDomainResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateDomainResponse -> ShowS
showsPrec :: Int -> CreateDomainResponse -> ShowS
$cshow :: CreateDomainResponse -> String
show :: CreateDomainResponse -> String
$cshowList :: [CreateDomainResponse] -> ShowS
showList :: [CreateDomainResponse] -> ShowS
Show)
             
createDomain :: T.Text -> CreateDomain
createDomain :: Text -> CreateDomain
createDomain Text
name = CreateDomain { cdDomainName :: Text
cdDomainName = Text
name }
             
-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery CreateDomain where
    type ServiceConfiguration CreateDomain = SdbConfiguration
    signQuery :: forall queryType.
CreateDomain
-> ServiceConfiguration CreateDomain queryType
-> SignatureData
-> SignedQuery
signQuery CreateDomain{Text
cdDomainName :: CreateDomain -> Text
cdDomainName :: Text
..} = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery [(ByteString
"Action", ByteString
"CreateDomain"), (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
cdDomainName)]

instance ResponseConsumer r CreateDomainResponse where
    type ResponseMetadata CreateDomainResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata CreateDomainResponse)
-> HTTPResponseConsumer CreateDomainResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata CreateDomainResponse)
-> IORef SdbMetadata -> HTTPResponseConsumer CreateDomainResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer ((Cursor -> Response SdbMetadata CreateDomainResponse)
 -> IORef SdbMetadata -> HTTPResponseConsumer CreateDomainResponse)
-> (Cursor -> Response SdbMetadata CreateDomainResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer CreateDomainResponse
forall a b. (a -> b) -> a -> b
$ CreateDomainResponse
-> Text -> Cursor -> Response SdbMetadata CreateDomainResponse
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType CreateDomainResponse
CreateDomainResponse Text
"CreateDomainResponse"

instance Transaction CreateDomain CreateDomainResponse

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

data DeleteDomain
    = DeleteDomain {
        DeleteDomain -> Text
ddDomainName :: T.Text
      }
    deriving (Int -> DeleteDomain -> ShowS
[DeleteDomain] -> ShowS
DeleteDomain -> String
(Int -> DeleteDomain -> ShowS)
-> (DeleteDomain -> String)
-> ([DeleteDomain] -> ShowS)
-> Show DeleteDomain
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteDomain -> ShowS
showsPrec :: Int -> DeleteDomain -> ShowS
$cshow :: DeleteDomain -> String
show :: DeleteDomain -> String
$cshowList :: [DeleteDomain] -> ShowS
showList :: [DeleteDomain] -> ShowS
Show)

data DeleteDomainResponse
    = DeleteDomainResponse
    deriving (Int -> DeleteDomainResponse -> ShowS
[DeleteDomainResponse] -> ShowS
DeleteDomainResponse -> String
(Int -> DeleteDomainResponse -> ShowS)
-> (DeleteDomainResponse -> String)
-> ([DeleteDomainResponse] -> ShowS)
-> Show DeleteDomainResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteDomainResponse -> ShowS
showsPrec :: Int -> DeleteDomainResponse -> ShowS
$cshow :: DeleteDomainResponse -> String
show :: DeleteDomainResponse -> String
$cshowList :: [DeleteDomainResponse] -> ShowS
showList :: [DeleteDomainResponse] -> ShowS
Show)
             
deleteDomain :: T.Text -> DeleteDomain
deleteDomain :: Text -> DeleteDomain
deleteDomain Text
name = DeleteDomain { ddDomainName :: Text
ddDomainName = Text
name }
             
-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery DeleteDomain where
    type ServiceConfiguration DeleteDomain = SdbConfiguration
    signQuery :: forall queryType.
DeleteDomain
-> ServiceConfiguration DeleteDomain queryType
-> SignatureData
-> SignedQuery
signQuery DeleteDomain{Text
ddDomainName :: DeleteDomain -> Text
ddDomainName :: Text
..} = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery [(ByteString
"Action", ByteString
"DeleteDomain"), (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
ddDomainName)]

instance ResponseConsumer r DeleteDomainResponse where
    type ResponseMetadata DeleteDomainResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata DeleteDomainResponse)
-> HTTPResponseConsumer DeleteDomainResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata DeleteDomainResponse)
-> IORef SdbMetadata -> HTTPResponseConsumer DeleteDomainResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer ((Cursor -> Response SdbMetadata DeleteDomainResponse)
 -> IORef SdbMetadata -> HTTPResponseConsumer DeleteDomainResponse)
-> (Cursor -> Response SdbMetadata DeleteDomainResponse)
-> IORef SdbMetadata
-> HTTPResponseConsumer DeleteDomainResponse
forall a b. (a -> b) -> a -> b
$ DeleteDomainResponse
-> Text -> Cursor -> Response SdbMetadata DeleteDomainResponse
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType DeleteDomainResponse
DeleteDomainResponse Text
"DeleteDomainResponse"

instance Transaction DeleteDomain DeleteDomainResponse

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

data DomainMetadata
    = DomainMetadata {
        DomainMetadata -> Text
dmDomainName :: T.Text
      }
    deriving (Int -> DomainMetadata -> ShowS
[DomainMetadata] -> ShowS
DomainMetadata -> String
(Int -> DomainMetadata -> ShowS)
-> (DomainMetadata -> String)
-> ([DomainMetadata] -> ShowS)
-> Show DomainMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DomainMetadata -> ShowS
showsPrec :: Int -> DomainMetadata -> ShowS
$cshow :: DomainMetadata -> String
show :: DomainMetadata -> String
$cshowList :: [DomainMetadata] -> ShowS
showList :: [DomainMetadata] -> ShowS
Show)

data DomainMetadataResponse
    = DomainMetadataResponse {
        DomainMetadataResponse -> UTCTime
dmrTimestamp :: UTCTime
      , DomainMetadataResponse -> Integer
dmrItemCount :: Integer
      , DomainMetadataResponse -> Integer
dmrAttributeValueCount :: Integer
      , DomainMetadataResponse -> Integer
dmrAttributeNameCount :: Integer
      , DomainMetadataResponse -> Integer
dmrItemNamesSizeBytes :: Integer
      , DomainMetadataResponse -> Integer
dmrAttributeValuesSizeBytes :: Integer
      , DomainMetadataResponse -> Integer
dmrAttributeNamesSizeBytes :: Integer
      }
    deriving (Int -> DomainMetadataResponse -> ShowS
[DomainMetadataResponse] -> ShowS
DomainMetadataResponse -> String
(Int -> DomainMetadataResponse -> ShowS)
-> (DomainMetadataResponse -> String)
-> ([DomainMetadataResponse] -> ShowS)
-> Show DomainMetadataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DomainMetadataResponse -> ShowS
showsPrec :: Int -> DomainMetadataResponse -> ShowS
$cshow :: DomainMetadataResponse -> String
show :: DomainMetadataResponse -> String
$cshowList :: [DomainMetadataResponse] -> ShowS
showList :: [DomainMetadataResponse] -> ShowS
Show)

domainMetadata :: T.Text -> DomainMetadata
domainMetadata :: Text -> DomainMetadata
domainMetadata Text
name = DomainMetadata { dmDomainName :: Text
dmDomainName = Text
name }

-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery DomainMetadata where
    type ServiceConfiguration DomainMetadata = SdbConfiguration
    signQuery :: forall queryType.
DomainMetadata
-> ServiceConfiguration DomainMetadata queryType
-> SignatureData
-> SignedQuery
signQuery DomainMetadata{Text
dmDomainName :: DomainMetadata -> Text
dmDomainName :: Text
..} = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery [(ByteString
"Action", ByteString
"DomainMetadata"), (ByteString
"DomainName", Text -> ByteString
T.encodeUtf8 Text
dmDomainName)]

instance ResponseConsumer r DomainMetadataResponse where
    type ResponseMetadata DomainMetadataResponse = SdbMetadata

    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata DomainMetadataResponse)
-> HTTPResponseConsumer DomainMetadataResponse
responseConsumer Request
_ r
_
        = (Cursor -> Response SdbMetadata DomainMetadataResponse)
-> IORef SdbMetadata -> HTTPResponseConsumer DomainMetadataResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer Cursor -> Response SdbMetadata DomainMetadataResponse
forall {m :: * -> *}.
MonadThrow m =>
Cursor -> m DomainMetadataResponse
parse
        where parse :: Cursor -> m DomainMetadataResponse
parse Cursor
cursor = do
                () -> Text -> Cursor -> m ()
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType () Text
"DomainMetadataResponse" Cursor
cursor
                UTCTime
dmrTimestamp <- String -> [m UTCTime] -> m UTCTime
forall (m :: * -> *) a. MonadThrow m => String -> [m a] -> m a
forceM String
"Timestamp expected" ([m UTCTime] -> m UTCTime) -> [m UTCTime] -> m UTCTime
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m UTCTime]) -> [m UTCTime]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [String]
elCont Text
"Timestamp" (Cursor -> [String])
-> (String -> m UTCTime) -> Cursor -> [m UTCTime]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| ((POSIXTime -> UTCTime) -> m POSIXTime -> m UTCTime
forall a b. (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap POSIXTime -> UTCTime
posixSecondsToUTCTime (m POSIXTime -> m UTCTime)
-> (String -> m POSIXTime) -> String -> m UTCTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m POSIXTime
forall (m :: * -> *) a. (MonadThrow m, Num a) => String -> m a
readInt)
                Integer
dmrItemCount <- String -> [m Integer] -> m Integer
forall (m :: * -> *) a. MonadThrow m => String -> [m a] -> m a
forceM String
"ItemCount expected" ([m Integer] -> m Integer) -> [m Integer] -> m Integer
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m Integer]) -> [m Integer]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [String]
elCont Text
"ItemCount" (Cursor -> [String])
-> (String -> m Integer) -> Cursor -> [m Integer]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| String -> m Integer
forall (m :: * -> *) a. (MonadThrow m, Num a) => String -> m a
readInt
                Integer
dmrAttributeValueCount <- String -> [m Integer] -> m Integer
forall (m :: * -> *) a. MonadThrow m => String -> [m a] -> m a
forceM String
"AttributeValueCount expected" ([m Integer] -> m Integer) -> [m Integer] -> m Integer
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m Integer]) -> [m Integer]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [String]
elCont Text
"AttributeValueCount" (Cursor -> [String])
-> (String -> m Integer) -> Cursor -> [m Integer]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| String -> m Integer
forall (m :: * -> *) a. (MonadThrow m, Num a) => String -> m a
readInt
                Integer
dmrAttributeNameCount <- String -> [m Integer] -> m Integer
forall (m :: * -> *) a. MonadThrow m => String -> [m a] -> m a
forceM String
"AttributeNameCount expected" ([m Integer] -> m Integer) -> [m Integer] -> m Integer
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m Integer]) -> [m Integer]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [String]
elCont Text
"AttributeNameCount" (Cursor -> [String])
-> (String -> m Integer) -> Cursor -> [m Integer]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| String -> m Integer
forall (m :: * -> *) a. (MonadThrow m, Num a) => String -> m a
readInt
                Integer
dmrItemNamesSizeBytes <- String -> [m Integer] -> m Integer
forall (m :: * -> *) a. MonadThrow m => String -> [m a] -> m a
forceM String
"ItemNamesSizeBytes expected" ([m Integer] -> m Integer) -> [m Integer] -> m Integer
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m Integer]) -> [m Integer]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [String]
elCont Text
"ItemNamesSizeBytes" (Cursor -> [String])
-> (String -> m Integer) -> Cursor -> [m Integer]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| String -> m Integer
forall (m :: * -> *) a. (MonadThrow m, Num a) => String -> m a
readInt
                Integer
dmrAttributeValuesSizeBytes <- String -> [m Integer] -> m Integer
forall (m :: * -> *) a. MonadThrow m => String -> [m a] -> m a
forceM String
"AttributeValuesSizeBytes expected" ([m Integer] -> m Integer) -> [m Integer] -> m Integer
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m Integer]) -> [m Integer]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [String]
elCont Text
"AttributeValuesSizeBytes" (Cursor -> [String])
-> (String -> m Integer) -> Cursor -> [m Integer]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| String -> m Integer
forall (m :: * -> *) a. (MonadThrow m, Num a) => String -> m a
readInt
                Integer
dmrAttributeNamesSizeBytes <- String -> [m Integer] -> m Integer
forall (m :: * -> *) a. MonadThrow m => String -> [m a] -> m a
forceM String
"AttributeNamesSizeBytes expected" ([m Integer] -> m Integer) -> [m Integer] -> m Integer
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [m Integer]) -> [m Integer]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [String]
elCont Text
"AttributeNamesSizeBytes" (Cursor -> [String])
-> (String -> m Integer) -> Cursor -> [m Integer]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| String -> m Integer
forall (m :: * -> *) a. (MonadThrow m, Num a) => String -> m a
readInt
                DomainMetadataResponse -> m DomainMetadataResponse
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return DomainMetadataResponse{Integer
UTCTime
dmrTimestamp :: UTCTime
dmrItemCount :: Integer
dmrAttributeValueCount :: Integer
dmrAttributeNameCount :: Integer
dmrItemNamesSizeBytes :: Integer
dmrAttributeValuesSizeBytes :: Integer
dmrAttributeNamesSizeBytes :: Integer
dmrTimestamp :: UTCTime
dmrItemCount :: Integer
dmrAttributeValueCount :: Integer
dmrAttributeNameCount :: Integer
dmrItemNamesSizeBytes :: Integer
dmrAttributeValuesSizeBytes :: Integer
dmrAttributeNamesSizeBytes :: Integer
..}

instance Transaction DomainMetadata DomainMetadataResponse

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

data ListDomains
    = ListDomains {
        ListDomains -> Maybe Int
ldMaxNumberOfDomains :: Maybe Int
      , ListDomains -> Maybe Text
ldNextToken :: Maybe T.Text
      }
    deriving (Int -> ListDomains -> ShowS
[ListDomains] -> ShowS
ListDomains -> String
(Int -> ListDomains -> ShowS)
-> (ListDomains -> String)
-> ([ListDomains] -> ShowS)
-> Show ListDomains
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListDomains -> ShowS
showsPrec :: Int -> ListDomains -> ShowS
$cshow :: ListDomains -> String
show :: ListDomains -> String
$cshowList :: [ListDomains] -> ShowS
showList :: [ListDomains] -> ShowS
Show)

data ListDomainsResponse
    = ListDomainsResponse {
        ListDomainsResponse -> [Text]
ldrDomainNames :: [T.Text]
      , ListDomainsResponse -> Maybe Text
ldrNextToken :: Maybe T.Text
      }
    deriving (Int -> ListDomainsResponse -> ShowS
[ListDomainsResponse] -> ShowS
ListDomainsResponse -> String
(Int -> ListDomainsResponse -> ShowS)
-> (ListDomainsResponse -> String)
-> ([ListDomainsResponse] -> ShowS)
-> Show ListDomainsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListDomainsResponse -> ShowS
showsPrec :: Int -> ListDomainsResponse -> ShowS
$cshow :: ListDomainsResponse -> String
show :: ListDomainsResponse -> String
$cshowList :: [ListDomainsResponse] -> ShowS
showList :: [ListDomainsResponse] -> ShowS
Show)

listDomains :: ListDomains
listDomains :: ListDomains
listDomains = ListDomains { ldMaxNumberOfDomains :: Maybe Int
ldMaxNumberOfDomains = Maybe Int
forall a. Maybe a
Nothing, ldNextToken :: Maybe Text
ldNextToken = Maybe Text
forall a. Maybe a
Nothing }

-- | ServiceConfiguration: 'SdbConfiguration'
instance SignQuery ListDomains where
    type ServiceConfiguration ListDomains = SdbConfiguration
    signQuery :: forall queryType.
ListDomains
-> ServiceConfiguration ListDomains queryType
-> SignatureData
-> SignedQuery
signQuery ListDomains{Maybe Int
Maybe Text
ldMaxNumberOfDomains :: ListDomains -> Maybe Int
ldNextToken :: ListDomains -> Maybe Text
ldMaxNumberOfDomains :: Maybe Int
ldNextToken :: Maybe Text
..} = [(ByteString, ByteString)]
-> SdbConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SdbConfiguration qt -> SignatureData -> SignedQuery
sdbSignQuery ([(ByteString, ByteString)]
 -> SdbConfiguration queryType -> SignatureData -> SignedQuery)
-> [(ByteString, ByteString)]
-> SdbConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$ [Maybe (ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [Maybe a] -> [a]
catMaybes [
                                  (ByteString, ByteString) -> Maybe (ByteString, ByteString)
forall a. a -> Maybe a
Just (ByteString
"Action", ByteString
"ListDomains")
                                , (ByteString
"MaxNumberOfDomains",) (ByteString -> (ByteString, ByteString))
-> (Int -> ByteString) -> Int -> (ByteString, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
T.encodeUtf8 (Text -> ByteString) -> (Int -> Text) -> Int -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack (String -> Text) -> (Int -> String) -> Int -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall a. Show a => a -> String
show (Int -> (ByteString, ByteString))
-> Maybe Int -> Maybe (ByteString, ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Int
ldMaxNumberOfDomains
                                , (ByteString
"NextToken",) (ByteString -> (ByteString, ByteString))
-> (Text -> ByteString) -> Text -> (ByteString, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
T.encodeUtf8 (Text -> (ByteString, ByteString))
-> Maybe Text -> Maybe (ByteString, ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
ldNextToken
                                ]

instance ResponseConsumer r ListDomainsResponse where
    type ResponseMetadata ListDomainsResponse = SdbMetadata
    responseConsumer :: Request
-> r
-> IORef (ResponseMetadata ListDomainsResponse)
-> HTTPResponseConsumer ListDomainsResponse
responseConsumer Request
_ r
_ = (Cursor -> Response SdbMetadata ListDomainsResponse)
-> IORef SdbMetadata -> HTTPResponseConsumer ListDomainsResponse
forall a.
(Cursor -> Response SdbMetadata a)
-> IORef SdbMetadata -> HTTPResponseConsumer a
sdbResponseConsumer Cursor -> Response SdbMetadata ListDomainsResponse
forall {m :: * -> *}.
MonadThrow m =>
Cursor -> m ListDomainsResponse
parse
        where parse :: Cursor -> m ListDomainsResponse
parse Cursor
cursor = do
                () -> Text -> Cursor -> m ()
forall (m :: * -> *) a. MonadThrow m => a -> Text -> Cursor -> m a
sdbCheckResponseType () Text
"ListDomainsResponse" Cursor
cursor
                let names :: [Text]
names = Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [Text]
elContent Text
"DomainName"
                let nextToken :: Maybe Text
nextToken = [Text] -> Maybe Text
forall a. [a] -> Maybe a
listToMaybe ([Text] -> Maybe Text) -> [Text] -> Maybe Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [Text]
elContent Text
"NextToken"
                ListDomainsResponse -> m ListDomainsResponse
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (ListDomainsResponse -> m ListDomainsResponse)
-> ListDomainsResponse -> m ListDomainsResponse
forall a b. (a -> b) -> a -> b
$ [Text] -> Maybe Text -> ListDomainsResponse
ListDomainsResponse [Text]
names Maybe Text
nextToken

instance Transaction ListDomains ListDomainsResponse

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

instance ListResponse ListDomainsResponse T.Text where
    listResponse :: ListDomainsResponse -> [Text]
listResponse = ListDomainsResponse -> [Text]
ldrDomainNames

instance IteratedTransaction ListDomains ListDomainsResponse where
  nextIteratedRequest :: ListDomains -> ListDomainsResponse -> Maybe ListDomains
nextIteratedRequest ListDomains
req ListDomainsResponse{ldrNextToken :: ListDomainsResponse -> Maybe Text
ldrNextToken=Maybe Text
nt} = ListDomains
req{ldNextToken=nt} ListDomains -> Maybe Text -> Maybe ListDomains
forall a b. a -> Maybe b -> Maybe a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Maybe Text
nt
  --combineIteratedResponse (ListDomainsResponse dn1 _) (ListDomainsResponse dn2 nt2) = ListDomainsResponse (dn1 ++ dn2) nt2