{-# 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.SES.GetSendStatistics
(
GetSendStatistics (..),
newGetSendStatistics,
GetSendStatisticsResponse (..),
newGetSendStatisticsResponse,
getSendStatisticsResponse_sendDataPoints,
getSendStatisticsResponse_httpStatus,
)
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.SES.Types
data GetSendStatistics = GetSendStatistics'
{
}
deriving (GetSendStatistics -> GetSendStatistics -> Bool
(GetSendStatistics -> GetSendStatistics -> Bool)
-> (GetSendStatistics -> GetSendStatistics -> Bool)
-> Eq GetSendStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSendStatistics -> GetSendStatistics -> Bool
$c/= :: GetSendStatistics -> GetSendStatistics -> Bool
== :: GetSendStatistics -> GetSendStatistics -> Bool
$c== :: GetSendStatistics -> GetSendStatistics -> Bool
Prelude.Eq, ReadPrec [GetSendStatistics]
ReadPrec GetSendStatistics
Int -> ReadS GetSendStatistics
ReadS [GetSendStatistics]
(Int -> ReadS GetSendStatistics)
-> ReadS [GetSendStatistics]
-> ReadPrec GetSendStatistics
-> ReadPrec [GetSendStatistics]
-> Read GetSendStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSendStatistics]
$creadListPrec :: ReadPrec [GetSendStatistics]
readPrec :: ReadPrec GetSendStatistics
$creadPrec :: ReadPrec GetSendStatistics
readList :: ReadS [GetSendStatistics]
$creadList :: ReadS [GetSendStatistics]
readsPrec :: Int -> ReadS GetSendStatistics
$creadsPrec :: Int -> ReadS GetSendStatistics
Prelude.Read, Int -> GetSendStatistics -> ShowS
[GetSendStatistics] -> ShowS
GetSendStatistics -> String
(Int -> GetSendStatistics -> ShowS)
-> (GetSendStatistics -> String)
-> ([GetSendStatistics] -> ShowS)
-> Show GetSendStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSendStatistics] -> ShowS
$cshowList :: [GetSendStatistics] -> ShowS
show :: GetSendStatistics -> String
$cshow :: GetSendStatistics -> String
showsPrec :: Int -> GetSendStatistics -> ShowS
$cshowsPrec :: Int -> GetSendStatistics -> ShowS
Prelude.Show, (forall x. GetSendStatistics -> Rep GetSendStatistics x)
-> (forall x. Rep GetSendStatistics x -> GetSendStatistics)
-> Generic GetSendStatistics
forall x. Rep GetSendStatistics x -> GetSendStatistics
forall x. GetSendStatistics -> Rep GetSendStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSendStatistics x -> GetSendStatistics
$cfrom :: forall x. GetSendStatistics -> Rep GetSendStatistics x
Prelude.Generic)
newGetSendStatistics ::
GetSendStatistics
newGetSendStatistics :: GetSendStatistics
newGetSendStatistics = GetSendStatistics
GetSendStatistics'
instance Core.AWSRequest GetSendStatistics where
type
AWSResponse GetSendStatistics =
GetSendStatisticsResponse
request :: GetSendStatistics -> Request GetSendStatistics
request = Service -> GetSendStatistics -> Request GetSendStatistics
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetSendStatistics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSendStatistics)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetSendStatistics))
-> Logger
-> Service
-> Proxy GetSendStatistics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSendStatistics)))
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
"GetSendStatisticsResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [SendDataPoint] -> Int -> GetSendStatisticsResponse
GetSendStatisticsResponse'
(Maybe [SendDataPoint] -> Int -> GetSendStatisticsResponse)
-> Either String (Maybe [SendDataPoint])
-> Either String (Int -> GetSendStatisticsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SendDataPoints" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [SendDataPoint]))
-> Either String (Maybe [SendDataPoint])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [SendDataPoint])
-> [Node] -> Either String (Maybe [SendDataPoint])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [SendDataPoint]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> GetSendStatisticsResponse)
-> Either String Int -> Either String GetSendStatisticsResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetSendStatistics
instance Prelude.NFData GetSendStatistics
instance Core.ToHeaders GetSendStatistics where
toHeaders :: GetSendStatistics -> ResponseHeaders
toHeaders = ResponseHeaders -> GetSendStatistics -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetSendStatistics where
toPath :: GetSendStatistics -> ByteString
toPath = ByteString -> GetSendStatistics -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetSendStatistics where
toQuery :: GetSendStatistics -> QueryString
toQuery =
QueryString -> GetSendStatistics -> QueryString
forall a b. a -> b -> a
Prelude.const
( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetSendStatistics" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString)
]
)
data GetSendStatisticsResponse = GetSendStatisticsResponse'
{
GetSendStatisticsResponse -> Maybe [SendDataPoint]
sendDataPoints :: Prelude.Maybe [SendDataPoint],
GetSendStatisticsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetSendStatisticsResponse -> GetSendStatisticsResponse -> Bool
(GetSendStatisticsResponse -> GetSendStatisticsResponse -> Bool)
-> (GetSendStatisticsResponse -> GetSendStatisticsResponse -> Bool)
-> Eq GetSendStatisticsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSendStatisticsResponse -> GetSendStatisticsResponse -> Bool
$c/= :: GetSendStatisticsResponse -> GetSendStatisticsResponse -> Bool
== :: GetSendStatisticsResponse -> GetSendStatisticsResponse -> Bool
$c== :: GetSendStatisticsResponse -> GetSendStatisticsResponse -> Bool
Prelude.Eq, ReadPrec [GetSendStatisticsResponse]
ReadPrec GetSendStatisticsResponse
Int -> ReadS GetSendStatisticsResponse
ReadS [GetSendStatisticsResponse]
(Int -> ReadS GetSendStatisticsResponse)
-> ReadS [GetSendStatisticsResponse]
-> ReadPrec GetSendStatisticsResponse
-> ReadPrec [GetSendStatisticsResponse]
-> Read GetSendStatisticsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSendStatisticsResponse]
$creadListPrec :: ReadPrec [GetSendStatisticsResponse]
readPrec :: ReadPrec GetSendStatisticsResponse
$creadPrec :: ReadPrec GetSendStatisticsResponse
readList :: ReadS [GetSendStatisticsResponse]
$creadList :: ReadS [GetSendStatisticsResponse]
readsPrec :: Int -> ReadS GetSendStatisticsResponse
$creadsPrec :: Int -> ReadS GetSendStatisticsResponse
Prelude.Read, Int -> GetSendStatisticsResponse -> ShowS
[GetSendStatisticsResponse] -> ShowS
GetSendStatisticsResponse -> String
(Int -> GetSendStatisticsResponse -> ShowS)
-> (GetSendStatisticsResponse -> String)
-> ([GetSendStatisticsResponse] -> ShowS)
-> Show GetSendStatisticsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSendStatisticsResponse] -> ShowS
$cshowList :: [GetSendStatisticsResponse] -> ShowS
show :: GetSendStatisticsResponse -> String
$cshow :: GetSendStatisticsResponse -> String
showsPrec :: Int -> GetSendStatisticsResponse -> ShowS
$cshowsPrec :: Int -> GetSendStatisticsResponse -> ShowS
Prelude.Show, (forall x.
GetSendStatisticsResponse -> Rep GetSendStatisticsResponse x)
-> (forall x.
Rep GetSendStatisticsResponse x -> GetSendStatisticsResponse)
-> Generic GetSendStatisticsResponse
forall x.
Rep GetSendStatisticsResponse x -> GetSendStatisticsResponse
forall x.
GetSendStatisticsResponse -> Rep GetSendStatisticsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSendStatisticsResponse x -> GetSendStatisticsResponse
$cfrom :: forall x.
GetSendStatisticsResponse -> Rep GetSendStatisticsResponse x
Prelude.Generic)
newGetSendStatisticsResponse ::
Prelude.Int ->
GetSendStatisticsResponse
newGetSendStatisticsResponse :: Int -> GetSendStatisticsResponse
newGetSendStatisticsResponse Int
pHttpStatus_ =
GetSendStatisticsResponse' :: Maybe [SendDataPoint] -> Int -> GetSendStatisticsResponse
GetSendStatisticsResponse'
{ $sel:sendDataPoints:GetSendStatisticsResponse' :: Maybe [SendDataPoint]
sendDataPoints =
Maybe [SendDataPoint]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSendStatisticsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSendStatisticsResponse_sendDataPoints :: Lens.Lens' GetSendStatisticsResponse (Prelude.Maybe [SendDataPoint])
getSendStatisticsResponse_sendDataPoints :: (Maybe [SendDataPoint] -> f (Maybe [SendDataPoint]))
-> GetSendStatisticsResponse -> f GetSendStatisticsResponse
getSendStatisticsResponse_sendDataPoints = (GetSendStatisticsResponse -> Maybe [SendDataPoint])
-> (GetSendStatisticsResponse
-> Maybe [SendDataPoint] -> GetSendStatisticsResponse)
-> Lens
GetSendStatisticsResponse
GetSendStatisticsResponse
(Maybe [SendDataPoint])
(Maybe [SendDataPoint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendStatisticsResponse' {Maybe [SendDataPoint]
sendDataPoints :: Maybe [SendDataPoint]
$sel:sendDataPoints:GetSendStatisticsResponse' :: GetSendStatisticsResponse -> Maybe [SendDataPoint]
sendDataPoints} -> Maybe [SendDataPoint]
sendDataPoints) (\s :: GetSendStatisticsResponse
s@GetSendStatisticsResponse' {} Maybe [SendDataPoint]
a -> GetSendStatisticsResponse
s {$sel:sendDataPoints:GetSendStatisticsResponse' :: Maybe [SendDataPoint]
sendDataPoints = Maybe [SendDataPoint]
a} :: GetSendStatisticsResponse) ((Maybe [SendDataPoint] -> f (Maybe [SendDataPoint]))
-> GetSendStatisticsResponse -> f GetSendStatisticsResponse)
-> ((Maybe [SendDataPoint] -> f (Maybe [SendDataPoint]))
-> Maybe [SendDataPoint] -> f (Maybe [SendDataPoint]))
-> (Maybe [SendDataPoint] -> f (Maybe [SendDataPoint]))
-> GetSendStatisticsResponse
-> f GetSendStatisticsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[SendDataPoint] [SendDataPoint] [SendDataPoint] [SendDataPoint]
-> Iso
(Maybe [SendDataPoint])
(Maybe [SendDataPoint])
(Maybe [SendDataPoint])
(Maybe [SendDataPoint])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[SendDataPoint] [SendDataPoint] [SendDataPoint] [SendDataPoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getSendStatisticsResponse_httpStatus :: Lens.Lens' GetSendStatisticsResponse Prelude.Int
getSendStatisticsResponse_httpStatus :: (Int -> f Int)
-> GetSendStatisticsResponse -> f GetSendStatisticsResponse
getSendStatisticsResponse_httpStatus = (GetSendStatisticsResponse -> Int)
-> (GetSendStatisticsResponse -> Int -> GetSendStatisticsResponse)
-> Lens GetSendStatisticsResponse GetSendStatisticsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendStatisticsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSendStatisticsResponse' :: GetSendStatisticsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSendStatisticsResponse
s@GetSendStatisticsResponse' {} Int
a -> GetSendStatisticsResponse
s {$sel:httpStatus:GetSendStatisticsResponse' :: Int
httpStatus = Int
a} :: GetSendStatisticsResponse)
instance Prelude.NFData GetSendStatisticsResponse