{-# 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.GetMetricStatistics
(
GetMetricStatistics (..),
newGetMetricStatistics,
getMetricStatistics_extendedStatistics,
getMetricStatistics_statistics,
getMetricStatistics_dimensions,
getMetricStatistics_unit,
getMetricStatistics_namespace,
getMetricStatistics_metricName,
getMetricStatistics_startTime,
getMetricStatistics_endTime,
getMetricStatistics_period,
GetMetricStatisticsResponse (..),
newGetMetricStatisticsResponse,
getMetricStatisticsResponse_datapoints,
getMetricStatisticsResponse_label,
getMetricStatisticsResponse_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 GetMetricStatistics = GetMetricStatistics'
{
GetMetricStatistics -> Maybe (NonEmpty Text)
extendedStatistics :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
GetMetricStatistics -> Maybe (NonEmpty Statistic)
statistics :: Prelude.Maybe (Prelude.NonEmpty Statistic),
GetMetricStatistics -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
GetMetricStatistics -> Maybe StandardUnit
unit :: Prelude.Maybe StandardUnit,
GetMetricStatistics -> Text
namespace :: Prelude.Text,
GetMetricStatistics -> Text
metricName :: Prelude.Text,
GetMetricStatistics -> ISO8601
startTime :: Core.ISO8601,
GetMetricStatistics -> ISO8601
endTime :: Core.ISO8601,
GetMetricStatistics -> Natural
period :: Prelude.Natural
}
deriving (GetMetricStatistics -> GetMetricStatistics -> Bool
(GetMetricStatistics -> GetMetricStatistics -> Bool)
-> (GetMetricStatistics -> GetMetricStatistics -> Bool)
-> Eq GetMetricStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricStatistics -> GetMetricStatistics -> Bool
$c/= :: GetMetricStatistics -> GetMetricStatistics -> Bool
== :: GetMetricStatistics -> GetMetricStatistics -> Bool
$c== :: GetMetricStatistics -> GetMetricStatistics -> Bool
Prelude.Eq, ReadPrec [GetMetricStatistics]
ReadPrec GetMetricStatistics
Int -> ReadS GetMetricStatistics
ReadS [GetMetricStatistics]
(Int -> ReadS GetMetricStatistics)
-> ReadS [GetMetricStatistics]
-> ReadPrec GetMetricStatistics
-> ReadPrec [GetMetricStatistics]
-> Read GetMetricStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricStatistics]
$creadListPrec :: ReadPrec [GetMetricStatistics]
readPrec :: ReadPrec GetMetricStatistics
$creadPrec :: ReadPrec GetMetricStatistics
readList :: ReadS [GetMetricStatistics]
$creadList :: ReadS [GetMetricStatistics]
readsPrec :: Int -> ReadS GetMetricStatistics
$creadsPrec :: Int -> ReadS GetMetricStatistics
Prelude.Read, Int -> GetMetricStatistics -> ShowS
[GetMetricStatistics] -> ShowS
GetMetricStatistics -> String
(Int -> GetMetricStatistics -> ShowS)
-> (GetMetricStatistics -> String)
-> ([GetMetricStatistics] -> ShowS)
-> Show GetMetricStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricStatistics] -> ShowS
$cshowList :: [GetMetricStatistics] -> ShowS
show :: GetMetricStatistics -> String
$cshow :: GetMetricStatistics -> String
showsPrec :: Int -> GetMetricStatistics -> ShowS
$cshowsPrec :: Int -> GetMetricStatistics -> ShowS
Prelude.Show, (forall x. GetMetricStatistics -> Rep GetMetricStatistics x)
-> (forall x. Rep GetMetricStatistics x -> GetMetricStatistics)
-> Generic GetMetricStatistics
forall x. Rep GetMetricStatistics x -> GetMetricStatistics
forall x. GetMetricStatistics -> Rep GetMetricStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMetricStatistics x -> GetMetricStatistics
$cfrom :: forall x. GetMetricStatistics -> Rep GetMetricStatistics x
Prelude.Generic)
newGetMetricStatistics ::
Prelude.Text ->
Prelude.Text ->
Prelude.UTCTime ->
Prelude.UTCTime ->
Prelude.Natural ->
GetMetricStatistics
newGetMetricStatistics :: Text
-> Text -> UTCTime -> UTCTime -> Natural -> GetMetricStatistics
newGetMetricStatistics
Text
pNamespace_
Text
pMetricName_
UTCTime
pStartTime_
UTCTime
pEndTime_
Natural
pPeriod_ =
GetMetricStatistics' :: Maybe (NonEmpty Text)
-> Maybe (NonEmpty Statistic)
-> Maybe [Dimension]
-> Maybe StandardUnit
-> Text
-> Text
-> ISO8601
-> ISO8601
-> Natural
-> GetMetricStatistics
GetMetricStatistics'
{ $sel:extendedStatistics:GetMetricStatistics' :: Maybe (NonEmpty Text)
extendedStatistics =
Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:statistics:GetMetricStatistics' :: Maybe (NonEmpty Statistic)
statistics = Maybe (NonEmpty Statistic)
forall a. Maybe a
Prelude.Nothing,
$sel:dimensions:GetMetricStatistics' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
forall a. Maybe a
Prelude.Nothing,
$sel:unit:GetMetricStatistics' :: Maybe StandardUnit
unit = Maybe StandardUnit
forall a. Maybe a
Prelude.Nothing,
$sel:namespace:GetMetricStatistics' :: Text
namespace = Text
pNamespace_,
$sel:metricName:GetMetricStatistics' :: Text
metricName = Text
pMetricName_,
$sel:startTime:GetMetricStatistics' :: 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:GetMetricStatistics' :: 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_,
$sel:period:GetMetricStatistics' :: Natural
period = Natural
pPeriod_
}
getMetricStatistics_extendedStatistics :: Lens.Lens' GetMetricStatistics (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
getMetricStatistics_extendedStatistics :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_extendedStatistics = (GetMetricStatistics -> Maybe (NonEmpty Text))
-> (GetMetricStatistics
-> Maybe (NonEmpty Text) -> GetMetricStatistics)
-> Lens
GetMetricStatistics
GetMetricStatistics
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe (NonEmpty Text)
extendedStatistics :: Maybe (NonEmpty Text)
$sel:extendedStatistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Text)
extendedStatistics} -> Maybe (NonEmpty Text)
extendedStatistics) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe (NonEmpty Text)
a -> GetMetricStatistics
s {$sel:extendedStatistics:GetMetricStatistics' :: Maybe (NonEmpty Text)
extendedStatistics = Maybe (NonEmpty Text)
a} :: GetMetricStatistics) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetMetricStatistics -> f GetMetricStatistics)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetMetricStatistics
-> f GetMetricStatistics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
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
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricStatistics_statistics :: Lens.Lens' GetMetricStatistics (Prelude.Maybe (Prelude.NonEmpty Statistic))
getMetricStatistics_statistics :: (Maybe (NonEmpty Statistic) -> f (Maybe (NonEmpty Statistic)))
-> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_statistics = (GetMetricStatistics -> Maybe (NonEmpty Statistic))
-> (GetMetricStatistics
-> Maybe (NonEmpty Statistic) -> GetMetricStatistics)
-> Lens
GetMetricStatistics
GetMetricStatistics
(Maybe (NonEmpty Statistic))
(Maybe (NonEmpty Statistic))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe (NonEmpty Statistic)
statistics :: Maybe (NonEmpty Statistic)
$sel:statistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Statistic)
statistics} -> Maybe (NonEmpty Statistic)
statistics) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe (NonEmpty Statistic)
a -> GetMetricStatistics
s {$sel:statistics:GetMetricStatistics' :: Maybe (NonEmpty Statistic)
statistics = Maybe (NonEmpty Statistic)
a} :: GetMetricStatistics) ((Maybe (NonEmpty Statistic) -> f (Maybe (NonEmpty Statistic)))
-> GetMetricStatistics -> f GetMetricStatistics)
-> ((Maybe (NonEmpty Statistic) -> f (Maybe (NonEmpty Statistic)))
-> Maybe (NonEmpty Statistic) -> f (Maybe (NonEmpty Statistic)))
-> (Maybe (NonEmpty Statistic) -> f (Maybe (NonEmpty Statistic)))
-> GetMetricStatistics
-> f GetMetricStatistics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Statistic)
(NonEmpty Statistic)
(NonEmpty Statistic)
(NonEmpty Statistic)
-> Iso
(Maybe (NonEmpty Statistic))
(Maybe (NonEmpty Statistic))
(Maybe (NonEmpty Statistic))
(Maybe (NonEmpty Statistic))
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
(NonEmpty Statistic)
(NonEmpty Statistic)
(NonEmpty Statistic)
(NonEmpty Statistic)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricStatistics_dimensions :: Lens.Lens' GetMetricStatistics (Prelude.Maybe [Dimension])
getMetricStatistics_dimensions :: (Maybe [Dimension] -> f (Maybe [Dimension]))
-> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_dimensions = (GetMetricStatistics -> Maybe [Dimension])
-> (GetMetricStatistics
-> Maybe [Dimension] -> GetMetricStatistics)
-> Lens
GetMetricStatistics
GetMetricStatistics
(Maybe [Dimension])
(Maybe [Dimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:GetMetricStatistics' :: GetMetricStatistics -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe [Dimension]
a -> GetMetricStatistics
s {$sel:dimensions:GetMetricStatistics' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: GetMetricStatistics) ((Maybe [Dimension] -> f (Maybe [Dimension]))
-> GetMetricStatistics -> f GetMetricStatistics)
-> ((Maybe [Dimension] -> f (Maybe [Dimension]))
-> Maybe [Dimension] -> f (Maybe [Dimension]))
-> (Maybe [Dimension] -> f (Maybe [Dimension]))
-> GetMetricStatistics
-> f GetMetricStatistics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Dimension] [Dimension] [Dimension] [Dimension]
-> Iso
(Maybe [Dimension])
(Maybe [Dimension])
(Maybe [Dimension])
(Maybe [Dimension])
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 [Dimension] [Dimension] [Dimension] [Dimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricStatistics_unit :: Lens.Lens' GetMetricStatistics (Prelude.Maybe StandardUnit)
getMetricStatistics_unit :: (Maybe StandardUnit -> f (Maybe StandardUnit))
-> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_unit = (GetMetricStatistics -> Maybe StandardUnit)
-> (GetMetricStatistics
-> Maybe StandardUnit -> GetMetricStatistics)
-> Lens
GetMetricStatistics
GetMetricStatistics
(Maybe StandardUnit)
(Maybe StandardUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Maybe StandardUnit
unit :: Maybe StandardUnit
$sel:unit:GetMetricStatistics' :: GetMetricStatistics -> Maybe StandardUnit
unit} -> Maybe StandardUnit
unit) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Maybe StandardUnit
a -> GetMetricStatistics
s {$sel:unit:GetMetricStatistics' :: Maybe StandardUnit
unit = Maybe StandardUnit
a} :: GetMetricStatistics)
getMetricStatistics_namespace :: Lens.Lens' GetMetricStatistics Prelude.Text
getMetricStatistics_namespace :: (Text -> f Text) -> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_namespace = (GetMetricStatistics -> Text)
-> (GetMetricStatistics -> Text -> GetMetricStatistics)
-> Lens GetMetricStatistics GetMetricStatistics Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Text
namespace :: Text
$sel:namespace:GetMetricStatistics' :: GetMetricStatistics -> Text
namespace} -> Text
namespace) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Text
a -> GetMetricStatistics
s {$sel:namespace:GetMetricStatistics' :: Text
namespace = Text
a} :: GetMetricStatistics)
getMetricStatistics_metricName :: Lens.Lens' GetMetricStatistics Prelude.Text
getMetricStatistics_metricName :: (Text -> f Text) -> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_metricName = (GetMetricStatistics -> Text)
-> (GetMetricStatistics -> Text -> GetMetricStatistics)
-> Lens GetMetricStatistics GetMetricStatistics Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Text
metricName :: Text
$sel:metricName:GetMetricStatistics' :: GetMetricStatistics -> Text
metricName} -> Text
metricName) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Text
a -> GetMetricStatistics
s {$sel:metricName:GetMetricStatistics' :: Text
metricName = Text
a} :: GetMetricStatistics)
getMetricStatistics_startTime :: Lens.Lens' GetMetricStatistics Prelude.UTCTime
getMetricStatistics_startTime :: (UTCTime -> f UTCTime)
-> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_startTime = (GetMetricStatistics -> ISO8601)
-> (GetMetricStatistics -> ISO8601 -> GetMetricStatistics)
-> Lens GetMetricStatistics GetMetricStatistics ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {ISO8601
startTime :: ISO8601
$sel:startTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
startTime} -> ISO8601
startTime) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} ISO8601
a -> GetMetricStatistics
s {$sel:startTime:GetMetricStatistics' :: ISO8601
startTime = ISO8601
a} :: GetMetricStatistics) ((ISO8601 -> f ISO8601)
-> GetMetricStatistics -> f GetMetricStatistics)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> GetMetricStatistics
-> f GetMetricStatistics
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
getMetricStatistics_endTime :: Lens.Lens' GetMetricStatistics Prelude.UTCTime
getMetricStatistics_endTime :: (UTCTime -> f UTCTime)
-> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_endTime = (GetMetricStatistics -> ISO8601)
-> (GetMetricStatistics -> ISO8601 -> GetMetricStatistics)
-> Lens GetMetricStatistics GetMetricStatistics ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {ISO8601
endTime :: ISO8601
$sel:endTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
endTime} -> ISO8601
endTime) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} ISO8601
a -> GetMetricStatistics
s {$sel:endTime:GetMetricStatistics' :: ISO8601
endTime = ISO8601
a} :: GetMetricStatistics) ((ISO8601 -> f ISO8601)
-> GetMetricStatistics -> f GetMetricStatistics)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> GetMetricStatistics
-> f GetMetricStatistics
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
getMetricStatistics_period :: Lens.Lens' GetMetricStatistics Prelude.Natural
getMetricStatistics_period :: (Natural -> f Natural)
-> GetMetricStatistics -> f GetMetricStatistics
getMetricStatistics_period = (GetMetricStatistics -> Natural)
-> (GetMetricStatistics -> Natural -> GetMetricStatistics)
-> Lens GetMetricStatistics GetMetricStatistics Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatistics' {Natural
period :: Natural
$sel:period:GetMetricStatistics' :: GetMetricStatistics -> Natural
period} -> Natural
period) (\s :: GetMetricStatistics
s@GetMetricStatistics' {} Natural
a -> GetMetricStatistics
s {$sel:period:GetMetricStatistics' :: Natural
period = Natural
a} :: GetMetricStatistics)
instance Core.AWSRequest GetMetricStatistics where
type
AWSResponse GetMetricStatistics =
GetMetricStatisticsResponse
request :: GetMetricStatistics -> Request GetMetricStatistics
request = Service -> GetMetricStatistics -> Request GetMetricStatistics
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetMetricStatistics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMetricStatistics)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetMetricStatistics))
-> Logger
-> Service
-> Proxy GetMetricStatistics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMetricStatistics)))
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
"GetMetricStatisticsResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [Datapoint]
-> Maybe Text -> Int -> GetMetricStatisticsResponse
GetMetricStatisticsResponse'
(Maybe [Datapoint]
-> Maybe Text -> Int -> GetMetricStatisticsResponse)
-> Either String (Maybe [Datapoint])
-> Either String (Maybe Text -> Int -> GetMetricStatisticsResponse)
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
"Datapoints" 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 [Datapoint]))
-> Either String (Maybe [Datapoint])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Datapoint])
-> [Node] -> Either String (Maybe [Datapoint])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Datapoint]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> Int -> GetMetricStatisticsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetMetricStatisticsResponse)
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
"Label")
Either String (Int -> GetMetricStatisticsResponse)
-> Either String Int -> Either String GetMetricStatisticsResponse
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 GetMetricStatistics
instance Prelude.NFData GetMetricStatistics
instance Core.ToHeaders GetMetricStatistics where
toHeaders :: GetMetricStatistics -> ResponseHeaders
toHeaders = ResponseHeaders -> GetMetricStatistics -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetMetricStatistics where
toPath :: GetMetricStatistics -> ByteString
toPath = ByteString -> GetMetricStatistics -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetMetricStatistics where
toQuery :: GetMetricStatistics -> QueryString
toQuery GetMetricStatistics' {Natural
Maybe [Dimension]
Maybe (NonEmpty Text)
Maybe (NonEmpty Statistic)
Maybe StandardUnit
Text
ISO8601
period :: Natural
endTime :: ISO8601
startTime :: ISO8601
metricName :: Text
namespace :: Text
unit :: Maybe StandardUnit
dimensions :: Maybe [Dimension]
statistics :: Maybe (NonEmpty Statistic)
extendedStatistics :: Maybe (NonEmpty Text)
$sel:period:GetMetricStatistics' :: GetMetricStatistics -> Natural
$sel:endTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:startTime:GetMetricStatistics' :: GetMetricStatistics -> ISO8601
$sel:metricName:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:namespace:GetMetricStatistics' :: GetMetricStatistics -> Text
$sel:unit:GetMetricStatistics' :: GetMetricStatistics -> Maybe StandardUnit
$sel:dimensions:GetMetricStatistics' :: GetMetricStatistics -> Maybe [Dimension]
$sel:statistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty Statistic)
$sel:extendedStatistics:GetMetricStatistics' :: GetMetricStatistics -> Maybe (NonEmpty 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
"GetMetricStatistics" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"ExtendedStatistics"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
( ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
(NonEmpty Text -> QueryString)
-> Maybe (NonEmpty Text) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
extendedStatistics
),
ByteString
"Statistics"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> NonEmpty Statistic -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" (NonEmpty Statistic -> QueryString)
-> Maybe (NonEmpty Statistic) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Statistic)
statistics),
ByteString
"Dimensions"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Dimension] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Dimension] -> QueryString)
-> Maybe [Dimension] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Dimension]
dimensions),
ByteString
"Unit" ByteString -> Maybe StandardUnit -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe StandardUnit
unit,
ByteString
"Namespace" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
namespace,
ByteString
"MetricName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
metricName,
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,
ByteString
"Period" ByteString -> Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Natural
period
]
data GetMetricStatisticsResponse = GetMetricStatisticsResponse'
{
GetMetricStatisticsResponse -> Maybe [Datapoint]
datapoints :: Prelude.Maybe [Datapoint],
GetMetricStatisticsResponse -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
GetMetricStatisticsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMetricStatisticsResponse -> GetMetricStatisticsResponse -> Bool
(GetMetricStatisticsResponse
-> GetMetricStatisticsResponse -> Bool)
-> (GetMetricStatisticsResponse
-> GetMetricStatisticsResponse -> Bool)
-> Eq GetMetricStatisticsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricStatisticsResponse -> GetMetricStatisticsResponse -> Bool
$c/= :: GetMetricStatisticsResponse -> GetMetricStatisticsResponse -> Bool
== :: GetMetricStatisticsResponse -> GetMetricStatisticsResponse -> Bool
$c== :: GetMetricStatisticsResponse -> GetMetricStatisticsResponse -> Bool
Prelude.Eq, ReadPrec [GetMetricStatisticsResponse]
ReadPrec GetMetricStatisticsResponse
Int -> ReadS GetMetricStatisticsResponse
ReadS [GetMetricStatisticsResponse]
(Int -> ReadS GetMetricStatisticsResponse)
-> ReadS [GetMetricStatisticsResponse]
-> ReadPrec GetMetricStatisticsResponse
-> ReadPrec [GetMetricStatisticsResponse]
-> Read GetMetricStatisticsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricStatisticsResponse]
$creadListPrec :: ReadPrec [GetMetricStatisticsResponse]
readPrec :: ReadPrec GetMetricStatisticsResponse
$creadPrec :: ReadPrec GetMetricStatisticsResponse
readList :: ReadS [GetMetricStatisticsResponse]
$creadList :: ReadS [GetMetricStatisticsResponse]
readsPrec :: Int -> ReadS GetMetricStatisticsResponse
$creadsPrec :: Int -> ReadS GetMetricStatisticsResponse
Prelude.Read, Int -> GetMetricStatisticsResponse -> ShowS
[GetMetricStatisticsResponse] -> ShowS
GetMetricStatisticsResponse -> String
(Int -> GetMetricStatisticsResponse -> ShowS)
-> (GetMetricStatisticsResponse -> String)
-> ([GetMetricStatisticsResponse] -> ShowS)
-> Show GetMetricStatisticsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricStatisticsResponse] -> ShowS
$cshowList :: [GetMetricStatisticsResponse] -> ShowS
show :: GetMetricStatisticsResponse -> String
$cshow :: GetMetricStatisticsResponse -> String
showsPrec :: Int -> GetMetricStatisticsResponse -> ShowS
$cshowsPrec :: Int -> GetMetricStatisticsResponse -> ShowS
Prelude.Show, (forall x.
GetMetricStatisticsResponse -> Rep GetMetricStatisticsResponse x)
-> (forall x.
Rep GetMetricStatisticsResponse x -> GetMetricStatisticsResponse)
-> Generic GetMetricStatisticsResponse
forall x.
Rep GetMetricStatisticsResponse x -> GetMetricStatisticsResponse
forall x.
GetMetricStatisticsResponse -> Rep GetMetricStatisticsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMetricStatisticsResponse x -> GetMetricStatisticsResponse
$cfrom :: forall x.
GetMetricStatisticsResponse -> Rep GetMetricStatisticsResponse x
Prelude.Generic)
newGetMetricStatisticsResponse ::
Prelude.Int ->
GetMetricStatisticsResponse
newGetMetricStatisticsResponse :: Int -> GetMetricStatisticsResponse
newGetMetricStatisticsResponse Int
pHttpStatus_ =
GetMetricStatisticsResponse' :: Maybe [Datapoint]
-> Maybe Text -> Int -> GetMetricStatisticsResponse
GetMetricStatisticsResponse'
{ $sel:datapoints:GetMetricStatisticsResponse' :: Maybe [Datapoint]
datapoints =
Maybe [Datapoint]
forall a. Maybe a
Prelude.Nothing,
$sel:label:GetMetricStatisticsResponse' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMetricStatisticsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMetricStatisticsResponse_datapoints :: Lens.Lens' GetMetricStatisticsResponse (Prelude.Maybe [Datapoint])
getMetricStatisticsResponse_datapoints :: (Maybe [Datapoint] -> f (Maybe [Datapoint]))
-> GetMetricStatisticsResponse -> f GetMetricStatisticsResponse
getMetricStatisticsResponse_datapoints = (GetMetricStatisticsResponse -> Maybe [Datapoint])
-> (GetMetricStatisticsResponse
-> Maybe [Datapoint] -> GetMetricStatisticsResponse)
-> Lens
GetMetricStatisticsResponse
GetMetricStatisticsResponse
(Maybe [Datapoint])
(Maybe [Datapoint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatisticsResponse' {Maybe [Datapoint]
datapoints :: Maybe [Datapoint]
$sel:datapoints:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Maybe [Datapoint]
datapoints} -> Maybe [Datapoint]
datapoints) (\s :: GetMetricStatisticsResponse
s@GetMetricStatisticsResponse' {} Maybe [Datapoint]
a -> GetMetricStatisticsResponse
s {$sel:datapoints:GetMetricStatisticsResponse' :: Maybe [Datapoint]
datapoints = Maybe [Datapoint]
a} :: GetMetricStatisticsResponse) ((Maybe [Datapoint] -> f (Maybe [Datapoint]))
-> GetMetricStatisticsResponse -> f GetMetricStatisticsResponse)
-> ((Maybe [Datapoint] -> f (Maybe [Datapoint]))
-> Maybe [Datapoint] -> f (Maybe [Datapoint]))
-> (Maybe [Datapoint] -> f (Maybe [Datapoint]))
-> GetMetricStatisticsResponse
-> f GetMetricStatisticsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Datapoint] [Datapoint] [Datapoint] [Datapoint]
-> Iso
(Maybe [Datapoint])
(Maybe [Datapoint])
(Maybe [Datapoint])
(Maybe [Datapoint])
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 [Datapoint] [Datapoint] [Datapoint] [Datapoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricStatisticsResponse_label :: Lens.Lens' GetMetricStatisticsResponse (Prelude.Maybe Prelude.Text)
getMetricStatisticsResponse_label :: (Maybe Text -> f (Maybe Text))
-> GetMetricStatisticsResponse -> f GetMetricStatisticsResponse
getMetricStatisticsResponse_label = (GetMetricStatisticsResponse -> Maybe Text)
-> (GetMetricStatisticsResponse
-> Maybe Text -> GetMetricStatisticsResponse)
-> Lens
GetMetricStatisticsResponse
GetMetricStatisticsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatisticsResponse' {Maybe Text
label :: Maybe Text
$sel:label:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Maybe Text
label} -> Maybe Text
label) (\s :: GetMetricStatisticsResponse
s@GetMetricStatisticsResponse' {} Maybe Text
a -> GetMetricStatisticsResponse
s {$sel:label:GetMetricStatisticsResponse' :: Maybe Text
label = Maybe Text
a} :: GetMetricStatisticsResponse)
getMetricStatisticsResponse_httpStatus :: Lens.Lens' GetMetricStatisticsResponse Prelude.Int
getMetricStatisticsResponse_httpStatus :: (Int -> f Int)
-> GetMetricStatisticsResponse -> f GetMetricStatisticsResponse
getMetricStatisticsResponse_httpStatus = (GetMetricStatisticsResponse -> Int)
-> (GetMetricStatisticsResponse
-> Int -> GetMetricStatisticsResponse)
-> Lens
GetMetricStatisticsResponse GetMetricStatisticsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricStatisticsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMetricStatisticsResponse' :: GetMetricStatisticsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMetricStatisticsResponse
s@GetMetricStatisticsResponse' {} Int
a -> GetMetricStatisticsResponse
s {$sel:httpStatus:GetMetricStatisticsResponse' :: Int
httpStatus = Int
a} :: GetMetricStatisticsResponse)
instance Prelude.NFData GetMetricStatisticsResponse