{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Pi.GetResourceMetrics
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieve Performance Insights metrics for a set of data sources, over a
-- time period. You can provide specific dimension groups and dimensions,
-- and provide aggregation and filtering criteria for each group.
--
-- Each response element returns a maximum of 500 bytes. For larger
-- elements, such as SQL statements, only the first 500 bytes are returned.
module Amazonka.Pi.GetResourceMetrics
  ( -- * Creating a Request
    GetResourceMetrics (..),
    newGetResourceMetrics,

    -- * Request Lenses
    getResourceMetrics_periodInSeconds,
    getResourceMetrics_nextToken,
    getResourceMetrics_maxResults,
    getResourceMetrics_serviceType,
    getResourceMetrics_identifier,
    getResourceMetrics_metricQueries,
    getResourceMetrics_startTime,
    getResourceMetrics_endTime,

    -- * Destructuring the Response
    GetResourceMetricsResponse (..),
    newGetResourceMetricsResponse,

    -- * Response Lenses
    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

-- | /See:/ 'newGetResourceMetrics' smart constructor.
data GetResourceMetrics = GetResourceMetrics'
  { -- | The granularity, in seconds, of the data points returned from
    -- Performance Insights. A period can be as short as one second, or as long
    -- as one day (86400 seconds). Valid values are:
    --
    -- -   @1@ (one second)
    --
    -- -   @60@ (one minute)
    --
    -- -   @300@ (five minutes)
    --
    -- -   @3600@ (one hour)
    --
    -- -   @86400@ (twenty-four hours)
    --
    -- If you don\'t specify @PeriodInSeconds@, then Performance Insights will
    -- choose a value for you, with a goal of returning roughly 100-200 data
    -- points in the response.
    GetResourceMetrics -> Maybe Int
periodInSeconds :: Prelude.Maybe Prelude.Int,
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- token, up to the value specified by @MaxRecords@.
    GetResourceMetrics -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return in the response. If more items
    -- exist than the specified @MaxRecords@ value, a pagination token is
    -- included in the response so that the remaining results can be retrieved.
    GetResourceMetrics -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The AWS service for which Performance Insights returns metrics. The only
    -- valid value for /ServiceType/ is @RDS@.
    GetResourceMetrics -> ServiceType
serviceType :: ServiceType,
    -- | An immutable, AWS Region-unique identifier for a data source.
    -- Performance Insights gathers metrics from this data source.
    --
    -- To use a DB instance as a data source, specify its @DbiResourceId@
    -- value. For example, specify @db-FAIHNTYBKTGAUSUZQYPDS2GW4A@.
    GetResourceMetrics -> Text
identifier :: Prelude.Text,
    -- | An array of one or more queries to perform. Each query must specify a
    -- Performance Insights metric, and can optionally specify aggregation and
    -- filtering criteria.
    GetResourceMetrics -> NonEmpty MetricQuery
metricQueries :: Prelude.NonEmpty MetricQuery,
    -- | The date and time specifying the beginning of the requested time series
    -- data. You can\'t specify a @StartTime@ that\'s earlier than 7 days ago.
    -- The value specified is /inclusive/ - data points equal to or greater
    -- than @StartTime@ will be returned.
    --
    -- The value for @StartTime@ must be earlier than the value for @EndTime@.
    GetResourceMetrics -> POSIX
startTime :: Core.POSIX,
    -- | The date and time specifying the end of the requested time series data.
    -- The value specified is /exclusive/ - data points less than (but not
    -- equal to) @EndTime@ will be returned.
    --
    -- The value for @EndTime@ must be later than the value for @StartTime@.
    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)

-- |
-- Create a value of 'GetResourceMetrics' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'periodInSeconds', 'getResourceMetrics_periodInSeconds' - The granularity, in seconds, of the data points returned from
-- Performance Insights. A period can be as short as one second, or as long
-- as one day (86400 seconds). Valid values are:
--
-- -   @1@ (one second)
--
-- -   @60@ (one minute)
--
-- -   @300@ (five minutes)
--
-- -   @3600@ (one hour)
--
-- -   @86400@ (twenty-four hours)
--
-- If you don\'t specify @PeriodInSeconds@, then Performance Insights will
-- choose a value for you, with a goal of returning roughly 100-200 data
-- points in the response.
--
-- 'nextToken', 'getResourceMetrics_nextToken' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- token, up to the value specified by @MaxRecords@.
--
-- 'maxResults', 'getResourceMetrics_maxResults' - The maximum number of items to return in the response. If more items
-- exist than the specified @MaxRecords@ value, a pagination token is
-- included in the response so that the remaining results can be retrieved.
--
-- 'serviceType', 'getResourceMetrics_serviceType' - The AWS service for which Performance Insights returns metrics. The only
-- valid value for /ServiceType/ is @RDS@.
--
-- 'identifier', 'getResourceMetrics_identifier' - An immutable, AWS Region-unique identifier for a data source.
-- Performance Insights gathers metrics from this data source.
--
-- To use a DB instance as a data source, specify its @DbiResourceId@
-- value. For example, specify @db-FAIHNTYBKTGAUSUZQYPDS2GW4A@.
--
-- 'metricQueries', 'getResourceMetrics_metricQueries' - An array of one or more queries to perform. Each query must specify a
-- Performance Insights metric, and can optionally specify aggregation and
-- filtering criteria.
--
-- 'startTime', 'getResourceMetrics_startTime' - The date and time specifying the beginning of the requested time series
-- data. You can\'t specify a @StartTime@ that\'s earlier than 7 days ago.
-- The value specified is /inclusive/ - data points equal to or greater
-- than @StartTime@ will be returned.
--
-- The value for @StartTime@ must be earlier than the value for @EndTime@.
--
-- 'endTime', 'getResourceMetrics_endTime' - The date and time specifying the end of the requested time series data.
-- The value specified is /exclusive/ - data points less than (but not
-- equal to) @EndTime@ will be returned.
--
-- The value for @EndTime@ must be later than the value for @StartTime@.
newGetResourceMetrics ::
  -- | 'serviceType'
  ServiceType ->
  -- | 'identifier'
  Prelude.Text ->
  -- | 'metricQueries'
  Prelude.NonEmpty MetricQuery ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  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_
      }

-- | The granularity, in seconds, of the data points returned from
-- Performance Insights. A period can be as short as one second, or as long
-- as one day (86400 seconds). Valid values are:
--
-- -   @1@ (one second)
--
-- -   @60@ (one minute)
--
-- -   @300@ (five minutes)
--
-- -   @3600@ (one hour)
--
-- -   @86400@ (twenty-four hours)
--
-- If you don\'t specify @PeriodInSeconds@, then Performance Insights will
-- choose a value for you, with a goal of returning roughly 100-200 data
-- points in the response.
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)

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- token, up to the value specified by @MaxRecords@.
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)

-- | The maximum number of items to return in the response. If more items
-- exist than the specified @MaxRecords@ value, a pagination token is
-- included in the response so that the remaining results can be retrieved.
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)

-- | The AWS service for which Performance Insights returns metrics. The only
-- valid value for /ServiceType/ is @RDS@.
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)

-- | An immutable, AWS Region-unique identifier for a data source.
-- Performance Insights gathers metrics from this data source.
--
-- To use a DB instance as a data source, specify its @DbiResourceId@
-- value. For example, specify @db-FAIHNTYBKTGAUSUZQYPDS2GW4A@.
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)

-- | An array of one or more queries to perform. Each query must specify a
-- Performance Insights metric, and can optionally specify aggregation and
-- filtering criteria.
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

-- | The date and time specifying the beginning of the requested time series
-- data. You can\'t specify a @StartTime@ that\'s earlier than 7 days ago.
-- The value specified is /inclusive/ - data points equal to or greater
-- than @StartTime@ will be returned.
--
-- The value for @StartTime@ must be earlier than the value for @EndTime@.
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

-- | The date and time specifying the end of the requested time series data.
-- The value specified is /exclusive/ - data points less than (but not
-- equal to) @EndTime@ will be returned.
--
-- The value for @EndTime@ must be later than the value for @StartTime@.
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

-- | /See:/ 'newGetResourceMetricsResponse' smart constructor.
data GetResourceMetricsResponse = GetResourceMetricsResponse'
  { -- | An immutable, AWS Region-unique identifier for a data source.
    -- Performance Insights gathers metrics from this data source.
    --
    -- To use a DB instance as a data source, you specify its @DbiResourceId@
    -- value - for example: @db-FAIHNTYBKTGAUSUZQYPDS2GW4A@
    GetResourceMetricsResponse -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | An array of metric results,, where each array element contains all of
    -- the data points for a particular dimension.
    GetResourceMetricsResponse -> Maybe [MetricKeyDataPoints]
metricList :: Prelude.Maybe [MetricKeyDataPoints],
    -- | The end time for the returned metrics, after alignment to a granular
    -- boundary (as specified by @PeriodInSeconds@). @AlignedEndTime@ will be
    -- greater than or equal to the value of the user-specified @Endtime@.
    GetResourceMetricsResponse -> Maybe POSIX
alignedEndTime :: Prelude.Maybe Core.POSIX,
    -- | The start time for the returned metrics, after alignment to a granular
    -- boundary (as specified by @PeriodInSeconds@). @AlignedStartTime@ will be
    -- less than or equal to the value of the user-specified @StartTime@.
    GetResourceMetricsResponse -> Maybe POSIX
alignedStartTime :: Prelude.Maybe Core.POSIX,
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- token, up to the value specified by @MaxRecords@.
    GetResourceMetricsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    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)

-- |
-- Create a value of 'GetResourceMetricsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'identifier', 'getResourceMetricsResponse_identifier' - An immutable, AWS Region-unique identifier for a data source.
-- Performance Insights gathers metrics from this data source.
--
-- To use a DB instance as a data source, you specify its @DbiResourceId@
-- value - for example: @db-FAIHNTYBKTGAUSUZQYPDS2GW4A@
--
-- 'metricList', 'getResourceMetricsResponse_metricList' - An array of metric results,, where each array element contains all of
-- the data points for a particular dimension.
--
-- 'alignedEndTime', 'getResourceMetricsResponse_alignedEndTime' - The end time for the returned metrics, after alignment to a granular
-- boundary (as specified by @PeriodInSeconds@). @AlignedEndTime@ will be
-- greater than or equal to the value of the user-specified @Endtime@.
--
-- 'alignedStartTime', 'getResourceMetricsResponse_alignedStartTime' - The start time for the returned metrics, after alignment to a granular
-- boundary (as specified by @PeriodInSeconds@). @AlignedStartTime@ will be
-- less than or equal to the value of the user-specified @StartTime@.
--
-- 'nextToken', 'getResourceMetricsResponse_nextToken' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- token, up to the value specified by @MaxRecords@.
--
-- 'httpStatus', 'getResourceMetricsResponse_httpStatus' - The response's http status code.
newGetResourceMetricsResponse ::
  -- | 'httpStatus'
  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_
    }

-- | An immutable, AWS Region-unique identifier for a data source.
-- Performance Insights gathers metrics from this data source.
--
-- To use a DB instance as a data source, you specify its @DbiResourceId@
-- value - for example: @db-FAIHNTYBKTGAUSUZQYPDS2GW4A@
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)

-- | An array of metric results,, where each array element contains all of
-- the data points for a particular dimension.
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

-- | The end time for the returned metrics, after alignment to a granular
-- boundary (as specified by @PeriodInSeconds@). @AlignedEndTime@ will be
-- greater than or equal to the value of the user-specified @Endtime@.
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

-- | The start time for the returned metrics, after alignment to a granular
-- boundary (as specified by @PeriodInSeconds@). @AlignedStartTime@ will be
-- less than or equal to the value of the user-specified @StartTime@.
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

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- token, up to the value specified by @MaxRecords@.
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)

-- | The response's http status code.
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