{-# 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.SESV2.BatchGetMetricData
(
BatchGetMetricData (..),
newBatchGetMetricData,
batchGetMetricData_queries,
BatchGetMetricDataResponse (..),
newBatchGetMetricDataResponse,
batchGetMetricDataResponse_errors,
batchGetMetricDataResponse_results,
batchGetMetricDataResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SESV2.Types
data BatchGetMetricData = BatchGetMetricData'
{
BatchGetMetricData -> NonEmpty BatchGetMetricDataQuery
queries :: Prelude.NonEmpty BatchGetMetricDataQuery
}
deriving (BatchGetMetricData -> BatchGetMetricData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetMetricData -> BatchGetMetricData -> Bool
$c/= :: BatchGetMetricData -> BatchGetMetricData -> Bool
== :: BatchGetMetricData -> BatchGetMetricData -> Bool
$c== :: BatchGetMetricData -> BatchGetMetricData -> Bool
Prelude.Eq, ReadPrec [BatchGetMetricData]
ReadPrec BatchGetMetricData
Int -> ReadS BatchGetMetricData
ReadS [BatchGetMetricData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetMetricData]
$creadListPrec :: ReadPrec [BatchGetMetricData]
readPrec :: ReadPrec BatchGetMetricData
$creadPrec :: ReadPrec BatchGetMetricData
readList :: ReadS [BatchGetMetricData]
$creadList :: ReadS [BatchGetMetricData]
readsPrec :: Int -> ReadS BatchGetMetricData
$creadsPrec :: Int -> ReadS BatchGetMetricData
Prelude.Read, Int -> BatchGetMetricData -> ShowS
[BatchGetMetricData] -> ShowS
BatchGetMetricData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetMetricData] -> ShowS
$cshowList :: [BatchGetMetricData] -> ShowS
show :: BatchGetMetricData -> String
$cshow :: BatchGetMetricData -> String
showsPrec :: Int -> BatchGetMetricData -> ShowS
$cshowsPrec :: Int -> BatchGetMetricData -> ShowS
Prelude.Show, forall x. Rep BatchGetMetricData x -> BatchGetMetricData
forall x. BatchGetMetricData -> Rep BatchGetMetricData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetMetricData x -> BatchGetMetricData
$cfrom :: forall x. BatchGetMetricData -> Rep BatchGetMetricData x
Prelude.Generic)
newBatchGetMetricData ::
Prelude.NonEmpty BatchGetMetricDataQuery ->
BatchGetMetricData
newBatchGetMetricData :: NonEmpty BatchGetMetricDataQuery -> BatchGetMetricData
newBatchGetMetricData NonEmpty BatchGetMetricDataQuery
pQueries_ =
BatchGetMetricData'
{ $sel:queries:BatchGetMetricData' :: NonEmpty BatchGetMetricDataQuery
queries =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty BatchGetMetricDataQuery
pQueries_
}
batchGetMetricData_queries :: Lens.Lens' BatchGetMetricData (Prelude.NonEmpty BatchGetMetricDataQuery)
batchGetMetricData_queries :: Lens' BatchGetMetricData (NonEmpty BatchGetMetricDataQuery)
batchGetMetricData_queries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetMetricData' {NonEmpty BatchGetMetricDataQuery
queries :: NonEmpty BatchGetMetricDataQuery
$sel:queries:BatchGetMetricData' :: BatchGetMetricData -> NonEmpty BatchGetMetricDataQuery
queries} -> NonEmpty BatchGetMetricDataQuery
queries) (\s :: BatchGetMetricData
s@BatchGetMetricData' {} NonEmpty BatchGetMetricDataQuery
a -> BatchGetMetricData
s {$sel:queries:BatchGetMetricData' :: NonEmpty BatchGetMetricDataQuery
queries = NonEmpty BatchGetMetricDataQuery
a} :: BatchGetMetricData) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchGetMetricData where
type
AWSResponse BatchGetMetricData =
BatchGetMetricDataResponse
request :: (Service -> Service)
-> BatchGetMetricData -> Request BatchGetMetricData
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchGetMetricData
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetMetricData)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [MetricDataError]
-> Maybe [MetricDataResult] -> Int -> BatchGetMetricDataResponse
BatchGetMetricDataResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Errors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Results" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchGetMetricData where
hashWithSalt :: Int -> BatchGetMetricData -> Int
hashWithSalt Int
_salt BatchGetMetricData' {NonEmpty BatchGetMetricDataQuery
queries :: NonEmpty BatchGetMetricDataQuery
$sel:queries:BatchGetMetricData' :: BatchGetMetricData -> NonEmpty BatchGetMetricDataQuery
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty BatchGetMetricDataQuery
queries
instance Prelude.NFData BatchGetMetricData where
rnf :: BatchGetMetricData -> ()
rnf BatchGetMetricData' {NonEmpty BatchGetMetricDataQuery
queries :: NonEmpty BatchGetMetricDataQuery
$sel:queries:BatchGetMetricData' :: BatchGetMetricData -> NonEmpty BatchGetMetricDataQuery
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty BatchGetMetricDataQuery
queries
instance Data.ToHeaders BatchGetMetricData where
toHeaders :: BatchGetMetricData -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchGetMetricData where
toJSON :: BatchGetMetricData -> Value
toJSON BatchGetMetricData' {NonEmpty BatchGetMetricDataQuery
queries :: NonEmpty BatchGetMetricDataQuery
$sel:queries:BatchGetMetricData' :: BatchGetMetricData -> NonEmpty BatchGetMetricDataQuery
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Queries" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty BatchGetMetricDataQuery
queries)]
)
instance Data.ToPath BatchGetMetricData where
toPath :: BatchGetMetricData -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v2/email/metrics/batch"
instance Data.ToQuery BatchGetMetricData where
toQuery :: BatchGetMetricData -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetMetricDataResponse = BatchGetMetricDataResponse'
{
BatchGetMetricDataResponse -> Maybe [MetricDataError]
errors :: Prelude.Maybe [MetricDataError],
BatchGetMetricDataResponse -> Maybe [MetricDataResult]
results :: Prelude.Maybe [MetricDataResult],
BatchGetMetricDataResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetMetricDataResponse -> BatchGetMetricDataResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetMetricDataResponse -> BatchGetMetricDataResponse -> Bool
$c/= :: BatchGetMetricDataResponse -> BatchGetMetricDataResponse -> Bool
== :: BatchGetMetricDataResponse -> BatchGetMetricDataResponse -> Bool
$c== :: BatchGetMetricDataResponse -> BatchGetMetricDataResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetMetricDataResponse]
ReadPrec BatchGetMetricDataResponse
Int -> ReadS BatchGetMetricDataResponse
ReadS [BatchGetMetricDataResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetMetricDataResponse]
$creadListPrec :: ReadPrec [BatchGetMetricDataResponse]
readPrec :: ReadPrec BatchGetMetricDataResponse
$creadPrec :: ReadPrec BatchGetMetricDataResponse
readList :: ReadS [BatchGetMetricDataResponse]
$creadList :: ReadS [BatchGetMetricDataResponse]
readsPrec :: Int -> ReadS BatchGetMetricDataResponse
$creadsPrec :: Int -> ReadS BatchGetMetricDataResponse
Prelude.Read, Int -> BatchGetMetricDataResponse -> ShowS
[BatchGetMetricDataResponse] -> ShowS
BatchGetMetricDataResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetMetricDataResponse] -> ShowS
$cshowList :: [BatchGetMetricDataResponse] -> ShowS
show :: BatchGetMetricDataResponse -> String
$cshow :: BatchGetMetricDataResponse -> String
showsPrec :: Int -> BatchGetMetricDataResponse -> ShowS
$cshowsPrec :: Int -> BatchGetMetricDataResponse -> ShowS
Prelude.Show, forall x.
Rep BatchGetMetricDataResponse x -> BatchGetMetricDataResponse
forall x.
BatchGetMetricDataResponse -> Rep BatchGetMetricDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetMetricDataResponse x -> BatchGetMetricDataResponse
$cfrom :: forall x.
BatchGetMetricDataResponse -> Rep BatchGetMetricDataResponse x
Prelude.Generic)
newBatchGetMetricDataResponse ::
Prelude.Int ->
BatchGetMetricDataResponse
newBatchGetMetricDataResponse :: Int -> BatchGetMetricDataResponse
newBatchGetMetricDataResponse Int
pHttpStatus_ =
BatchGetMetricDataResponse'
{ $sel:errors:BatchGetMetricDataResponse' :: Maybe [MetricDataError]
errors =
forall a. Maybe a
Prelude.Nothing,
$sel:results:BatchGetMetricDataResponse' :: Maybe [MetricDataResult]
results = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetMetricDataResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetMetricDataResponse_errors :: Lens.Lens' BatchGetMetricDataResponse (Prelude.Maybe [MetricDataError])
batchGetMetricDataResponse_errors :: Lens' BatchGetMetricDataResponse (Maybe [MetricDataError])
batchGetMetricDataResponse_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetMetricDataResponse' {Maybe [MetricDataError]
errors :: Maybe [MetricDataError]
$sel:errors:BatchGetMetricDataResponse' :: BatchGetMetricDataResponse -> Maybe [MetricDataError]
errors} -> Maybe [MetricDataError]
errors) (\s :: BatchGetMetricDataResponse
s@BatchGetMetricDataResponse' {} Maybe [MetricDataError]
a -> BatchGetMetricDataResponse
s {$sel:errors:BatchGetMetricDataResponse' :: Maybe [MetricDataError]
errors = Maybe [MetricDataError]
a} :: BatchGetMetricDataResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetMetricDataResponse_results :: Lens.Lens' BatchGetMetricDataResponse (Prelude.Maybe [MetricDataResult])
batchGetMetricDataResponse_results :: Lens' BatchGetMetricDataResponse (Maybe [MetricDataResult])
batchGetMetricDataResponse_results = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetMetricDataResponse' {Maybe [MetricDataResult]
results :: Maybe [MetricDataResult]
$sel:results:BatchGetMetricDataResponse' :: BatchGetMetricDataResponse -> Maybe [MetricDataResult]
results} -> Maybe [MetricDataResult]
results) (\s :: BatchGetMetricDataResponse
s@BatchGetMetricDataResponse' {} Maybe [MetricDataResult]
a -> BatchGetMetricDataResponse
s {$sel:results:BatchGetMetricDataResponse' :: Maybe [MetricDataResult]
results = Maybe [MetricDataResult]
a} :: BatchGetMetricDataResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetMetricDataResponse_httpStatus :: Lens.Lens' BatchGetMetricDataResponse Prelude.Int
batchGetMetricDataResponse_httpStatus :: Lens' BatchGetMetricDataResponse Int
batchGetMetricDataResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetMetricDataResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetMetricDataResponse' :: BatchGetMetricDataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetMetricDataResponse
s@BatchGetMetricDataResponse' {} Int
a -> BatchGetMetricDataResponse
s {$sel:httpStatus:BatchGetMetricDataResponse' :: Int
httpStatus = Int
a} :: BatchGetMetricDataResponse)
instance Prelude.NFData BatchGetMetricDataResponse where
rnf :: BatchGetMetricDataResponse -> ()
rnf BatchGetMetricDataResponse' {Int
Maybe [MetricDataResult]
Maybe [MetricDataError]
httpStatus :: Int
results :: Maybe [MetricDataResult]
errors :: Maybe [MetricDataError]
$sel:httpStatus:BatchGetMetricDataResponse' :: BatchGetMetricDataResponse -> Int
$sel:results:BatchGetMetricDataResponse' :: BatchGetMetricDataResponse -> Maybe [MetricDataResult]
$sel:errors:BatchGetMetricDataResponse' :: BatchGetMetricDataResponse -> Maybe [MetricDataError]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetricDataError]
errors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetricDataResult]
results
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus