{-# 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.CloudWatch.GetMetricData
(
GetMetricData (..),
newGetMetricData,
getMetricData_maxDatapoints,
getMetricData_labelOptions,
getMetricData_nextToken,
getMetricData_scanBy,
getMetricData_metricDataQueries,
getMetricData_startTime,
getMetricData_endTime,
GetMetricDataResponse (..),
newGetMetricDataResponse,
getMetricDataResponse_metricDataResults,
getMetricDataResponse_nextToken,
getMetricDataResponse_messages,
getMetricDataResponse_httpStatus,
)
where
import Amazonka.CloudWatch.Types
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
data GetMetricData = GetMetricData'
{
GetMetricData -> Maybe Int
maxDatapoints :: Prelude.Maybe Prelude.Int,
GetMetricData -> Maybe LabelOptions
labelOptions :: Prelude.Maybe LabelOptions,
GetMetricData -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetMetricData -> Maybe ScanBy
scanBy :: Prelude.Maybe ScanBy,
GetMetricData -> [MetricDataQuery]
metricDataQueries :: [MetricDataQuery],
GetMetricData -> ISO8601
startTime :: Core.ISO8601,
GetMetricData -> ISO8601
endTime :: Core.ISO8601
}
deriving (GetMetricData -> GetMetricData -> Bool
(GetMetricData -> GetMetricData -> Bool)
-> (GetMetricData -> GetMetricData -> Bool) -> Eq GetMetricData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricData -> GetMetricData -> Bool
$c/= :: GetMetricData -> GetMetricData -> Bool
== :: GetMetricData -> GetMetricData -> Bool
$c== :: GetMetricData -> GetMetricData -> Bool
Prelude.Eq, ReadPrec [GetMetricData]
ReadPrec GetMetricData
Int -> ReadS GetMetricData
ReadS [GetMetricData]
(Int -> ReadS GetMetricData)
-> ReadS [GetMetricData]
-> ReadPrec GetMetricData
-> ReadPrec [GetMetricData]
-> Read GetMetricData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricData]
$creadListPrec :: ReadPrec [GetMetricData]
readPrec :: ReadPrec GetMetricData
$creadPrec :: ReadPrec GetMetricData
readList :: ReadS [GetMetricData]
$creadList :: ReadS [GetMetricData]
readsPrec :: Int -> ReadS GetMetricData
$creadsPrec :: Int -> ReadS GetMetricData
Prelude.Read, Int -> GetMetricData -> ShowS
[GetMetricData] -> ShowS
GetMetricData -> String
(Int -> GetMetricData -> ShowS)
-> (GetMetricData -> String)
-> ([GetMetricData] -> ShowS)
-> Show GetMetricData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricData] -> ShowS
$cshowList :: [GetMetricData] -> ShowS
show :: GetMetricData -> String
$cshow :: GetMetricData -> String
showsPrec :: Int -> GetMetricData -> ShowS
$cshowsPrec :: Int -> GetMetricData -> ShowS
Prelude.Show, (forall x. GetMetricData -> Rep GetMetricData x)
-> (forall x. Rep GetMetricData x -> GetMetricData)
-> Generic GetMetricData
forall x. Rep GetMetricData x -> GetMetricData
forall x. GetMetricData -> Rep GetMetricData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMetricData x -> GetMetricData
$cfrom :: forall x. GetMetricData -> Rep GetMetricData x
Prelude.Generic)
newGetMetricData ::
Prelude.UTCTime ->
Prelude.UTCTime ->
GetMetricData
newGetMetricData :: UTCTime -> UTCTime -> GetMetricData
newGetMetricData UTCTime
pStartTime_ UTCTime
pEndTime_ =
GetMetricData' :: Maybe Int
-> Maybe LabelOptions
-> Maybe Text
-> Maybe ScanBy
-> [MetricDataQuery]
-> ISO8601
-> ISO8601
-> GetMetricData
GetMetricData'
{ $sel:maxDatapoints:GetMetricData' :: Maybe Int
maxDatapoints = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:labelOptions:GetMetricData' :: Maybe LabelOptions
labelOptions = Maybe LabelOptions
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetMetricData' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:scanBy:GetMetricData' :: Maybe ScanBy
scanBy = Maybe ScanBy
forall a. Maybe a
Prelude.Nothing,
$sel:metricDataQueries:GetMetricData' :: [MetricDataQuery]
metricDataQueries = [MetricDataQuery]
forall a. Monoid a => a
Prelude.mempty,
$sel:startTime:GetMetricData' :: ISO8601
startTime = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
$sel:endTime:GetMetricData' :: ISO8601
endTime = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
}
getMetricData_maxDatapoints :: Lens.Lens' GetMetricData (Prelude.Maybe Prelude.Int)
getMetricData_maxDatapoints :: (Maybe Int -> f (Maybe Int)) -> GetMetricData -> f GetMetricData
getMetricData_maxDatapoints = (GetMetricData -> Maybe Int)
-> (GetMetricData -> Maybe Int -> GetMetricData)
-> Lens GetMetricData GetMetricData (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Maybe Int
maxDatapoints :: Maybe Int
$sel:maxDatapoints:GetMetricData' :: GetMetricData -> Maybe Int
maxDatapoints} -> Maybe Int
maxDatapoints) (\s :: GetMetricData
s@GetMetricData' {} Maybe Int
a -> GetMetricData
s {$sel:maxDatapoints:GetMetricData' :: Maybe Int
maxDatapoints = Maybe Int
a} :: GetMetricData)
getMetricData_labelOptions :: Lens.Lens' GetMetricData (Prelude.Maybe LabelOptions)
getMetricData_labelOptions :: (Maybe LabelOptions -> f (Maybe LabelOptions))
-> GetMetricData -> f GetMetricData
getMetricData_labelOptions = (GetMetricData -> Maybe LabelOptions)
-> (GetMetricData -> Maybe LabelOptions -> GetMetricData)
-> Lens
GetMetricData
GetMetricData
(Maybe LabelOptions)
(Maybe LabelOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Maybe LabelOptions
labelOptions :: Maybe LabelOptions
$sel:labelOptions:GetMetricData' :: GetMetricData -> Maybe LabelOptions
labelOptions} -> Maybe LabelOptions
labelOptions) (\s :: GetMetricData
s@GetMetricData' {} Maybe LabelOptions
a -> GetMetricData
s {$sel:labelOptions:GetMetricData' :: Maybe LabelOptions
labelOptions = Maybe LabelOptions
a} :: GetMetricData)
getMetricData_nextToken :: Lens.Lens' GetMetricData (Prelude.Maybe Prelude.Text)
getMetricData_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetMetricData -> f GetMetricData
getMetricData_nextToken = (GetMetricData -> Maybe Text)
-> (GetMetricData -> Maybe Text -> GetMetricData)
-> Lens GetMetricData GetMetricData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetMetricData' :: GetMetricData -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetMetricData
s@GetMetricData' {} Maybe Text
a -> GetMetricData
s {$sel:nextToken:GetMetricData' :: Maybe Text
nextToken = Maybe Text
a} :: GetMetricData)
getMetricData_scanBy :: Lens.Lens' GetMetricData (Prelude.Maybe ScanBy)
getMetricData_scanBy :: (Maybe ScanBy -> f (Maybe ScanBy))
-> GetMetricData -> f GetMetricData
getMetricData_scanBy = (GetMetricData -> Maybe ScanBy)
-> (GetMetricData -> Maybe ScanBy -> GetMetricData)
-> Lens GetMetricData GetMetricData (Maybe ScanBy) (Maybe ScanBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Maybe ScanBy
scanBy :: Maybe ScanBy
$sel:scanBy:GetMetricData' :: GetMetricData -> Maybe ScanBy
scanBy} -> Maybe ScanBy
scanBy) (\s :: GetMetricData
s@GetMetricData' {} Maybe ScanBy
a -> GetMetricData
s {$sel:scanBy:GetMetricData' :: Maybe ScanBy
scanBy = Maybe ScanBy
a} :: GetMetricData)
getMetricData_metricDataQueries :: Lens.Lens' GetMetricData [MetricDataQuery]
getMetricData_metricDataQueries :: ([MetricDataQuery] -> f [MetricDataQuery])
-> GetMetricData -> f GetMetricData
getMetricData_metricDataQueries = (GetMetricData -> [MetricDataQuery])
-> (GetMetricData -> [MetricDataQuery] -> GetMetricData)
-> Lens
GetMetricData GetMetricData [MetricDataQuery] [MetricDataQuery]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:GetMetricData' :: GetMetricData -> [MetricDataQuery]
metricDataQueries} -> [MetricDataQuery]
metricDataQueries) (\s :: GetMetricData
s@GetMetricData' {} [MetricDataQuery]
a -> GetMetricData
s {$sel:metricDataQueries:GetMetricData' :: [MetricDataQuery]
metricDataQueries = [MetricDataQuery]
a} :: GetMetricData) (([MetricDataQuery] -> f [MetricDataQuery])
-> GetMetricData -> f GetMetricData)
-> (([MetricDataQuery] -> f [MetricDataQuery])
-> [MetricDataQuery] -> f [MetricDataQuery])
-> ([MetricDataQuery] -> f [MetricDataQuery])
-> GetMetricData
-> f GetMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MetricDataQuery] -> f [MetricDataQuery])
-> [MetricDataQuery] -> f [MetricDataQuery]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricData_startTime :: Lens.Lens' GetMetricData Prelude.UTCTime
getMetricData_startTime :: (UTCTime -> f UTCTime) -> GetMetricData -> f GetMetricData
getMetricData_startTime = (GetMetricData -> ISO8601)
-> (GetMetricData -> ISO8601 -> GetMetricData)
-> Lens GetMetricData GetMetricData ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {ISO8601
startTime :: ISO8601
$sel:startTime:GetMetricData' :: GetMetricData -> ISO8601
startTime} -> ISO8601
startTime) (\s :: GetMetricData
s@GetMetricData' {} ISO8601
a -> GetMetricData
s {$sel:startTime:GetMetricData' :: ISO8601
startTime = ISO8601
a} :: GetMetricData) ((ISO8601 -> f ISO8601) -> GetMetricData -> f GetMetricData)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> GetMetricData
-> f GetMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
getMetricData_endTime :: Lens.Lens' GetMetricData Prelude.UTCTime
getMetricData_endTime :: (UTCTime -> f UTCTime) -> GetMetricData -> f GetMetricData
getMetricData_endTime = (GetMetricData -> ISO8601)
-> (GetMetricData -> ISO8601 -> GetMetricData)
-> Lens GetMetricData GetMetricData ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {ISO8601
endTime :: ISO8601
$sel:endTime:GetMetricData' :: GetMetricData -> ISO8601
endTime} -> ISO8601
endTime) (\s :: GetMetricData
s@GetMetricData' {} ISO8601
a -> GetMetricData
s {$sel:endTime:GetMetricData' :: ISO8601
endTime = ISO8601
a} :: GetMetricData) ((ISO8601 -> f ISO8601) -> GetMetricData -> f GetMetricData)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> GetMetricData
-> f GetMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.AWSPager GetMetricData where
page :: GetMetricData -> AWSResponse GetMetricData -> Maybe GetMetricData
page GetMetricData
rq AWSResponse GetMetricData
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetMetricData
GetMetricDataResponse
rs
GetMetricDataResponse
-> Getting (First Text) GetMetricDataResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetMetricDataResponse
-> Const (First Text) GetMetricDataResponse
Lens' GetMetricDataResponse (Maybe Text)
getMetricDataResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetMetricDataResponse
-> Const (First Text) GetMetricDataResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetMetricDataResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetMetricData
forall a. Maybe a
Prelude.Nothing
| Maybe [MetricDataResult] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetMetricData
GetMetricDataResponse
rs
GetMetricDataResponse
-> Getting
(First [MetricDataResult]) GetMetricDataResponse [MetricDataResult]
-> Maybe [MetricDataResult]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [MetricDataResult]
-> Const (First [MetricDataResult]) (Maybe [MetricDataResult]))
-> GetMetricDataResponse
-> Const (First [MetricDataResult]) GetMetricDataResponse
Lens' GetMetricDataResponse (Maybe [MetricDataResult])
getMetricDataResponse_metricDataResults
((Maybe [MetricDataResult]
-> Const (First [MetricDataResult]) (Maybe [MetricDataResult]))
-> GetMetricDataResponse
-> Const (First [MetricDataResult]) GetMetricDataResponse)
-> (([MetricDataResult]
-> Const (First [MetricDataResult]) [MetricDataResult])
-> Maybe [MetricDataResult]
-> Const (First [MetricDataResult]) (Maybe [MetricDataResult]))
-> Getting
(First [MetricDataResult]) GetMetricDataResponse [MetricDataResult]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MetricDataResult]
-> Const (First [MetricDataResult]) [MetricDataResult])
-> Maybe [MetricDataResult]
-> Const (First [MetricDataResult]) (Maybe [MetricDataResult])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetMetricData
forall a. Maybe a
Prelude.Nothing
| Maybe [MessageData] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetMetricData
GetMetricDataResponse
rs
GetMetricDataResponse
-> Getting
(First [MessageData]) GetMetricDataResponse [MessageData]
-> Maybe [MessageData]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [MessageData]
-> Const (First [MessageData]) (Maybe [MessageData]))
-> GetMetricDataResponse
-> Const (First [MessageData]) GetMetricDataResponse
Lens' GetMetricDataResponse (Maybe [MessageData])
getMetricDataResponse_messages ((Maybe [MessageData]
-> Const (First [MessageData]) (Maybe [MessageData]))
-> GetMetricDataResponse
-> Const (First [MessageData]) GetMetricDataResponse)
-> (([MessageData] -> Const (First [MessageData]) [MessageData])
-> Maybe [MessageData]
-> Const (First [MessageData]) (Maybe [MessageData]))
-> Getting
(First [MessageData]) GetMetricDataResponse [MessageData]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MessageData] -> Const (First [MessageData]) [MessageData])
-> Maybe [MessageData]
-> Const (First [MessageData]) (Maybe [MessageData])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetMetricData
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
GetMetricData -> Maybe GetMetricData
forall a. a -> Maybe a
Prelude.Just (GetMetricData -> Maybe GetMetricData)
-> GetMetricData -> Maybe GetMetricData
forall a b. (a -> b) -> a -> b
Prelude.$
GetMetricData
rq
GetMetricData -> (GetMetricData -> GetMetricData) -> GetMetricData
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetMetricData -> Identity GetMetricData
Lens GetMetricData GetMetricData (Maybe Text) (Maybe Text)
getMetricData_nextToken
((Maybe Text -> Identity (Maybe Text))
-> GetMetricData -> Identity GetMetricData)
-> Maybe Text -> GetMetricData -> GetMetricData
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetMetricData
GetMetricDataResponse
rs
GetMetricDataResponse
-> Getting (First Text) GetMetricDataResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetMetricDataResponse
-> Const (First Text) GetMetricDataResponse
Lens' GetMetricDataResponse (Maybe Text)
getMetricDataResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetMetricDataResponse
-> Const (First Text) GetMetricDataResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetMetricDataResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetMetricData where
type
AWSResponse GetMetricData =
GetMetricDataResponse
request :: GetMetricData -> Request GetMetricData
request = Service -> GetMetricData -> Request GetMetricData
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetMetricData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMetricData)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetMetricData))
-> Logger
-> Service
-> Proxy GetMetricData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMetricData)))
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
"GetMetricDataResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [MetricDataResult]
-> Maybe Text
-> Maybe [MessageData]
-> Int
-> GetMetricDataResponse
GetMetricDataResponse'
(Maybe [MetricDataResult]
-> Maybe Text
-> Maybe [MessageData]
-> Int
-> GetMetricDataResponse)
-> Either String (Maybe [MetricDataResult])
-> Either
String
(Maybe Text -> Maybe [MessageData] -> Int -> GetMetricDataResponse)
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
"MetricDataResults"
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 [MetricDataResult]))
-> Either String (Maybe [MetricDataResult])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [MetricDataResult])
-> [Node] -> Either String (Maybe [MetricDataResult])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [MetricDataResult]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either
String
(Maybe Text -> Maybe [MessageData] -> Int -> GetMetricDataResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [MessageData] -> Int -> GetMetricDataResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
Either String (Maybe [MessageData] -> Int -> GetMetricDataResponse)
-> Either String (Maybe [MessageData])
-> Either String (Int -> GetMetricDataResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Messages" 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 [MessageData]))
-> Either String (Maybe [MessageData])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [MessageData])
-> [Node] -> Either String (Maybe [MessageData])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [MessageData]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> GetMetricDataResponse)
-> Either String Int -> Either String GetMetricDataResponse
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 GetMetricData
instance Prelude.NFData GetMetricData
instance Core.ToHeaders GetMetricData where
toHeaders :: GetMetricData -> ResponseHeaders
toHeaders = ResponseHeaders -> GetMetricData -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetMetricData where
toPath :: GetMetricData -> ByteString
toPath = ByteString -> GetMetricData -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetMetricData where
toQuery :: GetMetricData -> QueryString
toQuery GetMetricData' {[MetricDataQuery]
Maybe Int
Maybe Text
Maybe LabelOptions
Maybe ScanBy
ISO8601
endTime :: ISO8601
startTime :: ISO8601
metricDataQueries :: [MetricDataQuery]
scanBy :: Maybe ScanBy
nextToken :: Maybe Text
labelOptions :: Maybe LabelOptions
maxDatapoints :: Maybe Int
$sel:endTime:GetMetricData' :: GetMetricData -> ISO8601
$sel:startTime:GetMetricData' :: GetMetricData -> ISO8601
$sel:metricDataQueries:GetMetricData' :: GetMetricData -> [MetricDataQuery]
$sel:scanBy:GetMetricData' :: GetMetricData -> Maybe ScanBy
$sel:nextToken:GetMetricData' :: GetMetricData -> Maybe Text
$sel:labelOptions:GetMetricData' :: GetMetricData -> Maybe LabelOptions
$sel:maxDatapoints:GetMetricData' :: GetMetricData -> Maybe Int
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetMetricData" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"MaxDatapoints" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxDatapoints,
ByteString
"LabelOptions" ByteString -> Maybe LabelOptions -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe LabelOptions
labelOptions,
ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"ScanBy" ByteString -> Maybe ScanBy -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ScanBy
scanBy,
ByteString
"MetricDataQueries"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [MetricDataQuery] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [MetricDataQuery]
metricDataQueries,
ByteString
"StartTime" ByteString -> ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ISO8601
startTime,
ByteString
"EndTime" ByteString -> ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ISO8601
endTime
]
data GetMetricDataResponse = GetMetricDataResponse'
{
GetMetricDataResponse -> Maybe [MetricDataResult]
metricDataResults :: Prelude.Maybe [MetricDataResult],
GetMetricDataResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetMetricDataResponse -> Maybe [MessageData]
messages :: Prelude.Maybe [MessageData],
GetMetricDataResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMetricDataResponse -> GetMetricDataResponse -> Bool
(GetMetricDataResponse -> GetMetricDataResponse -> Bool)
-> (GetMetricDataResponse -> GetMetricDataResponse -> Bool)
-> Eq GetMetricDataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricDataResponse -> GetMetricDataResponse -> Bool
$c/= :: GetMetricDataResponse -> GetMetricDataResponse -> Bool
== :: GetMetricDataResponse -> GetMetricDataResponse -> Bool
$c== :: GetMetricDataResponse -> GetMetricDataResponse -> Bool
Prelude.Eq, ReadPrec [GetMetricDataResponse]
ReadPrec GetMetricDataResponse
Int -> ReadS GetMetricDataResponse
ReadS [GetMetricDataResponse]
(Int -> ReadS GetMetricDataResponse)
-> ReadS [GetMetricDataResponse]
-> ReadPrec GetMetricDataResponse
-> ReadPrec [GetMetricDataResponse]
-> Read GetMetricDataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricDataResponse]
$creadListPrec :: ReadPrec [GetMetricDataResponse]
readPrec :: ReadPrec GetMetricDataResponse
$creadPrec :: ReadPrec GetMetricDataResponse
readList :: ReadS [GetMetricDataResponse]
$creadList :: ReadS [GetMetricDataResponse]
readsPrec :: Int -> ReadS GetMetricDataResponse
$creadsPrec :: Int -> ReadS GetMetricDataResponse
Prelude.Read, Int -> GetMetricDataResponse -> ShowS
[GetMetricDataResponse] -> ShowS
GetMetricDataResponse -> String
(Int -> GetMetricDataResponse -> ShowS)
-> (GetMetricDataResponse -> String)
-> ([GetMetricDataResponse] -> ShowS)
-> Show GetMetricDataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricDataResponse] -> ShowS
$cshowList :: [GetMetricDataResponse] -> ShowS
show :: GetMetricDataResponse -> String
$cshow :: GetMetricDataResponse -> String
showsPrec :: Int -> GetMetricDataResponse -> ShowS
$cshowsPrec :: Int -> GetMetricDataResponse -> ShowS
Prelude.Show, (forall x. GetMetricDataResponse -> Rep GetMetricDataResponse x)
-> (forall x. Rep GetMetricDataResponse x -> GetMetricDataResponse)
-> Generic GetMetricDataResponse
forall x. Rep GetMetricDataResponse x -> GetMetricDataResponse
forall x. GetMetricDataResponse -> Rep GetMetricDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMetricDataResponse x -> GetMetricDataResponse
$cfrom :: forall x. GetMetricDataResponse -> Rep GetMetricDataResponse x
Prelude.Generic)
newGetMetricDataResponse ::
Prelude.Int ->
GetMetricDataResponse
newGetMetricDataResponse :: Int -> GetMetricDataResponse
newGetMetricDataResponse Int
pHttpStatus_ =
GetMetricDataResponse' :: Maybe [MetricDataResult]
-> Maybe Text
-> Maybe [MessageData]
-> Int
-> GetMetricDataResponse
GetMetricDataResponse'
{ $sel:metricDataResults:GetMetricDataResponse' :: Maybe [MetricDataResult]
metricDataResults =
Maybe [MetricDataResult]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetMetricDataResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:messages:GetMetricDataResponse' :: Maybe [MessageData]
messages = Maybe [MessageData]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMetricDataResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMetricDataResponse_metricDataResults :: Lens.Lens' GetMetricDataResponse (Prelude.Maybe [MetricDataResult])
getMetricDataResponse_metricDataResults :: (Maybe [MetricDataResult] -> f (Maybe [MetricDataResult]))
-> GetMetricDataResponse -> f GetMetricDataResponse
getMetricDataResponse_metricDataResults = (GetMetricDataResponse -> Maybe [MetricDataResult])
-> (GetMetricDataResponse
-> Maybe [MetricDataResult] -> GetMetricDataResponse)
-> Lens' GetMetricDataResponse (Maybe [MetricDataResult])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricDataResponse' {Maybe [MetricDataResult]
metricDataResults :: Maybe [MetricDataResult]
$sel:metricDataResults:GetMetricDataResponse' :: GetMetricDataResponse -> Maybe [MetricDataResult]
metricDataResults} -> Maybe [MetricDataResult]
metricDataResults) (\s :: GetMetricDataResponse
s@GetMetricDataResponse' {} Maybe [MetricDataResult]
a -> GetMetricDataResponse
s {$sel:metricDataResults:GetMetricDataResponse' :: Maybe [MetricDataResult]
metricDataResults = Maybe [MetricDataResult]
a} :: GetMetricDataResponse) ((Maybe [MetricDataResult] -> f (Maybe [MetricDataResult]))
-> GetMetricDataResponse -> f GetMetricDataResponse)
-> ((Maybe [MetricDataResult] -> f (Maybe [MetricDataResult]))
-> Maybe [MetricDataResult] -> f (Maybe [MetricDataResult]))
-> (Maybe [MetricDataResult] -> f (Maybe [MetricDataResult]))
-> GetMetricDataResponse
-> f GetMetricDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetricDataResult]
[MetricDataResult]
[MetricDataResult]
[MetricDataResult]
-> Iso
(Maybe [MetricDataResult])
(Maybe [MetricDataResult])
(Maybe [MetricDataResult])
(Maybe [MetricDataResult])
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
[MetricDataResult]
[MetricDataResult]
[MetricDataResult]
[MetricDataResult]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricDataResponse_nextToken :: Lens.Lens' GetMetricDataResponse (Prelude.Maybe Prelude.Text)
getMetricDataResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetMetricDataResponse -> f GetMetricDataResponse
getMetricDataResponse_nextToken = (GetMetricDataResponse -> Maybe Text)
-> (GetMetricDataResponse -> Maybe Text -> GetMetricDataResponse)
-> Lens' GetMetricDataResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricDataResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetMetricDataResponse' :: GetMetricDataResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetMetricDataResponse
s@GetMetricDataResponse' {} Maybe Text
a -> GetMetricDataResponse
s {$sel:nextToken:GetMetricDataResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetMetricDataResponse)
getMetricDataResponse_messages :: Lens.Lens' GetMetricDataResponse (Prelude.Maybe [MessageData])
getMetricDataResponse_messages :: (Maybe [MessageData] -> f (Maybe [MessageData]))
-> GetMetricDataResponse -> f GetMetricDataResponse
getMetricDataResponse_messages = (GetMetricDataResponse -> Maybe [MessageData])
-> (GetMetricDataResponse
-> Maybe [MessageData] -> GetMetricDataResponse)
-> Lens' GetMetricDataResponse (Maybe [MessageData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricDataResponse' {Maybe [MessageData]
messages :: Maybe [MessageData]
$sel:messages:GetMetricDataResponse' :: GetMetricDataResponse -> Maybe [MessageData]
messages} -> Maybe [MessageData]
messages) (\s :: GetMetricDataResponse
s@GetMetricDataResponse' {} Maybe [MessageData]
a -> GetMetricDataResponse
s {$sel:messages:GetMetricDataResponse' :: Maybe [MessageData]
messages = Maybe [MessageData]
a} :: GetMetricDataResponse) ((Maybe [MessageData] -> f (Maybe [MessageData]))
-> GetMetricDataResponse -> f GetMetricDataResponse)
-> ((Maybe [MessageData] -> f (Maybe [MessageData]))
-> Maybe [MessageData] -> f (Maybe [MessageData]))
-> (Maybe [MessageData] -> f (Maybe [MessageData]))
-> GetMetricDataResponse
-> f GetMetricDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MessageData] [MessageData] [MessageData] [MessageData]
-> Iso
(Maybe [MessageData])
(Maybe [MessageData])
(Maybe [MessageData])
(Maybe [MessageData])
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 [MessageData] [MessageData] [MessageData] [MessageData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricDataResponse_httpStatus :: Lens.Lens' GetMetricDataResponse Prelude.Int
getMetricDataResponse_httpStatus :: (Int -> f Int) -> GetMetricDataResponse -> f GetMetricDataResponse
getMetricDataResponse_httpStatus = (GetMetricDataResponse -> Int)
-> (GetMetricDataResponse -> Int -> GetMetricDataResponse)
-> Lens GetMetricDataResponse GetMetricDataResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricDataResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMetricDataResponse' :: GetMetricDataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMetricDataResponse
s@GetMetricDataResponse' {} Int
a -> GetMetricDataResponse
s {$sel:httpStatus:GetMetricDataResponse' :: Int
httpStatus = Int
a} :: GetMetricDataResponse)
instance Prelude.NFData GetMetricDataResponse