{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SQS.SendMessageBatch
(
SendMessageBatch (..),
newSendMessageBatch,
sendMessageBatch_queueUrl,
sendMessageBatch_entries,
SendMessageBatchResponse (..),
newSendMessageBatchResponse,
sendMessageBatchResponse_httpStatus,
sendMessageBatchResponse_successful,
sendMessageBatchResponse_failed,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SQS.Types
data SendMessageBatch = SendMessageBatch'
{
SendMessageBatch -> Text
queueUrl :: Prelude.Text,
SendMessageBatch -> [SendMessageBatchRequestEntry]
entries :: [SendMessageBatchRequestEntry]
}
deriving (SendMessageBatch -> SendMessageBatch -> Bool
(SendMessageBatch -> SendMessageBatch -> Bool)
-> (SendMessageBatch -> SendMessageBatch -> Bool)
-> Eq SendMessageBatch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendMessageBatch -> SendMessageBatch -> Bool
$c/= :: SendMessageBatch -> SendMessageBatch -> Bool
== :: SendMessageBatch -> SendMessageBatch -> Bool
$c== :: SendMessageBatch -> SendMessageBatch -> Bool
Prelude.Eq, ReadPrec [SendMessageBatch]
ReadPrec SendMessageBatch
Int -> ReadS SendMessageBatch
ReadS [SendMessageBatch]
(Int -> ReadS SendMessageBatch)
-> ReadS [SendMessageBatch]
-> ReadPrec SendMessageBatch
-> ReadPrec [SendMessageBatch]
-> Read SendMessageBatch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendMessageBatch]
$creadListPrec :: ReadPrec [SendMessageBatch]
readPrec :: ReadPrec SendMessageBatch
$creadPrec :: ReadPrec SendMessageBatch
readList :: ReadS [SendMessageBatch]
$creadList :: ReadS [SendMessageBatch]
readsPrec :: Int -> ReadS SendMessageBatch
$creadsPrec :: Int -> ReadS SendMessageBatch
Prelude.Read, Int -> SendMessageBatch -> ShowS
[SendMessageBatch] -> ShowS
SendMessageBatch -> String
(Int -> SendMessageBatch -> ShowS)
-> (SendMessageBatch -> String)
-> ([SendMessageBatch] -> ShowS)
-> Show SendMessageBatch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendMessageBatch] -> ShowS
$cshowList :: [SendMessageBatch] -> ShowS
show :: SendMessageBatch -> String
$cshow :: SendMessageBatch -> String
showsPrec :: Int -> SendMessageBatch -> ShowS
$cshowsPrec :: Int -> SendMessageBatch -> ShowS
Prelude.Show, (forall x. SendMessageBatch -> Rep SendMessageBatch x)
-> (forall x. Rep SendMessageBatch x -> SendMessageBatch)
-> Generic SendMessageBatch
forall x. Rep SendMessageBatch x -> SendMessageBatch
forall x. SendMessageBatch -> Rep SendMessageBatch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendMessageBatch x -> SendMessageBatch
$cfrom :: forall x. SendMessageBatch -> Rep SendMessageBatch x
Prelude.Generic)
newSendMessageBatch ::
Prelude.Text ->
SendMessageBatch
newSendMessageBatch :: Text -> SendMessageBatch
newSendMessageBatch Text
pQueueUrl_ =
SendMessageBatch' :: Text -> [SendMessageBatchRequestEntry] -> SendMessageBatch
SendMessageBatch'
{ $sel:queueUrl:SendMessageBatch' :: Text
queueUrl = Text
pQueueUrl_,
$sel:entries:SendMessageBatch' :: [SendMessageBatchRequestEntry]
entries = [SendMessageBatchRequestEntry]
forall a. Monoid a => a
Prelude.mempty
}
sendMessageBatch_queueUrl :: Lens.Lens' SendMessageBatch Prelude.Text
sendMessageBatch_queueUrl :: (Text -> f Text) -> SendMessageBatch -> f SendMessageBatch
sendMessageBatch_queueUrl = (SendMessageBatch -> Text)
-> (SendMessageBatch -> Text -> SendMessageBatch)
-> Lens SendMessageBatch SendMessageBatch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatch' {Text
queueUrl :: Text
$sel:queueUrl:SendMessageBatch' :: SendMessageBatch -> Text
queueUrl} -> Text
queueUrl) (\s :: SendMessageBatch
s@SendMessageBatch' {} Text
a -> SendMessageBatch
s {$sel:queueUrl:SendMessageBatch' :: Text
queueUrl = Text
a} :: SendMessageBatch)
sendMessageBatch_entries :: Lens.Lens' SendMessageBatch [SendMessageBatchRequestEntry]
sendMessageBatch_entries :: ([SendMessageBatchRequestEntry]
-> f [SendMessageBatchRequestEntry])
-> SendMessageBatch -> f SendMessageBatch
sendMessageBatch_entries = (SendMessageBatch -> [SendMessageBatchRequestEntry])
-> (SendMessageBatch
-> [SendMessageBatchRequestEntry] -> SendMessageBatch)
-> Lens
SendMessageBatch
SendMessageBatch
[SendMessageBatchRequestEntry]
[SendMessageBatchRequestEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatch' {[SendMessageBatchRequestEntry]
entries :: [SendMessageBatchRequestEntry]
$sel:entries:SendMessageBatch' :: SendMessageBatch -> [SendMessageBatchRequestEntry]
entries} -> [SendMessageBatchRequestEntry]
entries) (\s :: SendMessageBatch
s@SendMessageBatch' {} [SendMessageBatchRequestEntry]
a -> SendMessageBatch
s {$sel:entries:SendMessageBatch' :: [SendMessageBatchRequestEntry]
entries = [SendMessageBatchRequestEntry]
a} :: SendMessageBatch) (([SendMessageBatchRequestEntry]
-> f [SendMessageBatchRequestEntry])
-> SendMessageBatch -> f SendMessageBatch)
-> (([SendMessageBatchRequestEntry]
-> f [SendMessageBatchRequestEntry])
-> [SendMessageBatchRequestEntry]
-> f [SendMessageBatchRequestEntry])
-> ([SendMessageBatchRequestEntry]
-> f [SendMessageBatchRequestEntry])
-> SendMessageBatch
-> f SendMessageBatch
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SendMessageBatchRequestEntry]
-> f [SendMessageBatchRequestEntry])
-> [SendMessageBatchRequestEntry]
-> f [SendMessageBatchRequestEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest SendMessageBatch where
type
AWSResponse SendMessageBatch =
SendMessageBatchResponse
request :: SendMessageBatch -> Request SendMessageBatch
request = Service -> SendMessageBatch -> Request SendMessageBatch
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy SendMessageBatch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendMessageBatch)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse SendMessageBatch))
-> Logger
-> Service
-> Proxy SendMessageBatch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendMessageBatch)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"SendMessageBatchResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int
-> [SendMessageBatchResultEntry]
-> [BatchResultErrorEntry]
-> SendMessageBatchResponse
SendMessageBatchResponse'
(Int
-> [SendMessageBatchResultEntry]
-> [BatchResultErrorEntry]
-> SendMessageBatchResponse)
-> Either String Int
-> Either
String
([SendMessageBatchResultEntry]
-> [BatchResultErrorEntry] -> SendMessageBatchResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either
String
([SendMessageBatchResultEntry]
-> [BatchResultErrorEntry] -> SendMessageBatchResponse)
-> Either String [SendMessageBatchResultEntry]
-> Either
String ([BatchResultErrorEntry] -> SendMessageBatchResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Text -> [Node] -> Either String [SendMessageBatchResultEntry]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"SendMessageBatchResultEntry" [Node]
x)
Either String ([BatchResultErrorEntry] -> SendMessageBatchResponse)
-> Either String [BatchResultErrorEntry]
-> Either String SendMessageBatchResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Text -> [Node] -> Either String [BatchResultErrorEntry]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"BatchResultErrorEntry" [Node]
x)
)
instance Prelude.Hashable SendMessageBatch
instance Prelude.NFData SendMessageBatch
instance Core.ToHeaders SendMessageBatch where
toHeaders :: SendMessageBatch -> ResponseHeaders
toHeaders = ResponseHeaders -> SendMessageBatch -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath SendMessageBatch where
toPath :: SendMessageBatch -> ByteString
toPath = ByteString -> SendMessageBatch -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SendMessageBatch where
toQuery :: SendMessageBatch -> QueryString
toQuery SendMessageBatch' {[SendMessageBatchRequestEntry]
Text
entries :: [SendMessageBatchRequestEntry]
queueUrl :: Text
$sel:entries:SendMessageBatch' :: SendMessageBatch -> [SendMessageBatchRequestEntry]
$sel:queueUrl:SendMessageBatch' :: SendMessageBatch -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"SendMessageBatch" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-11-05" :: Prelude.ByteString),
ByteString
"QueueUrl" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
queueUrl,
ByteString -> [SendMessageBatchRequestEntry] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList
ByteString
"SendMessageBatchRequestEntry"
[SendMessageBatchRequestEntry]
entries
]
data SendMessageBatchResponse = SendMessageBatchResponse'
{
SendMessageBatchResponse -> Int
httpStatus :: Prelude.Int,
SendMessageBatchResponse -> [SendMessageBatchResultEntry]
successful :: [SendMessageBatchResultEntry],
SendMessageBatchResponse -> [BatchResultErrorEntry]
failed :: [BatchResultErrorEntry]
}
deriving (SendMessageBatchResponse -> SendMessageBatchResponse -> Bool
(SendMessageBatchResponse -> SendMessageBatchResponse -> Bool)
-> (SendMessageBatchResponse -> SendMessageBatchResponse -> Bool)
-> Eq SendMessageBatchResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendMessageBatchResponse -> SendMessageBatchResponse -> Bool
$c/= :: SendMessageBatchResponse -> SendMessageBatchResponse -> Bool
== :: SendMessageBatchResponse -> SendMessageBatchResponse -> Bool
$c== :: SendMessageBatchResponse -> SendMessageBatchResponse -> Bool
Prelude.Eq, ReadPrec [SendMessageBatchResponse]
ReadPrec SendMessageBatchResponse
Int -> ReadS SendMessageBatchResponse
ReadS [SendMessageBatchResponse]
(Int -> ReadS SendMessageBatchResponse)
-> ReadS [SendMessageBatchResponse]
-> ReadPrec SendMessageBatchResponse
-> ReadPrec [SendMessageBatchResponse]
-> Read SendMessageBatchResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendMessageBatchResponse]
$creadListPrec :: ReadPrec [SendMessageBatchResponse]
readPrec :: ReadPrec SendMessageBatchResponse
$creadPrec :: ReadPrec SendMessageBatchResponse
readList :: ReadS [SendMessageBatchResponse]
$creadList :: ReadS [SendMessageBatchResponse]
readsPrec :: Int -> ReadS SendMessageBatchResponse
$creadsPrec :: Int -> ReadS SendMessageBatchResponse
Prelude.Read, Int -> SendMessageBatchResponse -> ShowS
[SendMessageBatchResponse] -> ShowS
SendMessageBatchResponse -> String
(Int -> SendMessageBatchResponse -> ShowS)
-> (SendMessageBatchResponse -> String)
-> ([SendMessageBatchResponse] -> ShowS)
-> Show SendMessageBatchResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendMessageBatchResponse] -> ShowS
$cshowList :: [SendMessageBatchResponse] -> ShowS
show :: SendMessageBatchResponse -> String
$cshow :: SendMessageBatchResponse -> String
showsPrec :: Int -> SendMessageBatchResponse -> ShowS
$cshowsPrec :: Int -> SendMessageBatchResponse -> ShowS
Prelude.Show, (forall x.
SendMessageBatchResponse -> Rep SendMessageBatchResponse x)
-> (forall x.
Rep SendMessageBatchResponse x -> SendMessageBatchResponse)
-> Generic SendMessageBatchResponse
forall x.
Rep SendMessageBatchResponse x -> SendMessageBatchResponse
forall x.
SendMessageBatchResponse -> Rep SendMessageBatchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SendMessageBatchResponse x -> SendMessageBatchResponse
$cfrom :: forall x.
SendMessageBatchResponse -> Rep SendMessageBatchResponse x
Prelude.Generic)
newSendMessageBatchResponse ::
Prelude.Int ->
SendMessageBatchResponse
newSendMessageBatchResponse :: Int -> SendMessageBatchResponse
newSendMessageBatchResponse Int
pHttpStatus_ =
SendMessageBatchResponse' :: Int
-> [SendMessageBatchResultEntry]
-> [BatchResultErrorEntry]
-> SendMessageBatchResponse
SendMessageBatchResponse'
{ $sel:httpStatus:SendMessageBatchResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:successful:SendMessageBatchResponse' :: [SendMessageBatchResultEntry]
successful = [SendMessageBatchResultEntry]
forall a. Monoid a => a
Prelude.mempty,
$sel:failed:SendMessageBatchResponse' :: [BatchResultErrorEntry]
failed = [BatchResultErrorEntry]
forall a. Monoid a => a
Prelude.mempty
}
sendMessageBatchResponse_httpStatus :: Lens.Lens' SendMessageBatchResponse Prelude.Int
sendMessageBatchResponse_httpStatus :: (Int -> f Int)
-> SendMessageBatchResponse -> f SendMessageBatchResponse
sendMessageBatchResponse_httpStatus = (SendMessageBatchResponse -> Int)
-> (SendMessageBatchResponse -> Int -> SendMessageBatchResponse)
-> Lens SendMessageBatchResponse SendMessageBatchResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendMessageBatchResponse' :: SendMessageBatchResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendMessageBatchResponse
s@SendMessageBatchResponse' {} Int
a -> SendMessageBatchResponse
s {$sel:httpStatus:SendMessageBatchResponse' :: Int
httpStatus = Int
a} :: SendMessageBatchResponse)
sendMessageBatchResponse_successful :: Lens.Lens' SendMessageBatchResponse [SendMessageBatchResultEntry]
sendMessageBatchResponse_successful :: ([SendMessageBatchResultEntry] -> f [SendMessageBatchResultEntry])
-> SendMessageBatchResponse -> f SendMessageBatchResponse
sendMessageBatchResponse_successful = (SendMessageBatchResponse -> [SendMessageBatchResultEntry])
-> (SendMessageBatchResponse
-> [SendMessageBatchResultEntry] -> SendMessageBatchResponse)
-> Lens
SendMessageBatchResponse
SendMessageBatchResponse
[SendMessageBatchResultEntry]
[SendMessageBatchResultEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResponse' {[SendMessageBatchResultEntry]
successful :: [SendMessageBatchResultEntry]
$sel:successful:SendMessageBatchResponse' :: SendMessageBatchResponse -> [SendMessageBatchResultEntry]
successful} -> [SendMessageBatchResultEntry]
successful) (\s :: SendMessageBatchResponse
s@SendMessageBatchResponse' {} [SendMessageBatchResultEntry]
a -> SendMessageBatchResponse
s {$sel:successful:SendMessageBatchResponse' :: [SendMessageBatchResultEntry]
successful = [SendMessageBatchResultEntry]
a} :: SendMessageBatchResponse) (([SendMessageBatchResultEntry] -> f [SendMessageBatchResultEntry])
-> SendMessageBatchResponse -> f SendMessageBatchResponse)
-> (([SendMessageBatchResultEntry]
-> f [SendMessageBatchResultEntry])
-> [SendMessageBatchResultEntry]
-> f [SendMessageBatchResultEntry])
-> ([SendMessageBatchResultEntry]
-> f [SendMessageBatchResultEntry])
-> SendMessageBatchResponse
-> f SendMessageBatchResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SendMessageBatchResultEntry] -> f [SendMessageBatchResultEntry])
-> [SendMessageBatchResultEntry] -> f [SendMessageBatchResultEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
sendMessageBatchResponse_failed :: Lens.Lens' SendMessageBatchResponse [BatchResultErrorEntry]
sendMessageBatchResponse_failed :: ([BatchResultErrorEntry] -> f [BatchResultErrorEntry])
-> SendMessageBatchResponse -> f SendMessageBatchResponse
sendMessageBatchResponse_failed = (SendMessageBatchResponse -> [BatchResultErrorEntry])
-> (SendMessageBatchResponse
-> [BatchResultErrorEntry] -> SendMessageBatchResponse)
-> Lens
SendMessageBatchResponse
SendMessageBatchResponse
[BatchResultErrorEntry]
[BatchResultErrorEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResponse' {[BatchResultErrorEntry]
failed :: [BatchResultErrorEntry]
$sel:failed:SendMessageBatchResponse' :: SendMessageBatchResponse -> [BatchResultErrorEntry]
failed} -> [BatchResultErrorEntry]
failed) (\s :: SendMessageBatchResponse
s@SendMessageBatchResponse' {} [BatchResultErrorEntry]
a -> SendMessageBatchResponse
s {$sel:failed:SendMessageBatchResponse' :: [BatchResultErrorEntry]
failed = [BatchResultErrorEntry]
a} :: SendMessageBatchResponse) (([BatchResultErrorEntry] -> f [BatchResultErrorEntry])
-> SendMessageBatchResponse -> f SendMessageBatchResponse)
-> (([BatchResultErrorEntry] -> f [BatchResultErrorEntry])
-> [BatchResultErrorEntry] -> f [BatchResultErrorEntry])
-> ([BatchResultErrorEntry] -> f [BatchResultErrorEntry])
-> SendMessageBatchResponse
-> f SendMessageBatchResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchResultErrorEntry] -> f [BatchResultErrorEntry])
-> [BatchResultErrorEntry] -> f [BatchResultErrorEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData SendMessageBatchResponse