{-# 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.Pi.GetResourceMetrics
(
GetResourceMetrics (..),
newGetResourceMetrics,
getResourceMetrics_periodInSeconds,
getResourceMetrics_nextToken,
getResourceMetrics_maxResults,
getResourceMetrics_serviceType,
getResourceMetrics_identifier,
getResourceMetrics_metricQueries,
getResourceMetrics_startTime,
getResourceMetrics_endTime,
GetResourceMetricsResponse (..),
newGetResourceMetricsResponse,
getResourceMetricsResponse_identifier,
getResourceMetricsResponse_metricList,
getResourceMetricsResponse_alignedEndTime,
getResourceMetricsResponse_alignedStartTime,
getResourceMetricsResponse_nextToken,
getResourceMetricsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pi.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetResourceMetrics = GetResourceMetrics'
{
GetResourceMetrics -> Maybe Int
periodInSeconds :: Prelude.Maybe Prelude.Int,
GetResourceMetrics -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetResourceMetrics -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetResourceMetrics -> ServiceType
serviceType :: ServiceType,
GetResourceMetrics -> Text
identifier :: Prelude.Text,
GetResourceMetrics -> NonEmpty MetricQuery
metricQueries :: Prelude.NonEmpty MetricQuery,
GetResourceMetrics -> POSIX
startTime :: Core.POSIX,
GetResourceMetrics -> POSIX
endTime :: Core.POSIX
}
deriving (GetResourceMetrics -> GetResourceMetrics -> Bool
(GetResourceMetrics -> GetResourceMetrics -> Bool)
-> (GetResourceMetrics -> GetResourceMetrics -> Bool)
-> Eq GetResourceMetrics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourceMetrics -> GetResourceMetrics -> Bool
$c/= :: GetResourceMetrics -> GetResourceMetrics -> Bool
== :: GetResourceMetrics -> GetResourceMetrics -> Bool
$c== :: GetResourceMetrics -> GetResourceMetrics -> Bool
Prelude.Eq, ReadPrec [GetResourceMetrics]
ReadPrec GetResourceMetrics
Int -> ReadS GetResourceMetrics
ReadS [GetResourceMetrics]
(Int -> ReadS GetResourceMetrics)
-> ReadS [GetResourceMetrics]
-> ReadPrec GetResourceMetrics
-> ReadPrec [GetResourceMetrics]
-> Read GetResourceMetrics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResourceMetrics]
$creadListPrec :: ReadPrec [GetResourceMetrics]
readPrec :: ReadPrec GetResourceMetrics
$creadPrec :: ReadPrec GetResourceMetrics
readList :: ReadS [GetResourceMetrics]
$creadList :: ReadS [GetResourceMetrics]
readsPrec :: Int -> ReadS GetResourceMetrics
$creadsPrec :: Int -> ReadS GetResourceMetrics
Prelude.Read, Int -> GetResourceMetrics -> ShowS
[GetResourceMetrics] -> ShowS
GetResourceMetrics -> String
(Int -> GetResourceMetrics -> ShowS)
-> (GetResourceMetrics -> String)
-> ([GetResourceMetrics] -> ShowS)
-> Show GetResourceMetrics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourceMetrics] -> ShowS
$cshowList :: [GetResourceMetrics] -> ShowS
show :: GetResourceMetrics -> String
$cshow :: GetResourceMetrics -> String
showsPrec :: Int -> GetResourceMetrics -> ShowS
$cshowsPrec :: Int -> GetResourceMetrics -> ShowS
Prelude.Show, (forall x. GetResourceMetrics -> Rep GetResourceMetrics x)
-> (forall x. Rep GetResourceMetrics x -> GetResourceMetrics)
-> Generic GetResourceMetrics
forall x. Rep GetResourceMetrics x -> GetResourceMetrics
forall x. GetResourceMetrics -> Rep GetResourceMetrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetResourceMetrics x -> GetResourceMetrics
$cfrom :: forall x. GetResourceMetrics -> Rep GetResourceMetrics x
Prelude.Generic)
newGetResourceMetrics ::
ServiceType ->
Prelude.Text ->
Prelude.NonEmpty MetricQuery ->
Prelude.UTCTime ->
Prelude.UTCTime ->
GetResourceMetrics
newGetResourceMetrics :: ServiceType
-> Text
-> NonEmpty MetricQuery
-> UTCTime
-> UTCTime
-> GetResourceMetrics
newGetResourceMetrics
ServiceType
pServiceType_
Text
pIdentifier_
NonEmpty MetricQuery
pMetricQueries_
UTCTime
pStartTime_
UTCTime
pEndTime_ =
GetResourceMetrics' :: Maybe Int
-> Maybe Text
-> Maybe Natural
-> ServiceType
-> Text
-> NonEmpty MetricQuery
-> POSIX
-> POSIX
-> GetResourceMetrics
GetResourceMetrics'
{ $sel:periodInSeconds:GetResourceMetrics' :: Maybe Int
periodInSeconds =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetResourceMetrics' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetResourceMetrics' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:serviceType:GetResourceMetrics' :: ServiceType
serviceType = ServiceType
pServiceType_,
$sel:identifier:GetResourceMetrics' :: Text
identifier = Text
pIdentifier_,
$sel:metricQueries:GetResourceMetrics' :: NonEmpty MetricQuery
metricQueries = Tagged (NonEmpty MetricQuery) (Identity (NonEmpty MetricQuery))
-> Tagged (NonEmpty MetricQuery) (Identity (NonEmpty MetricQuery))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty MetricQuery) (Identity (NonEmpty MetricQuery))
-> Tagged (NonEmpty MetricQuery) (Identity (NonEmpty MetricQuery)))
-> NonEmpty MetricQuery -> NonEmpty MetricQuery
forall t b. AReview t b -> b -> t
Lens.# NonEmpty MetricQuery
pMetricQueries_,
$sel:startTime:GetResourceMetrics' :: 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:GetResourceMetrics' :: 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_
}
getResourceMetrics_periodInSeconds :: Lens.Lens' GetResourceMetrics (Prelude.Maybe Prelude.Int)
getResourceMetrics_periodInSeconds :: (Maybe Int -> f (Maybe Int))
-> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_periodInSeconds = (GetResourceMetrics -> Maybe Int)
-> (GetResourceMetrics -> Maybe Int -> GetResourceMetrics)
-> Lens
GetResourceMetrics GetResourceMetrics (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {Maybe Int
periodInSeconds :: Maybe Int
$sel:periodInSeconds:GetResourceMetrics' :: GetResourceMetrics -> Maybe Int
periodInSeconds} -> Maybe Int
periodInSeconds) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} Maybe Int
a -> GetResourceMetrics
s {$sel:periodInSeconds:GetResourceMetrics' :: Maybe Int
periodInSeconds = Maybe Int
a} :: GetResourceMetrics)
getResourceMetrics_nextToken :: Lens.Lens' GetResourceMetrics (Prelude.Maybe Prelude.Text)
getResourceMetrics_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_nextToken = (GetResourceMetrics -> Maybe Text)
-> (GetResourceMetrics -> Maybe Text -> GetResourceMetrics)
-> Lens
GetResourceMetrics GetResourceMetrics (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetResourceMetrics' :: GetResourceMetrics -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} Maybe Text
a -> GetResourceMetrics
s {$sel:nextToken:GetResourceMetrics' :: Maybe Text
nextToken = Maybe Text
a} :: GetResourceMetrics)
getResourceMetrics_maxResults :: Lens.Lens' GetResourceMetrics (Prelude.Maybe Prelude.Natural)
getResourceMetrics_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_maxResults = (GetResourceMetrics -> Maybe Natural)
-> (GetResourceMetrics -> Maybe Natural -> GetResourceMetrics)
-> Lens
GetResourceMetrics
GetResourceMetrics
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetResourceMetrics' :: GetResourceMetrics -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} Maybe Natural
a -> GetResourceMetrics
s {$sel:maxResults:GetResourceMetrics' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetResourceMetrics)
getResourceMetrics_serviceType :: Lens.Lens' GetResourceMetrics ServiceType
getResourceMetrics_serviceType :: (ServiceType -> f ServiceType)
-> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_serviceType = (GetResourceMetrics -> ServiceType)
-> (GetResourceMetrics -> ServiceType -> GetResourceMetrics)
-> Lens
GetResourceMetrics GetResourceMetrics ServiceType ServiceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {ServiceType
serviceType :: ServiceType
$sel:serviceType:GetResourceMetrics' :: GetResourceMetrics -> ServiceType
serviceType} -> ServiceType
serviceType) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} ServiceType
a -> GetResourceMetrics
s {$sel:serviceType:GetResourceMetrics' :: ServiceType
serviceType = ServiceType
a} :: GetResourceMetrics)
getResourceMetrics_identifier :: Lens.Lens' GetResourceMetrics Prelude.Text
getResourceMetrics_identifier :: (Text -> f Text) -> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_identifier = (GetResourceMetrics -> Text)
-> (GetResourceMetrics -> Text -> GetResourceMetrics)
-> Lens GetResourceMetrics GetResourceMetrics Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {Text
identifier :: Text
$sel:identifier:GetResourceMetrics' :: GetResourceMetrics -> Text
identifier} -> Text
identifier) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} Text
a -> GetResourceMetrics
s {$sel:identifier:GetResourceMetrics' :: Text
identifier = Text
a} :: GetResourceMetrics)
getResourceMetrics_metricQueries :: Lens.Lens' GetResourceMetrics (Prelude.NonEmpty MetricQuery)
getResourceMetrics_metricQueries :: (NonEmpty MetricQuery -> f (NonEmpty MetricQuery))
-> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_metricQueries = (GetResourceMetrics -> NonEmpty MetricQuery)
-> (GetResourceMetrics
-> NonEmpty MetricQuery -> GetResourceMetrics)
-> Lens
GetResourceMetrics
GetResourceMetrics
(NonEmpty MetricQuery)
(NonEmpty MetricQuery)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {NonEmpty MetricQuery
metricQueries :: NonEmpty MetricQuery
$sel:metricQueries:GetResourceMetrics' :: GetResourceMetrics -> NonEmpty MetricQuery
metricQueries} -> NonEmpty MetricQuery
metricQueries) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} NonEmpty MetricQuery
a -> GetResourceMetrics
s {$sel:metricQueries:GetResourceMetrics' :: NonEmpty MetricQuery
metricQueries = NonEmpty MetricQuery
a} :: GetResourceMetrics) ((NonEmpty MetricQuery -> f (NonEmpty MetricQuery))
-> GetResourceMetrics -> f GetResourceMetrics)
-> ((NonEmpty MetricQuery -> f (NonEmpty MetricQuery))
-> NonEmpty MetricQuery -> f (NonEmpty MetricQuery))
-> (NonEmpty MetricQuery -> f (NonEmpty MetricQuery))
-> GetResourceMetrics
-> f GetResourceMetrics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty MetricQuery -> f (NonEmpty MetricQuery))
-> NonEmpty MetricQuery -> f (NonEmpty MetricQuery)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getResourceMetrics_startTime :: Lens.Lens' GetResourceMetrics Prelude.UTCTime
getResourceMetrics_startTime :: (UTCTime -> f UTCTime)
-> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_startTime = (GetResourceMetrics -> POSIX)
-> (GetResourceMetrics -> POSIX -> GetResourceMetrics)
-> Lens GetResourceMetrics GetResourceMetrics POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {POSIX
startTime :: POSIX
$sel:startTime:GetResourceMetrics' :: GetResourceMetrics -> POSIX
startTime} -> POSIX
startTime) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} POSIX
a -> GetResourceMetrics
s {$sel:startTime:GetResourceMetrics' :: POSIX
startTime = POSIX
a} :: GetResourceMetrics) ((POSIX -> f POSIX) -> GetResourceMetrics -> f GetResourceMetrics)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetResourceMetrics
-> f GetResourceMetrics
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
getResourceMetrics_endTime :: Lens.Lens' GetResourceMetrics Prelude.UTCTime
getResourceMetrics_endTime :: (UTCTime -> f UTCTime)
-> GetResourceMetrics -> f GetResourceMetrics
getResourceMetrics_endTime = (GetResourceMetrics -> POSIX)
-> (GetResourceMetrics -> POSIX -> GetResourceMetrics)
-> Lens GetResourceMetrics GetResourceMetrics POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetrics' {POSIX
endTime :: POSIX
$sel:endTime:GetResourceMetrics' :: GetResourceMetrics -> POSIX
endTime} -> POSIX
endTime) (\s :: GetResourceMetrics
s@GetResourceMetrics' {} POSIX
a -> GetResourceMetrics
s {$sel:endTime:GetResourceMetrics' :: POSIX
endTime = POSIX
a} :: GetResourceMetrics) ((POSIX -> f POSIX) -> GetResourceMetrics -> f GetResourceMetrics)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetResourceMetrics
-> f GetResourceMetrics
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
instance Core.AWSRequest GetResourceMetrics where
type
AWSResponse GetResourceMetrics =
GetResourceMetricsResponse
request :: GetResourceMetrics -> Request GetResourceMetrics
request = Service -> GetResourceMetrics -> Request GetResourceMetrics
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetResourceMetrics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetResourceMetrics)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetResourceMetrics))
-> Logger
-> Service
-> Proxy GetResourceMetrics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetResourceMetrics)))
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 Text
-> Maybe [MetricKeyDataPoints]
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Int
-> GetResourceMetricsResponse
GetResourceMetricsResponse'
(Maybe Text
-> Maybe [MetricKeyDataPoints]
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Int
-> GetResourceMetricsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [MetricKeyDataPoints]
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Int
-> GetResourceMetricsResponse)
forall (f :: * -> *) a b. Functor 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
"Identifier")
Either
String
(Maybe [MetricKeyDataPoints]
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Int
-> GetResourceMetricsResponse)
-> Either String (Maybe [MetricKeyDataPoints])
-> Either
String
(Maybe POSIX
-> Maybe POSIX -> Maybe Text -> Int -> GetResourceMetricsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [MetricKeyDataPoints]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MetricList" Either String (Maybe (Maybe [MetricKeyDataPoints]))
-> Maybe [MetricKeyDataPoints]
-> Either String (Maybe [MetricKeyDataPoints])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MetricKeyDataPoints]
forall a. Monoid a => a
Prelude.mempty)
Either
String
(Maybe POSIX
-> Maybe POSIX -> Maybe Text -> Int -> GetResourceMetricsResponse)
-> Either String (Maybe POSIX)
-> Either
String
(Maybe POSIX -> Maybe Text -> Int -> GetResourceMetricsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AlignedEndTime")
Either
String
(Maybe POSIX -> Maybe Text -> Int -> GetResourceMetricsResponse)
-> Either String (Maybe POSIX)
-> Either String (Maybe Text -> Int -> GetResourceMetricsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AlignedStartTime")
Either String (Maybe Text -> Int -> GetResourceMetricsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetResourceMetricsResponse)
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 -> GetResourceMetricsResponse)
-> Either String Int -> Either String GetResourceMetricsResponse
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 GetResourceMetrics
instance Prelude.NFData GetResourceMetrics
instance Core.ToHeaders GetResourceMetrics where
toHeaders :: GetResourceMetrics -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetResourceMetrics -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"PerformanceInsightsv20180227.GetResourceMetrics" ::
Prelude.ByteString
),
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 GetResourceMetrics where
toJSON :: GetResourceMetrics -> Value
toJSON GetResourceMetrics' {Maybe Int
Maybe Natural
Maybe Text
NonEmpty MetricQuery
Text
POSIX
ServiceType
endTime :: POSIX
startTime :: POSIX
metricQueries :: NonEmpty MetricQuery
identifier :: Text
serviceType :: ServiceType
maxResults :: Maybe Natural
nextToken :: Maybe Text
periodInSeconds :: Maybe Int
$sel:endTime:GetResourceMetrics' :: GetResourceMetrics -> POSIX
$sel:startTime:GetResourceMetrics' :: GetResourceMetrics -> POSIX
$sel:metricQueries:GetResourceMetrics' :: GetResourceMetrics -> NonEmpty MetricQuery
$sel:identifier:GetResourceMetrics' :: GetResourceMetrics -> Text
$sel:serviceType:GetResourceMetrics' :: GetResourceMetrics -> ServiceType
$sel:maxResults:GetResourceMetrics' :: GetResourceMetrics -> Maybe Natural
$sel:nextToken:GetResourceMetrics' :: GetResourceMetrics -> Maybe Text
$sel:periodInSeconds:GetResourceMetrics' :: GetResourceMetrics -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PeriodInSeconds" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
periodInSeconds,
(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
"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
"ServiceType" Text -> ServiceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ServiceType
serviceType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Identifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identifier),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricQueries" Text -> NonEmpty MetricQuery -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty MetricQuery
metricQueries),
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)
]
)
instance Core.ToPath GetResourceMetrics where
toPath :: GetResourceMetrics -> ByteString
toPath = ByteString -> GetResourceMetrics -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetResourceMetrics where
toQuery :: GetResourceMetrics -> QueryString
toQuery = QueryString -> GetResourceMetrics -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetResourceMetricsResponse = GetResourceMetricsResponse'
{
GetResourceMetricsResponse -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
GetResourceMetricsResponse -> Maybe [MetricKeyDataPoints]
metricList :: Prelude.Maybe [MetricKeyDataPoints],
GetResourceMetricsResponse -> Maybe POSIX
alignedEndTime :: Prelude.Maybe Core.POSIX,
GetResourceMetricsResponse -> Maybe POSIX
alignedStartTime :: Prelude.Maybe Core.POSIX,
GetResourceMetricsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetResourceMetricsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetResourceMetricsResponse -> GetResourceMetricsResponse -> Bool
(GetResourceMetricsResponse -> GetResourceMetricsResponse -> Bool)
-> (GetResourceMetricsResponse
-> GetResourceMetricsResponse -> Bool)
-> Eq GetResourceMetricsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourceMetricsResponse -> GetResourceMetricsResponse -> Bool
$c/= :: GetResourceMetricsResponse -> GetResourceMetricsResponse -> Bool
== :: GetResourceMetricsResponse -> GetResourceMetricsResponse -> Bool
$c== :: GetResourceMetricsResponse -> GetResourceMetricsResponse -> Bool
Prelude.Eq, ReadPrec [GetResourceMetricsResponse]
ReadPrec GetResourceMetricsResponse
Int -> ReadS GetResourceMetricsResponse
ReadS [GetResourceMetricsResponse]
(Int -> ReadS GetResourceMetricsResponse)
-> ReadS [GetResourceMetricsResponse]
-> ReadPrec GetResourceMetricsResponse
-> ReadPrec [GetResourceMetricsResponse]
-> Read GetResourceMetricsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResourceMetricsResponse]
$creadListPrec :: ReadPrec [GetResourceMetricsResponse]
readPrec :: ReadPrec GetResourceMetricsResponse
$creadPrec :: ReadPrec GetResourceMetricsResponse
readList :: ReadS [GetResourceMetricsResponse]
$creadList :: ReadS [GetResourceMetricsResponse]
readsPrec :: Int -> ReadS GetResourceMetricsResponse
$creadsPrec :: Int -> ReadS GetResourceMetricsResponse
Prelude.Read, Int -> GetResourceMetricsResponse -> ShowS
[GetResourceMetricsResponse] -> ShowS
GetResourceMetricsResponse -> String
(Int -> GetResourceMetricsResponse -> ShowS)
-> (GetResourceMetricsResponse -> String)
-> ([GetResourceMetricsResponse] -> ShowS)
-> Show GetResourceMetricsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourceMetricsResponse] -> ShowS
$cshowList :: [GetResourceMetricsResponse] -> ShowS
show :: GetResourceMetricsResponse -> String
$cshow :: GetResourceMetricsResponse -> String
showsPrec :: Int -> GetResourceMetricsResponse -> ShowS
$cshowsPrec :: Int -> GetResourceMetricsResponse -> ShowS
Prelude.Show, (forall x.
GetResourceMetricsResponse -> Rep GetResourceMetricsResponse x)
-> (forall x.
Rep GetResourceMetricsResponse x -> GetResourceMetricsResponse)
-> Generic GetResourceMetricsResponse
forall x.
Rep GetResourceMetricsResponse x -> GetResourceMetricsResponse
forall x.
GetResourceMetricsResponse -> Rep GetResourceMetricsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResourceMetricsResponse x -> GetResourceMetricsResponse
$cfrom :: forall x.
GetResourceMetricsResponse -> Rep GetResourceMetricsResponse x
Prelude.Generic)
newGetResourceMetricsResponse ::
Prelude.Int ->
GetResourceMetricsResponse
newGetResourceMetricsResponse :: Int -> GetResourceMetricsResponse
newGetResourceMetricsResponse Int
pHttpStatus_ =
GetResourceMetricsResponse' :: Maybe Text
-> Maybe [MetricKeyDataPoints]
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Int
-> GetResourceMetricsResponse
GetResourceMetricsResponse'
{ $sel:identifier:GetResourceMetricsResponse' :: Maybe Text
identifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metricList:GetResourceMetricsResponse' :: Maybe [MetricKeyDataPoints]
metricList = Maybe [MetricKeyDataPoints]
forall a. Maybe a
Prelude.Nothing,
$sel:alignedEndTime:GetResourceMetricsResponse' :: Maybe POSIX
alignedEndTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:alignedStartTime:GetResourceMetricsResponse' :: Maybe POSIX
alignedStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetResourceMetricsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetResourceMetricsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getResourceMetricsResponse_identifier :: Lens.Lens' GetResourceMetricsResponse (Prelude.Maybe Prelude.Text)
getResourceMetricsResponse_identifier :: (Maybe Text -> f (Maybe Text))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse
getResourceMetricsResponse_identifier = (GetResourceMetricsResponse -> Maybe Text)
-> (GetResourceMetricsResponse
-> Maybe Text -> GetResourceMetricsResponse)
-> Lens
GetResourceMetricsResponse
GetResourceMetricsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetricsResponse' {Maybe Text
identifier :: Maybe Text
$sel:identifier:GetResourceMetricsResponse' :: GetResourceMetricsResponse -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: GetResourceMetricsResponse
s@GetResourceMetricsResponse' {} Maybe Text
a -> GetResourceMetricsResponse
s {$sel:identifier:GetResourceMetricsResponse' :: Maybe Text
identifier = Maybe Text
a} :: GetResourceMetricsResponse)
getResourceMetricsResponse_metricList :: Lens.Lens' GetResourceMetricsResponse (Prelude.Maybe [MetricKeyDataPoints])
getResourceMetricsResponse_metricList :: (Maybe [MetricKeyDataPoints] -> f (Maybe [MetricKeyDataPoints]))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse
getResourceMetricsResponse_metricList = (GetResourceMetricsResponse -> Maybe [MetricKeyDataPoints])
-> (GetResourceMetricsResponse
-> Maybe [MetricKeyDataPoints] -> GetResourceMetricsResponse)
-> Lens
GetResourceMetricsResponse
GetResourceMetricsResponse
(Maybe [MetricKeyDataPoints])
(Maybe [MetricKeyDataPoints])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetricsResponse' {Maybe [MetricKeyDataPoints]
metricList :: Maybe [MetricKeyDataPoints]
$sel:metricList:GetResourceMetricsResponse' :: GetResourceMetricsResponse -> Maybe [MetricKeyDataPoints]
metricList} -> Maybe [MetricKeyDataPoints]
metricList) (\s :: GetResourceMetricsResponse
s@GetResourceMetricsResponse' {} Maybe [MetricKeyDataPoints]
a -> GetResourceMetricsResponse
s {$sel:metricList:GetResourceMetricsResponse' :: Maybe [MetricKeyDataPoints]
metricList = Maybe [MetricKeyDataPoints]
a} :: GetResourceMetricsResponse) ((Maybe [MetricKeyDataPoints] -> f (Maybe [MetricKeyDataPoints]))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse)
-> ((Maybe [MetricKeyDataPoints]
-> f (Maybe [MetricKeyDataPoints]))
-> Maybe [MetricKeyDataPoints] -> f (Maybe [MetricKeyDataPoints]))
-> (Maybe [MetricKeyDataPoints] -> f (Maybe [MetricKeyDataPoints]))
-> GetResourceMetricsResponse
-> f GetResourceMetricsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetricKeyDataPoints]
[MetricKeyDataPoints]
[MetricKeyDataPoints]
[MetricKeyDataPoints]
-> Iso
(Maybe [MetricKeyDataPoints])
(Maybe [MetricKeyDataPoints])
(Maybe [MetricKeyDataPoints])
(Maybe [MetricKeyDataPoints])
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
[MetricKeyDataPoints]
[MetricKeyDataPoints]
[MetricKeyDataPoints]
[MetricKeyDataPoints]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getResourceMetricsResponse_alignedEndTime :: Lens.Lens' GetResourceMetricsResponse (Prelude.Maybe Prelude.UTCTime)
getResourceMetricsResponse_alignedEndTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse
getResourceMetricsResponse_alignedEndTime = (GetResourceMetricsResponse -> Maybe POSIX)
-> (GetResourceMetricsResponse
-> Maybe POSIX -> GetResourceMetricsResponse)
-> Lens
GetResourceMetricsResponse
GetResourceMetricsResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetricsResponse' {Maybe POSIX
alignedEndTime :: Maybe POSIX
$sel:alignedEndTime:GetResourceMetricsResponse' :: GetResourceMetricsResponse -> Maybe POSIX
alignedEndTime} -> Maybe POSIX
alignedEndTime) (\s :: GetResourceMetricsResponse
s@GetResourceMetricsResponse' {} Maybe POSIX
a -> GetResourceMetricsResponse
s {$sel:alignedEndTime:GetResourceMetricsResponse' :: Maybe POSIX
alignedEndTime = Maybe POSIX
a} :: GetResourceMetricsResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetResourceMetricsResponse
-> f GetResourceMetricsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
getResourceMetricsResponse_alignedStartTime :: Lens.Lens' GetResourceMetricsResponse (Prelude.Maybe Prelude.UTCTime)
getResourceMetricsResponse_alignedStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse
getResourceMetricsResponse_alignedStartTime = (GetResourceMetricsResponse -> Maybe POSIX)
-> (GetResourceMetricsResponse
-> Maybe POSIX -> GetResourceMetricsResponse)
-> Lens
GetResourceMetricsResponse
GetResourceMetricsResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetricsResponse' {Maybe POSIX
alignedStartTime :: Maybe POSIX
$sel:alignedStartTime:GetResourceMetricsResponse' :: GetResourceMetricsResponse -> Maybe POSIX
alignedStartTime} -> Maybe POSIX
alignedStartTime) (\s :: GetResourceMetricsResponse
s@GetResourceMetricsResponse' {} Maybe POSIX
a -> GetResourceMetricsResponse
s {$sel:alignedStartTime:GetResourceMetricsResponse' :: Maybe POSIX
alignedStartTime = Maybe POSIX
a} :: GetResourceMetricsResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetResourceMetricsResponse
-> f GetResourceMetricsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
getResourceMetricsResponse_nextToken :: Lens.Lens' GetResourceMetricsResponse (Prelude.Maybe Prelude.Text)
getResourceMetricsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse
getResourceMetricsResponse_nextToken = (GetResourceMetricsResponse -> Maybe Text)
-> (GetResourceMetricsResponse
-> Maybe Text -> GetResourceMetricsResponse)
-> Lens
GetResourceMetricsResponse
GetResourceMetricsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetricsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetResourceMetricsResponse' :: GetResourceMetricsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetResourceMetricsResponse
s@GetResourceMetricsResponse' {} Maybe Text
a -> GetResourceMetricsResponse
s {$sel:nextToken:GetResourceMetricsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetResourceMetricsResponse)
getResourceMetricsResponse_httpStatus :: Lens.Lens' GetResourceMetricsResponse Prelude.Int
getResourceMetricsResponse_httpStatus :: (Int -> f Int)
-> GetResourceMetricsResponse -> f GetResourceMetricsResponse
getResourceMetricsResponse_httpStatus = (GetResourceMetricsResponse -> Int)
-> (GetResourceMetricsResponse
-> Int -> GetResourceMetricsResponse)
-> Lens
GetResourceMetricsResponse GetResourceMetricsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceMetricsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetResourceMetricsResponse' :: GetResourceMetricsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetResourceMetricsResponse
s@GetResourceMetricsResponse' {} Int
a -> GetResourceMetricsResponse
s {$sel:httpStatus:GetResourceMetricsResponse' :: Int
httpStatus = Int
a} :: GetResourceMetricsResponse)
instance Prelude.NFData GetResourceMetricsResponse