{-# 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.Connect.GetMetricData
(
GetMetricData (..),
newGetMetricData,
getMetricData_nextToken,
getMetricData_groupings,
getMetricData_maxResults,
getMetricData_instanceId,
getMetricData_startTime,
getMetricData_endTime,
getMetricData_filters,
getMetricData_historicalMetrics,
GetMetricDataResponse (..),
newGetMetricDataResponse,
getMetricDataResponse_metricResults,
getMetricDataResponse_nextToken,
getMetricDataResponse_httpStatus,
)
where
import Amazonka.Connect.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 Text
nextToken :: Prelude.Maybe Prelude.Text,
GetMetricData -> Maybe [Grouping]
groupings :: Prelude.Maybe [Grouping],
GetMetricData -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetMetricData -> Text
instanceId :: Prelude.Text,
GetMetricData -> POSIX
startTime :: Core.POSIX,
GetMetricData -> POSIX
endTime :: Core.POSIX,
GetMetricData -> Filters
filters :: Filters,
GetMetricData -> [HistoricalMetric]
historicalMetrics :: [HistoricalMetric]
}
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.Text ->
Prelude.UTCTime ->
Prelude.UTCTime ->
Filters ->
GetMetricData
newGetMetricData :: Text -> UTCTime -> UTCTime -> Filters -> GetMetricData
newGetMetricData
Text
pInstanceId_
UTCTime
pStartTime_
UTCTime
pEndTime_
Filters
pFilters_ =
GetMetricData' :: Maybe Text
-> Maybe [Grouping]
-> Maybe Natural
-> Text
-> POSIX
-> POSIX
-> Filters
-> [HistoricalMetric]
-> GetMetricData
GetMetricData'
{ $sel:nextToken:GetMetricData' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:groupings:GetMetricData' :: Maybe [Grouping]
groupings = Maybe [Grouping]
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetMetricData' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:GetMetricData' :: Text
instanceId = Text
pInstanceId_,
$sel:startTime:GetMetricData' :: POSIX
startTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
$sel:endTime:GetMetricData' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
$sel:filters:GetMetricData' :: Filters
filters = Filters
pFilters_,
$sel:historicalMetrics:GetMetricData' :: [HistoricalMetric]
historicalMetrics = [HistoricalMetric]
forall a. Monoid a => a
Prelude.mempty
}
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_groupings :: Lens.Lens' GetMetricData (Prelude.Maybe [Grouping])
getMetricData_groupings :: (Maybe [Grouping] -> f (Maybe [Grouping]))
-> GetMetricData -> f GetMetricData
getMetricData_groupings = (GetMetricData -> Maybe [Grouping])
-> (GetMetricData -> Maybe [Grouping] -> GetMetricData)
-> Lens
GetMetricData GetMetricData (Maybe [Grouping]) (Maybe [Grouping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Maybe [Grouping]
groupings :: Maybe [Grouping]
$sel:groupings:GetMetricData' :: GetMetricData -> Maybe [Grouping]
groupings} -> Maybe [Grouping]
groupings) (\s :: GetMetricData
s@GetMetricData' {} Maybe [Grouping]
a -> GetMetricData
s {$sel:groupings:GetMetricData' :: Maybe [Grouping]
groupings = Maybe [Grouping]
a} :: GetMetricData) ((Maybe [Grouping] -> f (Maybe [Grouping]))
-> GetMetricData -> f GetMetricData)
-> ((Maybe [Grouping] -> f (Maybe [Grouping]))
-> Maybe [Grouping] -> f (Maybe [Grouping]))
-> (Maybe [Grouping] -> f (Maybe [Grouping]))
-> GetMetricData
-> f GetMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Grouping] [Grouping] [Grouping] [Grouping]
-> Iso
(Maybe [Grouping])
(Maybe [Grouping])
(Maybe [Grouping])
(Maybe [Grouping])
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 [Grouping] [Grouping] [Grouping] [Grouping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getMetricData_maxResults :: Lens.Lens' GetMetricData (Prelude.Maybe Prelude.Natural)
getMetricData_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetMetricData -> f GetMetricData
getMetricData_maxResults = (GetMetricData -> Maybe Natural)
-> (GetMetricData -> Maybe Natural -> GetMetricData)
-> Lens GetMetricData GetMetricData (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetMetricData' :: GetMetricData -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetMetricData
s@GetMetricData' {} Maybe Natural
a -> GetMetricData
s {$sel:maxResults:GetMetricData' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetMetricData)
getMetricData_instanceId :: Lens.Lens' GetMetricData Prelude.Text
getMetricData_instanceId :: (Text -> f Text) -> GetMetricData -> f GetMetricData
getMetricData_instanceId = (GetMetricData -> Text)
-> (GetMetricData -> Text -> GetMetricData)
-> Lens GetMetricData GetMetricData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Text
instanceId :: Text
$sel:instanceId:GetMetricData' :: GetMetricData -> Text
instanceId} -> Text
instanceId) (\s :: GetMetricData
s@GetMetricData' {} Text
a -> GetMetricData
s {$sel:instanceId:GetMetricData' :: Text
instanceId = Text
a} :: GetMetricData)
getMetricData_startTime :: Lens.Lens' GetMetricData Prelude.UTCTime
getMetricData_startTime :: (UTCTime -> f UTCTime) -> GetMetricData -> f GetMetricData
getMetricData_startTime = (GetMetricData -> POSIX)
-> (GetMetricData -> POSIX -> GetMetricData)
-> Lens GetMetricData GetMetricData POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {POSIX
startTime :: POSIX
$sel:startTime:GetMetricData' :: GetMetricData -> POSIX
startTime} -> POSIX
startTime) (\s :: GetMetricData
s@GetMetricData' {} POSIX
a -> GetMetricData
s {$sel:startTime:GetMetricData' :: POSIX
startTime = POSIX
a} :: GetMetricData) ((POSIX -> f POSIX) -> GetMetricData -> f GetMetricData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetMetricData
-> f GetMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
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 -> POSIX)
-> (GetMetricData -> POSIX -> GetMetricData)
-> Lens GetMetricData GetMetricData POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {POSIX
endTime :: POSIX
$sel:endTime:GetMetricData' :: GetMetricData -> POSIX
endTime} -> POSIX
endTime) (\s :: GetMetricData
s@GetMetricData' {} POSIX
a -> GetMetricData
s {$sel:endTime:GetMetricData' :: POSIX
endTime = POSIX
a} :: GetMetricData) ((POSIX -> f POSIX) -> GetMetricData -> f GetMetricData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetMetricData
-> f GetMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
getMetricData_filters :: Lens.Lens' GetMetricData Filters
getMetricData_filters :: (Filters -> f Filters) -> GetMetricData -> f GetMetricData
getMetricData_filters = (GetMetricData -> Filters)
-> (GetMetricData -> Filters -> GetMetricData)
-> Lens GetMetricData GetMetricData Filters Filters
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {Filters
filters :: Filters
$sel:filters:GetMetricData' :: GetMetricData -> Filters
filters} -> Filters
filters) (\s :: GetMetricData
s@GetMetricData' {} Filters
a -> GetMetricData
s {$sel:filters:GetMetricData' :: Filters
filters = Filters
a} :: GetMetricData)
getMetricData_historicalMetrics :: Lens.Lens' GetMetricData [HistoricalMetric]
getMetricData_historicalMetrics :: ([HistoricalMetric] -> f [HistoricalMetric])
-> GetMetricData -> f GetMetricData
getMetricData_historicalMetrics = (GetMetricData -> [HistoricalMetric])
-> (GetMetricData -> [HistoricalMetric] -> GetMetricData)
-> Lens
GetMetricData GetMetricData [HistoricalMetric] [HistoricalMetric]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricData' {[HistoricalMetric]
historicalMetrics :: [HistoricalMetric]
$sel:historicalMetrics:GetMetricData' :: GetMetricData -> [HistoricalMetric]
historicalMetrics} -> [HistoricalMetric]
historicalMetrics) (\s :: GetMetricData
s@GetMetricData' {} [HistoricalMetric]
a -> GetMetricData
s {$sel:historicalMetrics:GetMetricData' :: [HistoricalMetric]
historicalMetrics = [HistoricalMetric]
a} :: GetMetricData) (([HistoricalMetric] -> f [HistoricalMetric])
-> GetMetricData -> f GetMetricData)
-> (([HistoricalMetric] -> f [HistoricalMetric])
-> [HistoricalMetric] -> f [HistoricalMetric])
-> ([HistoricalMetric] -> f [HistoricalMetric])
-> GetMetricData
-> f GetMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HistoricalMetric] -> f [HistoricalMetric])
-> [HistoricalMetric] -> f [HistoricalMetric]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
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 [HistoricalMetricResult] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetMetricData
GetMetricDataResponse
rs
GetMetricDataResponse
-> Getting
(First [HistoricalMetricResult])
GetMetricDataResponse
[HistoricalMetricResult]
-> Maybe [HistoricalMetricResult]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [HistoricalMetricResult]
-> Const
(First [HistoricalMetricResult]) (Maybe [HistoricalMetricResult]))
-> GetMetricDataResponse
-> Const (First [HistoricalMetricResult]) GetMetricDataResponse
Lens' GetMetricDataResponse (Maybe [HistoricalMetricResult])
getMetricDataResponse_metricResults
((Maybe [HistoricalMetricResult]
-> Const
(First [HistoricalMetricResult]) (Maybe [HistoricalMetricResult]))
-> GetMetricDataResponse
-> Const (First [HistoricalMetricResult]) GetMetricDataResponse)
-> (([HistoricalMetricResult]
-> Const (First [HistoricalMetricResult]) [HistoricalMetricResult])
-> Maybe [HistoricalMetricResult]
-> Const
(First [HistoricalMetricResult]) (Maybe [HistoricalMetricResult]))
-> Getting
(First [HistoricalMetricResult])
GetMetricDataResponse
[HistoricalMetricResult]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HistoricalMetricResult]
-> Const (First [HistoricalMetricResult]) [HistoricalMetricResult])
-> Maybe [HistoricalMetricResult]
-> Const
(First [HistoricalMetricResult]) (Maybe [HistoricalMetricResult])
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, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetMetricData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMetricData)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetMetricData))
-> Logger
-> Service
-> Proxy GetMetricData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMetricData)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [HistoricalMetricResult]
-> Maybe Text -> Int -> GetMetricDataResponse
GetMetricDataResponse'
(Maybe [HistoricalMetricResult]
-> Maybe Text -> Int -> GetMetricDataResponse)
-> Either String (Maybe [HistoricalMetricResult])
-> Either String (Maybe Text -> Int -> GetMetricDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [HistoricalMetricResult]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MetricResults" Either String (Maybe (Maybe [HistoricalMetricResult]))
-> Maybe [HistoricalMetricResult]
-> Either String (Maybe [HistoricalMetricResult])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [HistoricalMetricResult]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> GetMetricDataResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetMetricDataResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
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] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetMetricData where
toJSON :: GetMetricData -> Value
toJSON GetMetricData' {[HistoricalMetric]
Maybe Natural
Maybe [Grouping]
Maybe Text
Text
POSIX
Filters
historicalMetrics :: [HistoricalMetric]
filters :: Filters
endTime :: POSIX
startTime :: POSIX
instanceId :: Text
maxResults :: Maybe Natural
groupings :: Maybe [Grouping]
nextToken :: Maybe Text
$sel:historicalMetrics:GetMetricData' :: GetMetricData -> [HistoricalMetric]
$sel:filters:GetMetricData' :: GetMetricData -> Filters
$sel:endTime:GetMetricData' :: GetMetricData -> POSIX
$sel:startTime:GetMetricData' :: GetMetricData -> POSIX
$sel:instanceId:GetMetricData' :: GetMetricData -> Text
$sel:maxResults:GetMetricData' :: GetMetricData -> Maybe Natural
$sel:groupings:GetMetricData' :: GetMetricData -> Maybe [Grouping]
$sel:nextToken:GetMetricData' :: GetMetricData -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"Groupings" Text -> [Grouping] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Grouping] -> Pair) -> Maybe [Grouping] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Grouping]
groupings,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
startTime),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
endTime),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Filters" Text -> Filters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Filters
filters),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"HistoricalMetrics" Text -> [HistoricalMetric] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [HistoricalMetric]
historicalMetrics)
]
)
instance Core.ToPath GetMetricData where
toPath :: GetMetricData -> ByteString
toPath GetMetricData' {[HistoricalMetric]
Maybe Natural
Maybe [Grouping]
Maybe Text
Text
POSIX
Filters
historicalMetrics :: [HistoricalMetric]
filters :: Filters
endTime :: POSIX
startTime :: POSIX
instanceId :: Text
maxResults :: Maybe Natural
groupings :: Maybe [Grouping]
nextToken :: Maybe Text
$sel:historicalMetrics:GetMetricData' :: GetMetricData -> [HistoricalMetric]
$sel:filters:GetMetricData' :: GetMetricData -> Filters
$sel:endTime:GetMetricData' :: GetMetricData -> POSIX
$sel:startTime:GetMetricData' :: GetMetricData -> POSIX
$sel:instanceId:GetMetricData' :: GetMetricData -> Text
$sel:maxResults:GetMetricData' :: GetMetricData -> Maybe Natural
$sel:groupings:GetMetricData' :: GetMetricData -> Maybe [Grouping]
$sel:nextToken:GetMetricData' :: GetMetricData -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/metrics/historical/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId]
instance Core.ToQuery GetMetricData where
toQuery :: GetMetricData -> QueryString
toQuery = QueryString -> GetMetricData -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMetricDataResponse = GetMetricDataResponse'
{
GetMetricDataResponse -> Maybe [HistoricalMetricResult]
metricResults :: Prelude.Maybe [HistoricalMetricResult],
GetMetricDataResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
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 [HistoricalMetricResult]
-> Maybe Text -> Int -> GetMetricDataResponse
GetMetricDataResponse'
{ $sel:metricResults:GetMetricDataResponse' :: Maybe [HistoricalMetricResult]
metricResults =
Maybe [HistoricalMetricResult]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetMetricDataResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMetricDataResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMetricDataResponse_metricResults :: Lens.Lens' GetMetricDataResponse (Prelude.Maybe [HistoricalMetricResult])
getMetricDataResponse_metricResults :: (Maybe [HistoricalMetricResult]
-> f (Maybe [HistoricalMetricResult]))
-> GetMetricDataResponse -> f GetMetricDataResponse
getMetricDataResponse_metricResults = (GetMetricDataResponse -> Maybe [HistoricalMetricResult])
-> (GetMetricDataResponse
-> Maybe [HistoricalMetricResult] -> GetMetricDataResponse)
-> Lens' GetMetricDataResponse (Maybe [HistoricalMetricResult])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricDataResponse' {Maybe [HistoricalMetricResult]
metricResults :: Maybe [HistoricalMetricResult]
$sel:metricResults:GetMetricDataResponse' :: GetMetricDataResponse -> Maybe [HistoricalMetricResult]
metricResults} -> Maybe [HistoricalMetricResult]
metricResults) (\s :: GetMetricDataResponse
s@GetMetricDataResponse' {} Maybe [HistoricalMetricResult]
a -> GetMetricDataResponse
s {$sel:metricResults:GetMetricDataResponse' :: Maybe [HistoricalMetricResult]
metricResults = Maybe [HistoricalMetricResult]
a} :: GetMetricDataResponse) ((Maybe [HistoricalMetricResult]
-> f (Maybe [HistoricalMetricResult]))
-> GetMetricDataResponse -> f GetMetricDataResponse)
-> ((Maybe [HistoricalMetricResult]
-> f (Maybe [HistoricalMetricResult]))
-> Maybe [HistoricalMetricResult]
-> f (Maybe [HistoricalMetricResult]))
-> (Maybe [HistoricalMetricResult]
-> f (Maybe [HistoricalMetricResult]))
-> GetMetricDataResponse
-> f GetMetricDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[HistoricalMetricResult]
[HistoricalMetricResult]
[HistoricalMetricResult]
[HistoricalMetricResult]
-> Iso
(Maybe [HistoricalMetricResult])
(Maybe [HistoricalMetricResult])
(Maybe [HistoricalMetricResult])
(Maybe [HistoricalMetricResult])
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
[HistoricalMetricResult]
[HistoricalMetricResult]
[HistoricalMetricResult]
[HistoricalMetricResult]
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_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