module Aws.Sqs.Commands.Message
(
UserMessageAttributeCustomType
, UserMessageAttributeValue(..)
, UserMessageAttributeName
, UserMessageAttribute
, SendMessage(..)
, SendMessageResponse(..)
, DeleteMessage(..)
, DeleteMessageResponse(..)
, Message(..)
, ReceiveMessage(..)
, ReceiveMessageResponse(..)
, ChangeMessageVisibility(..)
, ChangeMessageVisibilityResponse(..)
) where
import Aws.Core
import Aws.Sqs.Core
import Control.Applicative
import Control.Monad.Trans.Resource (throwM)
import Data.Maybe
import Data.Monoid
import Text.XML.Cursor (($/), ($//), (&/), (&|))
import qualified Data.ByteString.Base64 as B64
import qualified Data.ByteString.Char8 as B
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import Data.Scientific
import qualified Network.HTTP.Types as HTTP
import Text.Read (readEither)
import qualified Text.XML.Cursor as Cu
import Prelude
type UserMessageAttributeCustomType = T.Text
data UserMessageAttributeValue
= UserMessageAttributeString (Maybe UserMessageAttributeCustomType) T.Text
| UserMessageAttributeNumber (Maybe UserMessageAttributeCustomType) Scientific
| UserMessageAttributeBinary (Maybe UserMessageAttributeCustomType) B.ByteString
deriving (Int -> UserMessageAttributeValue -> ShowS
[UserMessageAttributeValue] -> ShowS
UserMessageAttributeValue -> String
(Int -> UserMessageAttributeValue -> ShowS)
-> (UserMessageAttributeValue -> String)
-> ([UserMessageAttributeValue] -> ShowS)
-> Show UserMessageAttributeValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UserMessageAttributeValue -> ShowS
showsPrec :: Int -> UserMessageAttributeValue -> ShowS
$cshow :: UserMessageAttributeValue -> String
show :: UserMessageAttributeValue -> String
$cshowList :: [UserMessageAttributeValue] -> ShowS
showList :: [UserMessageAttributeValue] -> ShowS
Show, ReadPrec [UserMessageAttributeValue]
ReadPrec UserMessageAttributeValue
Int -> ReadS UserMessageAttributeValue
ReadS [UserMessageAttributeValue]
(Int -> ReadS UserMessageAttributeValue)
-> ReadS [UserMessageAttributeValue]
-> ReadPrec UserMessageAttributeValue
-> ReadPrec [UserMessageAttributeValue]
-> Read UserMessageAttributeValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS UserMessageAttributeValue
readsPrec :: Int -> ReadS UserMessageAttributeValue
$creadList :: ReadS [UserMessageAttributeValue]
readList :: ReadS [UserMessageAttributeValue]
$creadPrec :: ReadPrec UserMessageAttributeValue
readPrec :: ReadPrec UserMessageAttributeValue
$creadListPrec :: ReadPrec [UserMessageAttributeValue]
readListPrec :: ReadPrec [UserMessageAttributeValue]
Read, UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
(UserMessageAttributeValue -> UserMessageAttributeValue -> Bool)
-> (UserMessageAttributeValue -> UserMessageAttributeValue -> Bool)
-> Eq UserMessageAttributeValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
== :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
$c/= :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
/= :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
Eq, Eq UserMessageAttributeValue
Eq UserMessageAttributeValue =>
(UserMessageAttributeValue
-> UserMessageAttributeValue -> Ordering)
-> (UserMessageAttributeValue -> UserMessageAttributeValue -> Bool)
-> (UserMessageAttributeValue -> UserMessageAttributeValue -> Bool)
-> (UserMessageAttributeValue -> UserMessageAttributeValue -> Bool)
-> (UserMessageAttributeValue -> UserMessageAttributeValue -> Bool)
-> (UserMessageAttributeValue
-> UserMessageAttributeValue -> UserMessageAttributeValue)
-> (UserMessageAttributeValue
-> UserMessageAttributeValue -> UserMessageAttributeValue)
-> Ord UserMessageAttributeValue
UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
UserMessageAttributeValue -> UserMessageAttributeValue -> Ordering
UserMessageAttributeValue
-> UserMessageAttributeValue -> UserMessageAttributeValue
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: UserMessageAttributeValue -> UserMessageAttributeValue -> Ordering
compare :: UserMessageAttributeValue -> UserMessageAttributeValue -> Ordering
$c< :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
< :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
$c<= :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
<= :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
$c> :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
> :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
$c>= :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
>= :: UserMessageAttributeValue -> UserMessageAttributeValue -> Bool
$cmax :: UserMessageAttributeValue
-> UserMessageAttributeValue -> UserMessageAttributeValue
max :: UserMessageAttributeValue
-> UserMessageAttributeValue -> UserMessageAttributeValue
$cmin :: UserMessageAttributeValue
-> UserMessageAttributeValue -> UserMessageAttributeValue
min :: UserMessageAttributeValue
-> UserMessageAttributeValue -> UserMessageAttributeValue
Ord)
type UserMessageAttributeName = T.Text
type UserMessageAttribute = (UserMessageAttributeName, UserMessageAttributeValue)
userMessageAttributesQuery :: [UserMessageAttribute] -> HTTP.Query
userMessageAttributesQuery :: [UserMessageAttribute] -> Query
userMessageAttributesQuery = [Query] -> Query
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([Query] -> Query)
-> ([UserMessageAttribute] -> [Query])
-> [UserMessageAttribute]
-> Query
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> UserMessageAttribute -> Query)
-> [Int] -> [UserMessageAttribute] -> [Query]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith Int -> UserMessageAttribute -> Query
forall {a}. Show a => a -> UserMessageAttribute -> Query
msgAttrQuery [Int
1 :: Int ..]
where
msgAttrQuery :: a -> UserMessageAttribute -> Query
msgAttrQuery a
i (Text
name, UserMessageAttributeValue
value) =
[ ( ByteString
pre ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"Name", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
TE.encodeUtf8 Text
name )
, ( ByteString
pre ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"Value.DataType", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
typ )
, ( ByteString
pre ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"Value." ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
valueKey, ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
encodedValue )
]
where
pre :: ByteString
pre = ByteString
"MessageAttribute." ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> String -> ByteString
B.pack (a -> String
forall a. Show a => a -> String
show a
i) ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"."
customType :: Maybe Text -> Text -> ByteString
customType Maybe Text
Nothing Text
t = Text -> ByteString
TE.encodeUtf8 Text
t
customType (Just Text
c) Text
t = Text -> ByteString
TE.encodeUtf8 (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
$ Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"." Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
c
(ByteString
typ, ByteString
valueKey, ByteString
encodedValue) = case UserMessageAttributeValue
value of
UserMessageAttributeString Maybe Text
c Text
t ->
(Maybe Text -> Text -> ByteString
customType Maybe Text
c Text
"String", ByteString
"StringValue", Text -> ByteString
TE.encodeUtf8 Text
t)
UserMessageAttributeNumber Maybe Text
c Scientific
n ->
(Maybe Text -> Text -> ByteString
customType Maybe Text
c Text
"Number", ByteString
"StringValue", String -> ByteString
B.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
$ Scientific -> String
forall a. Show a => a -> String
show Scientific
n)
UserMessageAttributeBinary Maybe Text
c ByteString
b ->
(Maybe Text -> Text -> ByteString
customType Maybe Text
c Text
"Binary", ByteString
"BinaryValue", ByteString
b)
data SendMessage = SendMessage
{ SendMessage -> Text
smMessage :: !T.Text
, SendMessage -> QueueName
smQueueName :: !QueueName
, SendMessage -> [UserMessageAttribute]
smAttributes :: ![UserMessageAttribute]
, SendMessage -> Maybe Int
smDelaySeconds :: !(Maybe Int)
}
deriving (Int -> SendMessage -> ShowS
[SendMessage] -> ShowS
SendMessage -> String
(Int -> SendMessage -> ShowS)
-> (SendMessage -> String)
-> ([SendMessage] -> ShowS)
-> Show SendMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendMessage -> ShowS
showsPrec :: Int -> SendMessage -> ShowS
$cshow :: SendMessage -> String
show :: SendMessage -> String
$cshowList :: [SendMessage] -> ShowS
showList :: [SendMessage] -> ShowS
Show, ReadPrec [SendMessage]
ReadPrec SendMessage
Int -> ReadS SendMessage
ReadS [SendMessage]
(Int -> ReadS SendMessage)
-> ReadS [SendMessage]
-> ReadPrec SendMessage
-> ReadPrec [SendMessage]
-> Read SendMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SendMessage
readsPrec :: Int -> ReadS SendMessage
$creadList :: ReadS [SendMessage]
readList :: ReadS [SendMessage]
$creadPrec :: ReadPrec SendMessage
readPrec :: ReadPrec SendMessage
$creadListPrec :: ReadPrec [SendMessage]
readListPrec :: ReadPrec [SendMessage]
Read, SendMessage -> SendMessage -> Bool
(SendMessage -> SendMessage -> Bool)
-> (SendMessage -> SendMessage -> Bool) -> Eq SendMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendMessage -> SendMessage -> Bool
== :: SendMessage -> SendMessage -> Bool
$c/= :: SendMessage -> SendMessage -> Bool
/= :: SendMessage -> SendMessage -> Bool
Eq, Eq SendMessage
Eq SendMessage =>
(SendMessage -> SendMessage -> Ordering)
-> (SendMessage -> SendMessage -> Bool)
-> (SendMessage -> SendMessage -> Bool)
-> (SendMessage -> SendMessage -> Bool)
-> (SendMessage -> SendMessage -> Bool)
-> (SendMessage -> SendMessage -> SendMessage)
-> (SendMessage -> SendMessage -> SendMessage)
-> Ord SendMessage
SendMessage -> SendMessage -> Bool
SendMessage -> SendMessage -> Ordering
SendMessage -> SendMessage -> SendMessage
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SendMessage -> SendMessage -> Ordering
compare :: SendMessage -> SendMessage -> Ordering
$c< :: SendMessage -> SendMessage -> Bool
< :: SendMessage -> SendMessage -> Bool
$c<= :: SendMessage -> SendMessage -> Bool
<= :: SendMessage -> SendMessage -> Bool
$c> :: SendMessage -> SendMessage -> Bool
> :: SendMessage -> SendMessage -> Bool
$c>= :: SendMessage -> SendMessage -> Bool
>= :: SendMessage -> SendMessage -> Bool
$cmax :: SendMessage -> SendMessage -> SendMessage
max :: SendMessage -> SendMessage -> SendMessage
$cmin :: SendMessage -> SendMessage -> SendMessage
min :: SendMessage -> SendMessage -> SendMessage
Ord)
data SendMessageResponse = SendMessageResponse
{ SendMessageResponse -> Text
smrMD5OfMessageBody :: !T.Text
, SendMessageResponse -> MessageId
smrMessageId :: !MessageId
, SendMessageResponse -> Maybe Text
smrMD5OfMessageAttributes :: !(Maybe T.Text)
}
deriving (Int -> SendMessageResponse -> ShowS
[SendMessageResponse] -> ShowS
SendMessageResponse -> String
(Int -> SendMessageResponse -> ShowS)
-> (SendMessageResponse -> String)
-> ([SendMessageResponse] -> ShowS)
-> Show SendMessageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendMessageResponse -> ShowS
showsPrec :: Int -> SendMessageResponse -> ShowS
$cshow :: SendMessageResponse -> String
show :: SendMessageResponse -> String
$cshowList :: [SendMessageResponse] -> ShowS
showList :: [SendMessageResponse] -> ShowS
Show, ReadPrec [SendMessageResponse]
ReadPrec SendMessageResponse
Int -> ReadS SendMessageResponse
ReadS [SendMessageResponse]
(Int -> ReadS SendMessageResponse)
-> ReadS [SendMessageResponse]
-> ReadPrec SendMessageResponse
-> ReadPrec [SendMessageResponse]
-> Read SendMessageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SendMessageResponse
readsPrec :: Int -> ReadS SendMessageResponse
$creadList :: ReadS [SendMessageResponse]
readList :: ReadS [SendMessageResponse]
$creadPrec :: ReadPrec SendMessageResponse
readPrec :: ReadPrec SendMessageResponse
$creadListPrec :: ReadPrec [SendMessageResponse]
readListPrec :: ReadPrec [SendMessageResponse]
Read, SendMessageResponse -> SendMessageResponse -> Bool
(SendMessageResponse -> SendMessageResponse -> Bool)
-> (SendMessageResponse -> SendMessageResponse -> Bool)
-> Eq SendMessageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendMessageResponse -> SendMessageResponse -> Bool
== :: SendMessageResponse -> SendMessageResponse -> Bool
$c/= :: SendMessageResponse -> SendMessageResponse -> Bool
/= :: SendMessageResponse -> SendMessageResponse -> Bool
Eq, Eq SendMessageResponse
Eq SendMessageResponse =>
(SendMessageResponse -> SendMessageResponse -> Ordering)
-> (SendMessageResponse -> SendMessageResponse -> Bool)
-> (SendMessageResponse -> SendMessageResponse -> Bool)
-> (SendMessageResponse -> SendMessageResponse -> Bool)
-> (SendMessageResponse -> SendMessageResponse -> Bool)
-> (SendMessageResponse
-> SendMessageResponse -> SendMessageResponse)
-> (SendMessageResponse
-> SendMessageResponse -> SendMessageResponse)
-> Ord SendMessageResponse
SendMessageResponse -> SendMessageResponse -> Bool
SendMessageResponse -> SendMessageResponse -> Ordering
SendMessageResponse -> SendMessageResponse -> SendMessageResponse
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SendMessageResponse -> SendMessageResponse -> Ordering
compare :: SendMessageResponse -> SendMessageResponse -> Ordering
$c< :: SendMessageResponse -> SendMessageResponse -> Bool
< :: SendMessageResponse -> SendMessageResponse -> Bool
$c<= :: SendMessageResponse -> SendMessageResponse -> Bool
<= :: SendMessageResponse -> SendMessageResponse -> Bool
$c> :: SendMessageResponse -> SendMessageResponse -> Bool
> :: SendMessageResponse -> SendMessageResponse -> Bool
$c>= :: SendMessageResponse -> SendMessageResponse -> Bool
>= :: SendMessageResponse -> SendMessageResponse -> Bool
$cmax :: SendMessageResponse -> SendMessageResponse -> SendMessageResponse
max :: SendMessageResponse -> SendMessageResponse -> SendMessageResponse
$cmin :: SendMessageResponse -> SendMessageResponse -> SendMessageResponse
min :: SendMessageResponse -> SendMessageResponse -> SendMessageResponse
Ord)
instance ResponseConsumer r SendMessageResponse where
type ResponseMetadata SendMessageResponse = SqsMetadata
responseConsumer :: Request
-> r
-> IORef (ResponseMetadata SendMessageResponse)
-> HTTPResponseConsumer SendMessageResponse
responseConsumer Request
_ r
_ = (Cursor -> Response SqsMetadata SendMessageResponse)
-> IORef SqsMetadata -> HTTPResponseConsumer SendMessageResponse
forall a.
(Cursor -> Response SqsMetadata a)
-> IORef SqsMetadata -> HTTPResponseConsumer a
sqsXmlResponseConsumer Cursor -> Response SqsMetadata SendMessageResponse
forall {f :: * -> *}.
MonadThrow f =>
Cursor -> f SendMessageResponse
parse
where
parse :: Cursor -> f SendMessageResponse
parse Cursor
el = Text -> MessageId -> Maybe Text -> SendMessageResponse
SendMessageResponse
(Text -> MessageId -> Maybe Text -> SendMessageResponse)
-> f Text -> f (MessageId -> Maybe Text -> SendMessageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [Text] -> f Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing MD5 Signature"
(Cursor
el Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"MD5OfMessageBody" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content)
f (MessageId -> Maybe Text -> SendMessageResponse)
-> f MessageId -> f (Maybe Text -> SendMessageResponse)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ((Text -> MessageId) -> f Text -> f MessageId
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> MessageId
MessageId (f Text -> f MessageId)
-> ([Text] -> f Text) -> [Text] -> f MessageId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [Text] -> f Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Message Id")
(Cursor
el Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"MessageId" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content)
f (Maybe Text -> SendMessageResponse)
-> f (Maybe Text) -> f SendMessageResponse
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Maybe Text -> f (Maybe Text)
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Text -> f (Maybe Text))
-> ([Text] -> Maybe Text) -> [Text] -> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Text] -> Maybe Text
forall a. [a] -> Maybe a
listToMaybe)
(Cursor
el Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"MD5OfMessageAttributes" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content)
instance SignQuery SendMessage where
type ServiceConfiguration SendMessage = SqsConfiguration
signQuery :: forall queryType.
SendMessage
-> ServiceConfiguration SendMessage queryType
-> SignatureData
-> SignedQuery
signQuery SendMessage{[UserMessageAttribute]
Maybe Int
Text
QueueName
smMessage :: SendMessage -> Text
smQueueName :: SendMessage -> QueueName
smAttributes :: SendMessage -> [UserMessageAttribute]
smDelaySeconds :: SendMessage -> Maybe Int
smMessage :: Text
smQueueName :: QueueName
smAttributes :: [UserMessageAttribute]
smDelaySeconds :: Maybe Int
..} = SqsQuery
-> SqsConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
SqsQuery -> SqsConfiguration qt -> SignatureData -> SignedQuery
sqsSignQuery SqsQuery
{ sqsQueueName :: Maybe QueueName
sqsQueueName = QueueName -> Maybe QueueName
forall a. a -> Maybe a
Just QueueName
smQueueName
, sqsQuery :: Query
sqsQuery =
[ (ByteString
"Action", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
"SendMessage")
, (ByteString
"MessageBody", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
TE.encodeUtf8 Text
smMessage)
]
Query -> Query -> Query
forall a. Semigroup a => a -> a -> a
<> [UserMessageAttribute] -> Query
userMessageAttributesQuery [UserMessageAttribute]
smAttributes
Query -> Query -> Query
forall a. Semigroup a => a -> a -> a
<> Maybe QueryItem -> Query
forall a. Maybe a -> [a]
maybeToList ((ByteString
"DelaySeconds",) (Maybe ByteString -> QueryItem)
-> (Int -> Maybe ByteString) -> Int -> QueryItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString)
-> (Int -> ByteString) -> Int -> Maybe ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
B.pack (String -> ByteString) -> (Int -> String) -> Int -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall a. Show a => a -> String
show (Int -> QueryItem) -> Maybe Int -> Maybe QueryItem
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Int
smDelaySeconds)
}
instance Transaction SendMessage SendMessageResponse
instance AsMemoryResponse SendMessageResponse where
type MemoryResponse SendMessageResponse = SendMessageResponse
loadToMemory :: SendMessageResponse
-> ResourceT IO (MemoryResponse SendMessageResponse)
loadToMemory = SendMessageResponse
-> ResourceT IO (MemoryResponse SendMessageResponse)
SendMessageResponse -> ResourceT IO SendMessageResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
data DeleteMessage = DeleteMessage
{ DeleteMessage -> ReceiptHandle
dmReceiptHandle :: !ReceiptHandle
, DeleteMessage -> QueueName
dmQueueName :: !QueueName
}
deriving (Int -> DeleteMessage -> ShowS
[DeleteMessage] -> ShowS
DeleteMessage -> String
(Int -> DeleteMessage -> ShowS)
-> (DeleteMessage -> String)
-> ([DeleteMessage] -> ShowS)
-> Show DeleteMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteMessage -> ShowS
showsPrec :: Int -> DeleteMessage -> ShowS
$cshow :: DeleteMessage -> String
show :: DeleteMessage -> String
$cshowList :: [DeleteMessage] -> ShowS
showList :: [DeleteMessage] -> ShowS
Show, ReadPrec [DeleteMessage]
ReadPrec DeleteMessage
Int -> ReadS DeleteMessage
ReadS [DeleteMessage]
(Int -> ReadS DeleteMessage)
-> ReadS [DeleteMessage]
-> ReadPrec DeleteMessage
-> ReadPrec [DeleteMessage]
-> Read DeleteMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS DeleteMessage
readsPrec :: Int -> ReadS DeleteMessage
$creadList :: ReadS [DeleteMessage]
readList :: ReadS [DeleteMessage]
$creadPrec :: ReadPrec DeleteMessage
readPrec :: ReadPrec DeleteMessage
$creadListPrec :: ReadPrec [DeleteMessage]
readListPrec :: ReadPrec [DeleteMessage]
Read, DeleteMessage -> DeleteMessage -> Bool
(DeleteMessage -> DeleteMessage -> Bool)
-> (DeleteMessage -> DeleteMessage -> Bool) -> Eq DeleteMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteMessage -> DeleteMessage -> Bool
== :: DeleteMessage -> DeleteMessage -> Bool
$c/= :: DeleteMessage -> DeleteMessage -> Bool
/= :: DeleteMessage -> DeleteMessage -> Bool
Eq, Eq DeleteMessage
Eq DeleteMessage =>
(DeleteMessage -> DeleteMessage -> Ordering)
-> (DeleteMessage -> DeleteMessage -> Bool)
-> (DeleteMessage -> DeleteMessage -> Bool)
-> (DeleteMessage -> DeleteMessage -> Bool)
-> (DeleteMessage -> DeleteMessage -> Bool)
-> (DeleteMessage -> DeleteMessage -> DeleteMessage)
-> (DeleteMessage -> DeleteMessage -> DeleteMessage)
-> Ord DeleteMessage
DeleteMessage -> DeleteMessage -> Bool
DeleteMessage -> DeleteMessage -> Ordering
DeleteMessage -> DeleteMessage -> DeleteMessage
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DeleteMessage -> DeleteMessage -> Ordering
compare :: DeleteMessage -> DeleteMessage -> Ordering
$c< :: DeleteMessage -> DeleteMessage -> Bool
< :: DeleteMessage -> DeleteMessage -> Bool
$c<= :: DeleteMessage -> DeleteMessage -> Bool
<= :: DeleteMessage -> DeleteMessage -> Bool
$c> :: DeleteMessage -> DeleteMessage -> Bool
> :: DeleteMessage -> DeleteMessage -> Bool
$c>= :: DeleteMessage -> DeleteMessage -> Bool
>= :: DeleteMessage -> DeleteMessage -> Bool
$cmax :: DeleteMessage -> DeleteMessage -> DeleteMessage
max :: DeleteMessage -> DeleteMessage -> DeleteMessage
$cmin :: DeleteMessage -> DeleteMessage -> DeleteMessage
min :: DeleteMessage -> DeleteMessage -> DeleteMessage
Ord)
data DeleteMessageResponse = DeleteMessageResponse {}
deriving (Int -> DeleteMessageResponse -> ShowS
[DeleteMessageResponse] -> ShowS
DeleteMessageResponse -> String
(Int -> DeleteMessageResponse -> ShowS)
-> (DeleteMessageResponse -> String)
-> ([DeleteMessageResponse] -> ShowS)
-> Show DeleteMessageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteMessageResponse -> ShowS
showsPrec :: Int -> DeleteMessageResponse -> ShowS
$cshow :: DeleteMessageResponse -> String
show :: DeleteMessageResponse -> String
$cshowList :: [DeleteMessageResponse] -> ShowS
showList :: [DeleteMessageResponse] -> ShowS
Show, ReadPrec [DeleteMessageResponse]
ReadPrec DeleteMessageResponse
Int -> ReadS DeleteMessageResponse
ReadS [DeleteMessageResponse]
(Int -> ReadS DeleteMessageResponse)
-> ReadS [DeleteMessageResponse]
-> ReadPrec DeleteMessageResponse
-> ReadPrec [DeleteMessageResponse]
-> Read DeleteMessageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS DeleteMessageResponse
readsPrec :: Int -> ReadS DeleteMessageResponse
$creadList :: ReadS [DeleteMessageResponse]
readList :: ReadS [DeleteMessageResponse]
$creadPrec :: ReadPrec DeleteMessageResponse
readPrec :: ReadPrec DeleteMessageResponse
$creadListPrec :: ReadPrec [DeleteMessageResponse]
readListPrec :: ReadPrec [DeleteMessageResponse]
Read, DeleteMessageResponse -> DeleteMessageResponse -> Bool
(DeleteMessageResponse -> DeleteMessageResponse -> Bool)
-> (DeleteMessageResponse -> DeleteMessageResponse -> Bool)
-> Eq DeleteMessageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
== :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
$c/= :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
/= :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
Eq, Eq DeleteMessageResponse
Eq DeleteMessageResponse =>
(DeleteMessageResponse -> DeleteMessageResponse -> Ordering)
-> (DeleteMessageResponse -> DeleteMessageResponse -> Bool)
-> (DeleteMessageResponse -> DeleteMessageResponse -> Bool)
-> (DeleteMessageResponse -> DeleteMessageResponse -> Bool)
-> (DeleteMessageResponse -> DeleteMessageResponse -> Bool)
-> (DeleteMessageResponse
-> DeleteMessageResponse -> DeleteMessageResponse)
-> (DeleteMessageResponse
-> DeleteMessageResponse -> DeleteMessageResponse)
-> Ord DeleteMessageResponse
DeleteMessageResponse -> DeleteMessageResponse -> Bool
DeleteMessageResponse -> DeleteMessageResponse -> Ordering
DeleteMessageResponse
-> DeleteMessageResponse -> DeleteMessageResponse
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DeleteMessageResponse -> DeleteMessageResponse -> Ordering
compare :: DeleteMessageResponse -> DeleteMessageResponse -> Ordering
$c< :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
< :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
$c<= :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
<= :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
$c> :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
> :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
$c>= :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
>= :: DeleteMessageResponse -> DeleteMessageResponse -> Bool
$cmax :: DeleteMessageResponse
-> DeleteMessageResponse -> DeleteMessageResponse
max :: DeleteMessageResponse
-> DeleteMessageResponse -> DeleteMessageResponse
$cmin :: DeleteMessageResponse
-> DeleteMessageResponse -> DeleteMessageResponse
min :: DeleteMessageResponse
-> DeleteMessageResponse -> DeleteMessageResponse
Ord)
instance ResponseConsumer r DeleteMessageResponse where
type ResponseMetadata DeleteMessageResponse = SqsMetadata
responseConsumer :: Request
-> r
-> IORef (ResponseMetadata DeleteMessageResponse)
-> HTTPResponseConsumer DeleteMessageResponse
responseConsumer Request
_ r
_ = (Cursor -> Response SqsMetadata DeleteMessageResponse)
-> IORef SqsMetadata -> HTTPResponseConsumer DeleteMessageResponse
forall a.
(Cursor -> Response SqsMetadata a)
-> IORef SqsMetadata -> HTTPResponseConsumer a
sqsXmlResponseConsumer Cursor -> Response SqsMetadata DeleteMessageResponse
forall {m :: * -> *} {p}. Monad m => p -> m DeleteMessageResponse
parse
where
parse :: p -> m DeleteMessageResponse
parse p
_ = DeleteMessageResponse -> m DeleteMessageResponse
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return DeleteMessageResponse {}
instance SignQuery DeleteMessage where
type ServiceConfiguration DeleteMessage = SqsConfiguration
signQuery :: forall queryType.
DeleteMessage
-> ServiceConfiguration DeleteMessage queryType
-> SignatureData
-> SignedQuery
signQuery DeleteMessage{ReceiptHandle
QueueName
dmReceiptHandle :: DeleteMessage -> ReceiptHandle
dmQueueName :: DeleteMessage -> QueueName
dmReceiptHandle :: ReceiptHandle
dmQueueName :: QueueName
..} = SqsQuery
-> SqsConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
SqsQuery -> SqsConfiguration qt -> SignatureData -> SignedQuery
sqsSignQuery SqsQuery
{ sqsQueueName :: Maybe QueueName
sqsQueueName = QueueName -> Maybe QueueName
forall a. a -> Maybe a
Just QueueName
dmQueueName
, sqsQuery :: Query
sqsQuery =
[ (ByteString
"Action", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
"DeleteMessage")
, (ByteString
"ReceiptHandle", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
TE.encodeUtf8 (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
$ ReceiptHandle -> Text
printReceiptHandle ReceiptHandle
dmReceiptHandle)
]
}
instance Transaction DeleteMessage DeleteMessageResponse
instance AsMemoryResponse DeleteMessageResponse where
type MemoryResponse DeleteMessageResponse = DeleteMessageResponse
loadToMemory :: DeleteMessageResponse
-> ResourceT IO (MemoryResponse DeleteMessageResponse)
loadToMemory = DeleteMessageResponse
-> ResourceT IO (MemoryResponse DeleteMessageResponse)
DeleteMessageResponse -> ResourceT IO DeleteMessageResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
data ReceiveMessage = ReceiveMessage
{ ReceiveMessage -> Maybe Int
rmVisibilityTimeout :: !(Maybe Int)
, ReceiveMessage -> [MessageAttribute]
rmAttributes :: ![MessageAttribute]
, ReceiveMessage -> Maybe Int
rmMaxNumberOfMessages :: !(Maybe Int)
, ReceiveMessage -> [Text]
rmUserMessageAttributes :: ![UserMessageAttributeName]
, ReceiveMessage -> QueueName
rmQueueName :: !QueueName
, ReceiveMessage -> Maybe Int
rmWaitTimeSeconds :: !(Maybe Int)
}
deriving (Int -> ReceiveMessage -> ShowS
[ReceiveMessage] -> ShowS
ReceiveMessage -> String
(Int -> ReceiveMessage -> ShowS)
-> (ReceiveMessage -> String)
-> ([ReceiveMessage] -> ShowS)
-> Show ReceiveMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReceiveMessage -> ShowS
showsPrec :: Int -> ReceiveMessage -> ShowS
$cshow :: ReceiveMessage -> String
show :: ReceiveMessage -> String
$cshowList :: [ReceiveMessage] -> ShowS
showList :: [ReceiveMessage] -> ShowS
Show, ReadPrec [ReceiveMessage]
ReadPrec ReceiveMessage
Int -> ReadS ReceiveMessage
ReadS [ReceiveMessage]
(Int -> ReadS ReceiveMessage)
-> ReadS [ReceiveMessage]
-> ReadPrec ReceiveMessage
-> ReadPrec [ReceiveMessage]
-> Read ReceiveMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ReceiveMessage
readsPrec :: Int -> ReadS ReceiveMessage
$creadList :: ReadS [ReceiveMessage]
readList :: ReadS [ReceiveMessage]
$creadPrec :: ReadPrec ReceiveMessage
readPrec :: ReadPrec ReceiveMessage
$creadListPrec :: ReadPrec [ReceiveMessage]
readListPrec :: ReadPrec [ReceiveMessage]
Read, ReceiveMessage -> ReceiveMessage -> Bool
(ReceiveMessage -> ReceiveMessage -> Bool)
-> (ReceiveMessage -> ReceiveMessage -> Bool) -> Eq ReceiveMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReceiveMessage -> ReceiveMessage -> Bool
== :: ReceiveMessage -> ReceiveMessage -> Bool
$c/= :: ReceiveMessage -> ReceiveMessage -> Bool
/= :: ReceiveMessage -> ReceiveMessage -> Bool
Eq, Eq ReceiveMessage
Eq ReceiveMessage =>
(ReceiveMessage -> ReceiveMessage -> Ordering)
-> (ReceiveMessage -> ReceiveMessage -> Bool)
-> (ReceiveMessage -> ReceiveMessage -> Bool)
-> (ReceiveMessage -> ReceiveMessage -> Bool)
-> (ReceiveMessage -> ReceiveMessage -> Bool)
-> (ReceiveMessage -> ReceiveMessage -> ReceiveMessage)
-> (ReceiveMessage -> ReceiveMessage -> ReceiveMessage)
-> Ord ReceiveMessage
ReceiveMessage -> ReceiveMessage -> Bool
ReceiveMessage -> ReceiveMessage -> Ordering
ReceiveMessage -> ReceiveMessage -> ReceiveMessage
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ReceiveMessage -> ReceiveMessage -> Ordering
compare :: ReceiveMessage -> ReceiveMessage -> Ordering
$c< :: ReceiveMessage -> ReceiveMessage -> Bool
< :: ReceiveMessage -> ReceiveMessage -> Bool
$c<= :: ReceiveMessage -> ReceiveMessage -> Bool
<= :: ReceiveMessage -> ReceiveMessage -> Bool
$c> :: ReceiveMessage -> ReceiveMessage -> Bool
> :: ReceiveMessage -> ReceiveMessage -> Bool
$c>= :: ReceiveMessage -> ReceiveMessage -> Bool
>= :: ReceiveMessage -> ReceiveMessage -> Bool
$cmax :: ReceiveMessage -> ReceiveMessage -> ReceiveMessage
max :: ReceiveMessage -> ReceiveMessage -> ReceiveMessage
$cmin :: ReceiveMessage -> ReceiveMessage -> ReceiveMessage
min :: ReceiveMessage -> ReceiveMessage -> ReceiveMessage
Ord)
data Message = Message
{ Message -> Text
mMessageId :: !T.Text
, Message -> ReceiptHandle
mReceiptHandle :: !ReceiptHandle
, Message -> Text
mMD5OfBody :: !T.Text
, Message -> Text
mBody :: T.Text
, Message -> [(MessageAttribute, Text)]
mAttributes :: ![(MessageAttribute,T.Text)]
, Message -> Maybe Text
mMD5OfMessageAttributes :: !(Maybe T.Text)
, Message -> [UserMessageAttribute]
mUserMessageAttributes :: ![UserMessageAttribute]
}
deriving(Int -> Message -> ShowS
[Message] -> ShowS
Message -> String
(Int -> Message -> ShowS)
-> (Message -> String) -> ([Message] -> ShowS) -> Show Message
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Message -> ShowS
showsPrec :: Int -> Message -> ShowS
$cshow :: Message -> String
show :: Message -> String
$cshowList :: [Message] -> ShowS
showList :: [Message] -> ShowS
Show, ReadPrec [Message]
ReadPrec Message
Int -> ReadS Message
ReadS [Message]
(Int -> ReadS Message)
-> ReadS [Message]
-> ReadPrec Message
-> ReadPrec [Message]
-> Read Message
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Message
readsPrec :: Int -> ReadS Message
$creadList :: ReadS [Message]
readList :: ReadS [Message]
$creadPrec :: ReadPrec Message
readPrec :: ReadPrec Message
$creadListPrec :: ReadPrec [Message]
readListPrec :: ReadPrec [Message]
Read, Message -> Message -> Bool
(Message -> Message -> Bool)
-> (Message -> Message -> Bool) -> Eq Message
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Message -> Message -> Bool
== :: Message -> Message -> Bool
$c/= :: Message -> Message -> Bool
/= :: Message -> Message -> Bool
Eq, Eq Message
Eq Message =>
(Message -> Message -> Ordering)
-> (Message -> Message -> Bool)
-> (Message -> Message -> Bool)
-> (Message -> Message -> Bool)
-> (Message -> Message -> Bool)
-> (Message -> Message -> Message)
-> (Message -> Message -> Message)
-> Ord Message
Message -> Message -> Bool
Message -> Message -> Ordering
Message -> Message -> Message
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Message -> Message -> Ordering
compare :: Message -> Message -> Ordering
$c< :: Message -> Message -> Bool
< :: Message -> Message -> Bool
$c<= :: Message -> Message -> Bool
<= :: Message -> Message -> Bool
$c> :: Message -> Message -> Bool
> :: Message -> Message -> Bool
$c>= :: Message -> Message -> Bool
>= :: Message -> Message -> Bool
$cmax :: Message -> Message -> Message
max :: Message -> Message -> Message
$cmin :: Message -> Message -> Message
min :: Message -> Message -> Message
Ord)
data ReceiveMessageResponse = ReceiveMessageResponse
{ ReceiveMessageResponse -> [Message]
rmrMessages :: ![Message]
}
deriving (Int -> ReceiveMessageResponse -> ShowS
[ReceiveMessageResponse] -> ShowS
ReceiveMessageResponse -> String
(Int -> ReceiveMessageResponse -> ShowS)
-> (ReceiveMessageResponse -> String)
-> ([ReceiveMessageResponse] -> ShowS)
-> Show ReceiveMessageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReceiveMessageResponse -> ShowS
showsPrec :: Int -> ReceiveMessageResponse -> ShowS
$cshow :: ReceiveMessageResponse -> String
show :: ReceiveMessageResponse -> String
$cshowList :: [ReceiveMessageResponse] -> ShowS
showList :: [ReceiveMessageResponse] -> ShowS
Show, ReadPrec [ReceiveMessageResponse]
ReadPrec ReceiveMessageResponse
Int -> ReadS ReceiveMessageResponse
ReadS [ReceiveMessageResponse]
(Int -> ReadS ReceiveMessageResponse)
-> ReadS [ReceiveMessageResponse]
-> ReadPrec ReceiveMessageResponse
-> ReadPrec [ReceiveMessageResponse]
-> Read ReceiveMessageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ReceiveMessageResponse
readsPrec :: Int -> ReadS ReceiveMessageResponse
$creadList :: ReadS [ReceiveMessageResponse]
readList :: ReadS [ReceiveMessageResponse]
$creadPrec :: ReadPrec ReceiveMessageResponse
readPrec :: ReadPrec ReceiveMessageResponse
$creadListPrec :: ReadPrec [ReceiveMessageResponse]
readListPrec :: ReadPrec [ReceiveMessageResponse]
Read, ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
(ReceiveMessageResponse -> ReceiveMessageResponse -> Bool)
-> (ReceiveMessageResponse -> ReceiveMessageResponse -> Bool)
-> Eq ReceiveMessageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
== :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
$c/= :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
/= :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
Eq, Eq ReceiveMessageResponse
Eq ReceiveMessageResponse =>
(ReceiveMessageResponse -> ReceiveMessageResponse -> Ordering)
-> (ReceiveMessageResponse -> ReceiveMessageResponse -> Bool)
-> (ReceiveMessageResponse -> ReceiveMessageResponse -> Bool)
-> (ReceiveMessageResponse -> ReceiveMessageResponse -> Bool)
-> (ReceiveMessageResponse -> ReceiveMessageResponse -> Bool)
-> (ReceiveMessageResponse
-> ReceiveMessageResponse -> ReceiveMessageResponse)
-> (ReceiveMessageResponse
-> ReceiveMessageResponse -> ReceiveMessageResponse)
-> Ord ReceiveMessageResponse
ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
ReceiveMessageResponse -> ReceiveMessageResponse -> Ordering
ReceiveMessageResponse
-> ReceiveMessageResponse -> ReceiveMessageResponse
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ReceiveMessageResponse -> ReceiveMessageResponse -> Ordering
compare :: ReceiveMessageResponse -> ReceiveMessageResponse -> Ordering
$c< :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
< :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
$c<= :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
<= :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
$c> :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
> :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
$c>= :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
>= :: ReceiveMessageResponse -> ReceiveMessageResponse -> Bool
$cmax :: ReceiveMessageResponse
-> ReceiveMessageResponse -> ReceiveMessageResponse
max :: ReceiveMessageResponse
-> ReceiveMessageResponse -> ReceiveMessageResponse
$cmin :: ReceiveMessageResponse
-> ReceiveMessageResponse -> ReceiveMessageResponse
min :: ReceiveMessageResponse
-> ReceiveMessageResponse -> ReceiveMessageResponse
Ord)
readMessageAttribute
:: Cu.Cursor
-> Response SqsMetadata (MessageAttribute,T.Text)
readMessageAttribute :: Cursor -> Response SqsMetadata (MessageAttribute, Text)
readMessageAttribute Cursor
cursor = do
Text
name <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Name" ([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Text -> Axis
Cu.laxElement Text
"Name" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
Text
value <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Value" ([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Text -> Axis
Cu.laxElement Text
"Value" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
MessageAttribute
parsedName <- Text -> Response SqsMetadata MessageAttribute
forall (m :: * -> *). MonadThrow m => Text -> m MessageAttribute
parseMessageAttribute Text
name
(MessageAttribute, Text)
-> Response SqsMetadata (MessageAttribute, Text)
forall a. a -> Response SqsMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return (MessageAttribute
parsedName, Text
value)
readUserMessageAttribute
:: Cu.Cursor
-> Response SqsMetadata UserMessageAttribute
readUserMessageAttribute :: Cursor -> Response SqsMetadata UserMessageAttribute
readUserMessageAttribute Cursor
cursor = (,)
(Text -> UserMessageAttributeValue -> UserMessageAttribute)
-> Response SqsMetadata Text
-> Response
SqsMetadata (UserMessageAttributeValue -> UserMessageAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Name" (Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Text -> Axis
Cu.laxElement Text
"Name" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content)
Response
SqsMetadata (UserMessageAttributeValue -> UserMessageAttribute)
-> Response SqsMetadata UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttribute
forall a b.
Response SqsMetadata (a -> b)
-> Response SqsMetadata a -> Response SqsMetadata b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Cursor -> Response SqsMetadata UserMessageAttributeValue
readUserMessageAttributeValue Cursor
cursor
readUserMessageAttributeValue
:: Cu.Cursor
-> Response SqsMetadata UserMessageAttributeValue
readUserMessageAttributeValue :: Cursor -> Response SqsMetadata UserMessageAttributeValue
readUserMessageAttributeValue Cursor
cursor = do
Text
typStr <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing DataType"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"DataType" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
case Text -> (Text, Maybe Text)
parseType Text
typStr of
(Text
"String", Maybe Text
c) -> do
Text
val <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing StringValue"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"StringValue" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue
forall a. a -> Response SqsMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return (UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue)
-> UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue
forall a b. (a -> b) -> a -> b
$ Maybe Text -> Text -> UserMessageAttributeValue
UserMessageAttributeString Maybe Text
c Text
val
(Text
"Number", Maybe Text
c) -> do
Text
valStr <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing StringValue"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"StringValue" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
Scientific
val <- Either String Scientific -> Response SqsMetadata Scientific
forall {a}. Either String a -> Response SqsMetadata a
tryXml (Either String Scientific -> Response SqsMetadata Scientific)
-> (String -> Either String Scientific)
-> String
-> Response SqsMetadata Scientific
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Either String Scientific
forall a. Read a => String -> Either String a
readEither (String -> Response SqsMetadata Scientific)
-> String -> Response SqsMetadata Scientific
forall a b. (a -> b) -> a -> b
$ Text -> String
T.unpack Text
valStr
UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue
forall a. a -> Response SqsMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return (UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue)
-> UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue
forall a b. (a -> b) -> a -> b
$ Maybe Text -> Scientific -> UserMessageAttributeValue
UserMessageAttributeNumber Maybe Text
c Scientific
val
(Text
"Binary", Maybe Text
c) -> do
Text
val64 <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing BinaryValue"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"BinaryValue" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
ByteString
val <- Either String ByteString -> Response SqsMetadata ByteString
forall {a}. Either String a -> Response SqsMetadata a
tryXml (Either String ByteString -> Response SqsMetadata ByteString)
-> (ByteString -> Either String ByteString)
-> ByteString
-> Response SqsMetadata ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Either String ByteString
B64.decode (ByteString -> Response SqsMetadata ByteString)
-> ByteString -> Response SqsMetadata ByteString
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
TE.encodeUtf8 Text
val64
UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue
forall a. a -> Response SqsMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return (UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue)
-> UserMessageAttributeValue
-> Response SqsMetadata UserMessageAttributeValue
forall a b. (a -> b) -> a -> b
$ Maybe Text -> ByteString -> UserMessageAttributeValue
UserMessageAttributeBinary Maybe Text
c ByteString
val
(Text
x, Maybe Text
_) -> XmlException -> Response SqsMetadata UserMessageAttributeValue
forall e a.
(HasCallStack, Exception e) =>
e -> Response SqsMetadata a
forall (m :: * -> *) e a.
(MonadThrow m, HasCallStack, Exception e) =>
e -> m a
throwM (XmlException -> Response SqsMetadata UserMessageAttributeValue)
-> (String -> XmlException)
-> String
-> Response SqsMetadata UserMessageAttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> XmlException
XmlException
(String -> Response SqsMetadata UserMessageAttributeValue)
-> String -> Response SqsMetadata UserMessageAttributeValue
forall a b. (a -> b) -> a -> b
$ String
"unkown data type for MessageAttributeValue: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Text -> String
T.unpack Text
x
where
parseType :: Text -> (Text, Maybe Text)
parseType Text
s = case (Char -> Bool) -> Text -> (Text, Text)
T.break (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'.') Text
s of
(Text
a, Text
"") -> (Text
a, Maybe Text
forall a. Maybe a
Nothing)
(Text
a, Text
x) -> (Text
a, Text -> Maybe Text
forall a. a -> Maybe a
Just (HasCallStack => Text -> Text
Text -> Text
T.tail Text
x))
tryXml :: Either String a -> Response SqsMetadata a
tryXml = (String -> Response SqsMetadata a)
-> (a -> Response SqsMetadata a)
-> Either String a
-> Response SqsMetadata a
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (XmlException -> Response SqsMetadata a
forall e a.
(HasCallStack, Exception e) =>
e -> Response SqsMetadata a
forall (m :: * -> *) e a.
(MonadThrow m, HasCallStack, Exception e) =>
e -> m a
throwM (XmlException -> Response SqsMetadata a)
-> (String -> XmlException) -> String -> Response SqsMetadata a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> XmlException
XmlException) a -> Response SqsMetadata a
forall a. a -> Response SqsMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return
readMessage :: Cu.Cursor -> Response SqsMetadata Message
readMessage :: Cursor -> Response SqsMetadata Message
readMessage Cursor
cursor = do
Text
mid <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Message Id"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"MessageId" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
Text
rh <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Reciept Handle"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"ReceiptHandle" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
Text
md5 <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing MD5 Signature"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"MD5OfBody" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
Text
body <- String -> [Text] -> Response SqsMetadata Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Body"
([Text] -> Response SqsMetadata Text)
-> [Text] -> Response SqsMetadata Text
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"Body" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
[(MessageAttribute, Text)]
attributes <- [Response SqsMetadata (MessageAttribute, Text)]
-> Response SqsMetadata [(MessageAttribute, Text)]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
forall (m :: * -> *) a. Monad m => [m a] -> m [a]
sequence
([Response SqsMetadata (MessageAttribute, Text)]
-> Response SqsMetadata [(MessageAttribute, Text)])
-> [Response SqsMetadata (MessageAttribute, Text)]
-> Response SqsMetadata [(MessageAttribute, Text)]
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor
-> (Cursor -> [Response SqsMetadata (MessageAttribute, Text)])
-> [Response SqsMetadata (MessageAttribute, Text)]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"Attribute" Axis
-> (Cursor -> Response SqsMetadata (MessageAttribute, Text))
-> Cursor
-> [Response SqsMetadata (MessageAttribute, Text)]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Cursor -> Response SqsMetadata (MessageAttribute, Text)
readMessageAttribute
[UserMessageAttribute]
userAttributes <- [Response SqsMetadata UserMessageAttribute]
-> Response SqsMetadata [UserMessageAttribute]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
forall (m :: * -> *) a. Monad m => [m a] -> m [a]
sequence
([Response SqsMetadata UserMessageAttribute]
-> Response SqsMetadata [UserMessageAttribute])
-> [Response SqsMetadata UserMessageAttribute]
-> Response SqsMetadata [UserMessageAttribute]
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor
-> (Cursor -> [Response SqsMetadata UserMessageAttribute])
-> [Response SqsMetadata UserMessageAttribute]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"MessageAttribute" Axis
-> (Cursor -> Response SqsMetadata UserMessageAttribute)
-> Cursor
-> [Response SqsMetadata UserMessageAttribute]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Cursor -> Response SqsMetadata UserMessageAttribute
readUserMessageAttribute
let md5OfMessageAttributes :: Maybe Text
md5OfMessageAttributes = [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 -> Axis
Cu.laxElement Text
"MD5OfMessageAttributes" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Cursor -> [Text]
Cu.content
Message -> Response SqsMetadata Message
forall a. a -> Response SqsMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return Message
{ mMessageId :: Text
mMessageId = Text
mid
, mReceiptHandle :: ReceiptHandle
mReceiptHandle = Text -> ReceiptHandle
ReceiptHandle Text
rh
, mMD5OfBody :: Text
mMD5OfBody = Text
md5
, mBody :: Text
mBody = Text
body
, mAttributes :: [(MessageAttribute, Text)]
mAttributes = [(MessageAttribute, Text)]
attributes
, mMD5OfMessageAttributes :: Maybe Text
mMD5OfMessageAttributes = Maybe Text
md5OfMessageAttributes
, mUserMessageAttributes :: [UserMessageAttribute]
mUserMessageAttributes = [UserMessageAttribute]
userAttributes
}
formatMAttributes :: [MessageAttribute] -> HTTP.Query
formatMAttributes :: [MessageAttribute] -> Query
formatMAttributes [MessageAttribute]
attrs = case [MessageAttribute]
attrs of
[MessageAttribute
attr] -> [(ByteString
"AttributeName", MessageAttribute -> Maybe ByteString
encodeAttr MessageAttribute
attr)]
[MessageAttribute]
_ -> (Int -> MessageAttribute -> QueryItem)
-> [Int] -> [MessageAttribute] -> Query
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith Int -> MessageAttribute -> QueryItem
forall {a}. Show a => a -> MessageAttribute -> QueryItem
f [Int
1 :: Int ..] [MessageAttribute]
attrs
where
f :: a -> MessageAttribute -> QueryItem
f a
x MessageAttribute
y = (ByteString
"AttributeName." ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> String -> ByteString
B.pack (a -> String
forall a. Show a => a -> String
show a
x), MessageAttribute -> Maybe ByteString
encodeAttr MessageAttribute
y)
encodeAttr :: MessageAttribute -> Maybe ByteString
encodeAttr = ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString)
-> (MessageAttribute -> ByteString)
-> MessageAttribute
-> Maybe ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
TE.encodeUtf8 (Text -> ByteString)
-> (MessageAttribute -> Text) -> MessageAttribute -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MessageAttribute -> Text
printMessageAttribute
formatUserMessageAttributes :: [UserMessageAttributeName] -> HTTP.Query
formatUserMessageAttributes :: [Text] -> Query
formatUserMessageAttributes [Text]
attrs = case [Text]
attrs of
[Text
attr] -> [(ByteString
"MessageAttributeName", Text -> Maybe ByteString
encodeAttr Text
attr)]
[Text]
_ -> (Int -> Text -> QueryItem) -> [Int] -> [Text] -> Query
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith Int -> Text -> QueryItem
forall {a}. Show a => a -> Text -> QueryItem
f [Int
1 :: Int ..] [Text]
attrs
where
f :: a -> Text -> QueryItem
f a
x Text
y = (ByteString
"MessageAttributeName." ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> String -> ByteString
B.pack (a -> String
forall a. Show a => a -> String
show a
x), Text -> Maybe ByteString
encodeAttr Text
y)
encodeAttr :: Text -> Maybe ByteString
encodeAttr = ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString)
-> (Text -> ByteString) -> Text -> Maybe ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
TE.encodeUtf8
instance ResponseConsumer r ReceiveMessageResponse where
type ResponseMetadata ReceiveMessageResponse = SqsMetadata
responseConsumer :: Request
-> r
-> IORef (ResponseMetadata ReceiveMessageResponse)
-> HTTPResponseConsumer ReceiveMessageResponse
responseConsumer Request
_ r
_ = (Cursor -> Response SqsMetadata ReceiveMessageResponse)
-> IORef SqsMetadata -> HTTPResponseConsumer ReceiveMessageResponse
forall a.
(Cursor -> Response SqsMetadata a)
-> IORef SqsMetadata -> HTTPResponseConsumer a
sqsXmlResponseConsumer Cursor -> Response SqsMetadata ReceiveMessageResponse
parse
where
parse :: Cursor -> Response SqsMetadata ReceiveMessageResponse
parse Cursor
el = do
Cursor
result <- String -> [Cursor] -> Response SqsMetadata Cursor
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing ReceiveMessageResult"
([Cursor] -> Response SqsMetadata Cursor)
-> [Cursor] -> Response SqsMetadata Cursor
forall a b. (a -> b) -> a -> b
$ Cursor
el Cursor -> Axis -> [Cursor]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"ReceiveMessageResult"
[Message]
messages <- [Response SqsMetadata Message] -> Response SqsMetadata [Message]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
forall (m :: * -> *) a. Monad m => [m a] -> m [a]
sequence
([Response SqsMetadata Message] -> Response SqsMetadata [Message])
-> [Response SqsMetadata Message] -> Response SqsMetadata [Message]
forall a b. (a -> b) -> a -> b
$ Cursor
result Cursor
-> (Cursor -> [Response SqsMetadata Message])
-> [Response SqsMetadata Message]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
Cu.laxElement Text
"Message" Axis
-> (Cursor -> Response SqsMetadata Message)
-> Cursor
-> [Response SqsMetadata Message]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Cursor -> Response SqsMetadata Message
readMessage
ReceiveMessageResponse
-> Response SqsMetadata ReceiveMessageResponse
forall a. a -> Response SqsMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return ReceiveMessageResponse{ rmrMessages :: [Message]
rmrMessages = [Message]
messages }
instance SignQuery ReceiveMessage where
type ServiceConfiguration ReceiveMessage = SqsConfiguration
signQuery :: forall queryType.
ReceiveMessage
-> ServiceConfiguration ReceiveMessage queryType
-> SignatureData
-> SignedQuery
signQuery ReceiveMessage{[Text]
[MessageAttribute]
Maybe Int
QueueName
rmVisibilityTimeout :: ReceiveMessage -> Maybe Int
rmAttributes :: ReceiveMessage -> [MessageAttribute]
rmMaxNumberOfMessages :: ReceiveMessage -> Maybe Int
rmUserMessageAttributes :: ReceiveMessage -> [Text]
rmQueueName :: ReceiveMessage -> QueueName
rmWaitTimeSeconds :: ReceiveMessage -> Maybe Int
rmVisibilityTimeout :: Maybe Int
rmAttributes :: [MessageAttribute]
rmMaxNumberOfMessages :: Maybe Int
rmUserMessageAttributes :: [Text]
rmQueueName :: QueueName
rmWaitTimeSeconds :: Maybe Int
..} = SqsQuery
-> SqsConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
SqsQuery -> SqsConfiguration qt -> SignatureData -> SignedQuery
sqsSignQuery SqsQuery
{ sqsQueueName :: Maybe QueueName
sqsQueueName = QueueName -> Maybe QueueName
forall a. a -> Maybe a
Just QueueName
rmQueueName
, sqsQuery :: Query
sqsQuery = [ (ByteString
"Action", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
"ReceiveMessage") ]
Query -> Query -> Query
forall a. Semigroup a => a -> a -> a
<> [Maybe QueryItem] -> Query
forall a. [Maybe a] -> [a]
catMaybes
[ (ByteString
"VisibilityTimeout",) (Maybe ByteString -> QueryItem)
-> Maybe (Maybe ByteString) -> Maybe QueryItem
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case Maybe Int
rmVisibilityTimeout of
Just Int
x -> Maybe ByteString -> Maybe (Maybe ByteString)
forall a. a -> Maybe a
Just (Maybe ByteString -> Maybe (Maybe ByteString))
-> Maybe ByteString -> Maybe (Maybe ByteString)
forall a b. (a -> b) -> a -> b
$ ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ String -> ByteString
B.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
x
Maybe Int
Nothing -> Maybe (Maybe ByteString)
forall a. Maybe a
Nothing
, (ByteString
"MaxNumberOfMessages",) (Maybe ByteString -> QueryItem)
-> Maybe (Maybe ByteString) -> Maybe QueryItem
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case Maybe Int
rmMaxNumberOfMessages of
Just Int
x -> Maybe ByteString -> Maybe (Maybe ByteString)
forall a. a -> Maybe a
Just (Maybe ByteString -> Maybe (Maybe ByteString))
-> Maybe ByteString -> Maybe (Maybe ByteString)
forall a b. (a -> b) -> a -> b
$ ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ String -> ByteString
B.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
x
Maybe Int
Nothing -> Maybe (Maybe ByteString)
forall a. Maybe a
Nothing
, (ByteString
"WaitTimeSeconds",) (Maybe ByteString -> QueryItem)
-> Maybe (Maybe ByteString) -> Maybe QueryItem
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case Maybe Int
rmWaitTimeSeconds of
Just Int
x -> Maybe ByteString -> Maybe (Maybe ByteString)
forall a. a -> Maybe a
Just (Maybe ByteString -> Maybe (Maybe ByteString))
-> Maybe ByteString -> Maybe (Maybe ByteString)
forall a b. (a -> b) -> a -> b
$ ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString) -> ByteString -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ String -> ByteString
B.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
x
Maybe Int
Nothing -> Maybe (Maybe ByteString)
forall a. Maybe a
Nothing
]
Query -> Query -> Query
forall a. Semigroup a => a -> a -> a
<> [MessageAttribute] -> Query
formatMAttributes [MessageAttribute]
rmAttributes
Query -> Query -> Query
forall a. Semigroup a => a -> a -> a
<> [Text] -> Query
formatUserMessageAttributes [Text]
rmUserMessageAttributes
}
instance Transaction ReceiveMessage ReceiveMessageResponse
instance AsMemoryResponse ReceiveMessageResponse where
type MemoryResponse ReceiveMessageResponse = ReceiveMessageResponse
loadToMemory :: ReceiveMessageResponse
-> ResourceT IO (MemoryResponse ReceiveMessageResponse)
loadToMemory = ReceiveMessageResponse
-> ResourceT IO (MemoryResponse ReceiveMessageResponse)
ReceiveMessageResponse -> ResourceT IO ReceiveMessageResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
data ChangeMessageVisibility = ChangeMessageVisibility
{ ChangeMessageVisibility -> ReceiptHandle
cmvReceiptHandle :: !ReceiptHandle
, ChangeMessageVisibility -> Int
cmvVisibilityTimeout :: !Int
, ChangeMessageVisibility -> QueueName
cmvQueueName :: !QueueName
}
deriving (Int -> ChangeMessageVisibility -> ShowS
[ChangeMessageVisibility] -> ShowS
ChangeMessageVisibility -> String
(Int -> ChangeMessageVisibility -> ShowS)
-> (ChangeMessageVisibility -> String)
-> ([ChangeMessageVisibility] -> ShowS)
-> Show ChangeMessageVisibility
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChangeMessageVisibility -> ShowS
showsPrec :: Int -> ChangeMessageVisibility -> ShowS
$cshow :: ChangeMessageVisibility -> String
show :: ChangeMessageVisibility -> String
$cshowList :: [ChangeMessageVisibility] -> ShowS
showList :: [ChangeMessageVisibility] -> ShowS
Show, ReadPrec [ChangeMessageVisibility]
ReadPrec ChangeMessageVisibility
Int -> ReadS ChangeMessageVisibility
ReadS [ChangeMessageVisibility]
(Int -> ReadS ChangeMessageVisibility)
-> ReadS [ChangeMessageVisibility]
-> ReadPrec ChangeMessageVisibility
-> ReadPrec [ChangeMessageVisibility]
-> Read ChangeMessageVisibility
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ChangeMessageVisibility
readsPrec :: Int -> ReadS ChangeMessageVisibility
$creadList :: ReadS [ChangeMessageVisibility]
readList :: ReadS [ChangeMessageVisibility]
$creadPrec :: ReadPrec ChangeMessageVisibility
readPrec :: ReadPrec ChangeMessageVisibility
$creadListPrec :: ReadPrec [ChangeMessageVisibility]
readListPrec :: ReadPrec [ChangeMessageVisibility]
Read, ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
(ChangeMessageVisibility -> ChangeMessageVisibility -> Bool)
-> (ChangeMessageVisibility -> ChangeMessageVisibility -> Bool)
-> Eq ChangeMessageVisibility
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
== :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
$c/= :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
/= :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
Eq, Eq ChangeMessageVisibility
Eq ChangeMessageVisibility =>
(ChangeMessageVisibility -> ChangeMessageVisibility -> Ordering)
-> (ChangeMessageVisibility -> ChangeMessageVisibility -> Bool)
-> (ChangeMessageVisibility -> ChangeMessageVisibility -> Bool)
-> (ChangeMessageVisibility -> ChangeMessageVisibility -> Bool)
-> (ChangeMessageVisibility -> ChangeMessageVisibility -> Bool)
-> (ChangeMessageVisibility
-> ChangeMessageVisibility -> ChangeMessageVisibility)
-> (ChangeMessageVisibility
-> ChangeMessageVisibility -> ChangeMessageVisibility)
-> Ord ChangeMessageVisibility
ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
ChangeMessageVisibility -> ChangeMessageVisibility -> Ordering
ChangeMessageVisibility
-> ChangeMessageVisibility -> ChangeMessageVisibility
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ChangeMessageVisibility -> ChangeMessageVisibility -> Ordering
compare :: ChangeMessageVisibility -> ChangeMessageVisibility -> Ordering
$c< :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
< :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
$c<= :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
<= :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
$c> :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
> :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
$c>= :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
>= :: ChangeMessageVisibility -> ChangeMessageVisibility -> Bool
$cmax :: ChangeMessageVisibility
-> ChangeMessageVisibility -> ChangeMessageVisibility
max :: ChangeMessageVisibility
-> ChangeMessageVisibility -> ChangeMessageVisibility
$cmin :: ChangeMessageVisibility
-> ChangeMessageVisibility -> ChangeMessageVisibility
min :: ChangeMessageVisibility
-> ChangeMessageVisibility -> ChangeMessageVisibility
Ord)
data ChangeMessageVisibilityResponse = ChangeMessageVisibilityResponse {}
deriving (Int -> ChangeMessageVisibilityResponse -> ShowS
[ChangeMessageVisibilityResponse] -> ShowS
ChangeMessageVisibilityResponse -> String
(Int -> ChangeMessageVisibilityResponse -> ShowS)
-> (ChangeMessageVisibilityResponse -> String)
-> ([ChangeMessageVisibilityResponse] -> ShowS)
-> Show ChangeMessageVisibilityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChangeMessageVisibilityResponse -> ShowS
showsPrec :: Int -> ChangeMessageVisibilityResponse -> ShowS
$cshow :: ChangeMessageVisibilityResponse -> String
show :: ChangeMessageVisibilityResponse -> String
$cshowList :: [ChangeMessageVisibilityResponse] -> ShowS
showList :: [ChangeMessageVisibilityResponse] -> ShowS
Show, ReadPrec [ChangeMessageVisibilityResponse]
ReadPrec ChangeMessageVisibilityResponse
Int -> ReadS ChangeMessageVisibilityResponse
ReadS [ChangeMessageVisibilityResponse]
(Int -> ReadS ChangeMessageVisibilityResponse)
-> ReadS [ChangeMessageVisibilityResponse]
-> ReadPrec ChangeMessageVisibilityResponse
-> ReadPrec [ChangeMessageVisibilityResponse]
-> Read ChangeMessageVisibilityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ChangeMessageVisibilityResponse
readsPrec :: Int -> ReadS ChangeMessageVisibilityResponse
$creadList :: ReadS [ChangeMessageVisibilityResponse]
readList :: ReadS [ChangeMessageVisibilityResponse]
$creadPrec :: ReadPrec ChangeMessageVisibilityResponse
readPrec :: ReadPrec ChangeMessageVisibilityResponse
$creadListPrec :: ReadPrec [ChangeMessageVisibilityResponse]
readListPrec :: ReadPrec [ChangeMessageVisibilityResponse]
Read, ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
(ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool)
-> (ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool)
-> Eq ChangeMessageVisibilityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
== :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
$c/= :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
/= :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
Eq, Eq ChangeMessageVisibilityResponse
Eq ChangeMessageVisibilityResponse =>
(ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Ordering)
-> (ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool)
-> (ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool)
-> (ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool)
-> (ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool)
-> (ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse)
-> (ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse)
-> Ord ChangeMessageVisibilityResponse
ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Ordering
ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Ordering
compare :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Ordering
$c< :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
< :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
$c<= :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
<= :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
$c> :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
> :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
$c>= :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
>= :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse -> Bool
$cmax :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
max :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
$cmin :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
min :: ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
-> ChangeMessageVisibilityResponse
Ord)
instance ResponseConsumer r ChangeMessageVisibilityResponse where
type ResponseMetadata ChangeMessageVisibilityResponse = SqsMetadata
responseConsumer :: Request
-> r
-> IORef (ResponseMetadata ChangeMessageVisibilityResponse)
-> HTTPResponseConsumer ChangeMessageVisibilityResponse
responseConsumer Request
_ r
_ = (Cursor -> Response SqsMetadata ChangeMessageVisibilityResponse)
-> IORef SqsMetadata
-> HTTPResponseConsumer ChangeMessageVisibilityResponse
forall a.
(Cursor -> Response SqsMetadata a)
-> IORef SqsMetadata -> HTTPResponseConsumer a
sqsXmlResponseConsumer Cursor -> Response SqsMetadata ChangeMessageVisibilityResponse
forall {m :: * -> *} {p}.
Monad m =>
p -> m ChangeMessageVisibilityResponse
parse
where
parse :: p -> m ChangeMessageVisibilityResponse
parse p
_ = ChangeMessageVisibilityResponse
-> m ChangeMessageVisibilityResponse
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return ChangeMessageVisibilityResponse {}
instance SignQuery ChangeMessageVisibility where
type ServiceConfiguration ChangeMessageVisibility = SqsConfiguration
signQuery :: forall queryType.
ChangeMessageVisibility
-> ServiceConfiguration ChangeMessageVisibility queryType
-> SignatureData
-> SignedQuery
signQuery ChangeMessageVisibility {Int
ReceiptHandle
QueueName
cmvReceiptHandle :: ChangeMessageVisibility -> ReceiptHandle
cmvVisibilityTimeout :: ChangeMessageVisibility -> Int
cmvQueueName :: ChangeMessageVisibility -> QueueName
cmvReceiptHandle :: ReceiptHandle
cmvVisibilityTimeout :: Int
cmvQueueName :: QueueName
..} = SqsQuery
-> SqsConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
SqsQuery -> SqsConfiguration qt -> SignatureData -> SignedQuery
sqsSignQuery SqsQuery
{ sqsQueueName :: Maybe QueueName
sqsQueueName = QueueName -> Maybe QueueName
forall a. a -> Maybe a
Just QueueName
cmvQueueName
, sqsQuery :: Query
sqsQuery =
[ (ByteString
"Action", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
"ChangeMessageVisibility")
, (ByteString
"ReceiptHandle", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString)
-> (Text -> ByteString) -> Text -> Maybe ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
TE.encodeUtf8 (Text -> Maybe ByteString) -> Text -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ ReceiptHandle -> Text
printReceiptHandle ReceiptHandle
cmvReceiptHandle)
, (ByteString
"VisibilityTimeout", ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just (ByteString -> Maybe ByteString)
-> (String -> ByteString) -> String -> Maybe ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
B.pack (String -> Maybe ByteString) -> String -> Maybe ByteString
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
cmvVisibilityTimeout)
]
}
instance Transaction ChangeMessageVisibility ChangeMessageVisibilityResponse
instance AsMemoryResponse ChangeMessageVisibilityResponse where
type MemoryResponse ChangeMessageVisibilityResponse = ChangeMessageVisibilityResponse
loadToMemory :: ChangeMessageVisibilityResponse
-> ResourceT IO (MemoryResponse ChangeMessageVisibilityResponse)
loadToMemory = ChangeMessageVisibilityResponse
-> ResourceT IO (MemoryResponse ChangeMessageVisibilityResponse)
ChangeMessageVisibilityResponse
-> ResourceT IO ChangeMessageVisibilityResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return