{-# 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.Connect.GetMetricData
-- 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)
--
-- Gets historical metric data from the specified Amazon Connect instance.
--
-- For a description of each historical metric, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/historical-metrics-definitions.html Historical Metrics Definitions>
-- in the /Amazon Connect Administrator Guide/.
--
-- This operation returns paginated results.
module Amazonka.Connect.GetMetricData
  ( -- * Creating a Request
    GetMetricData (..),
    newGetMetricData,

    -- * Request Lenses
    getMetricData_nextToken,
    getMetricData_groupings,
    getMetricData_maxResults,
    getMetricData_instanceId,
    getMetricData_startTime,
    getMetricData_endTime,
    getMetricData_filters,
    getMetricData_historicalMetrics,

    -- * Destructuring the Response
    GetMetricDataResponse (..),
    newGetMetricDataResponse,

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

-- | /See:/ 'newGetMetricData' smart constructor.
data GetMetricData = GetMetricData'
  { -- | The token for the next set of results. Use the value returned in the
    -- previous response in the next request to retrieve the next set of
    -- results.
    GetMetricData -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The grouping applied to the metrics returned. For example, when results
    -- are grouped by queue, the metrics returned are grouped by queue. The
    -- values returned apply to the metrics for each queue rather than
    -- aggregated for all queues.
    --
    -- If no grouping is specified, a summary of metrics for all queues is
    -- returned.
    GetMetricData -> Maybe [Grouping]
groupings :: Prelude.Maybe [Grouping],
    -- | The maximum number of results to return per page.
    GetMetricData -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    GetMetricData -> Text
instanceId :: Prelude.Text,
    -- | The timestamp, in UNIX Epoch time format, at which to start the
    -- reporting interval for the retrieval of historical metrics data. The
    -- time must be specified using a multiple of 5 minutes, such as 10:05,
    -- 10:10, 10:15.
    --
    -- The start time cannot be earlier than 24 hours before the time of the
    -- request. Historical metrics are available only for 24 hours.
    GetMetricData -> POSIX
startTime :: Core.POSIX,
    -- | The timestamp, in UNIX Epoch time format, at which to end the reporting
    -- interval for the retrieval of historical metrics data. The time must be
    -- specified using an interval of 5 minutes, such as 11:00, 11:05, 11:10,
    -- and must be later than the start time timestamp.
    --
    -- The time range between the start and end time must be less than 24
    -- hours.
    GetMetricData -> POSIX
endTime :: Core.POSIX,
    -- | The queues, up to 100, or channels, to use to filter the metrics
    -- returned. Metric data is retrieved only for the resources associated
    -- with the queues or channels included in the filter. You can include both
    -- queue IDs and queue ARNs in the same request. VOICE, CHAT, and TASK
    -- channels are supported.
    --
    -- To filter by @Queues@, enter the queue ID\/ARN, not the name of the
    -- queue.
    GetMetricData -> Filters
filters :: Filters,
    -- | The metrics to retrieve. Specify the name, unit, and statistic for each
    -- metric. The following historical metrics are available. For a
    -- description of each metric, see
    -- <https://docs.aws.amazon.com/connect/latest/adminguide/historical-metrics-definitions.html Historical Metrics Definitions>
    -- in the /Amazon Connect Administrator Guide/.
    --
    -- This API does not support a contacts incoming metric (there\'s no
    -- CONTACTS_INCOMING metric missing from the documented list).
    --
    -- [ABANDON_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: AVG
    --
    -- [AFTER_CONTACT_WORK_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: AVG
    --
    -- [API_CONTACTS_HANDLED]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CALLBACK_CONTACTS_HANDLED]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_ABANDONED]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_AGENT_HUNG_UP_FIRST]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_CONSULTED]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_HANDLED]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_HANDLED_INCOMING]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_HANDLED_OUTBOUND]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_HOLD_ABANDONS]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_MISSED]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_QUEUED]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_TRANSFERRED_IN]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_TRANSFERRED_IN_FROM_QUEUE]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_TRANSFERRED_OUT]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [CONTACTS_TRANSFERRED_OUT_FROM_QUEUE]
    --     Unit: COUNT
    --
    --     Statistic: SUM
    --
    -- [HANDLE_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: AVG
    --
    -- [HOLD_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: AVG
    --
    -- [INTERACTION_AND_HOLD_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: AVG
    --
    -- [INTERACTION_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: AVG
    --
    -- [OCCUPANCY]
    --     Unit: PERCENT
    --
    --     Statistic: AVG
    --
    -- [QUEUE_ANSWER_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: AVG
    --
    -- [QUEUED_TIME]
    --     Unit: SECONDS
    --
    --     Statistic: MAX
    --
    -- [SERVICE_LEVEL]
    --     You can include up to 20 SERVICE_LEVEL metrics in a request.
    --
    --     Unit: PERCENT
    --
    --     Statistic: AVG
    --
    --     Threshold: For @ThresholdValue@, enter any whole number from 1 to
    --     604800 (inclusive), in seconds. For @Comparison@, you must enter
    --     @LT@ (for \"Less than\").
    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)

-- |
-- Create a value of 'GetMetricData' 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:
--
-- 'nextToken', 'getMetricData_nextToken' - The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
--
-- 'groupings', 'getMetricData_groupings' - The grouping applied to the metrics returned. For example, when results
-- are grouped by queue, the metrics returned are grouped by queue. The
-- values returned apply to the metrics for each queue rather than
-- aggregated for all queues.
--
-- If no grouping is specified, a summary of metrics for all queues is
-- returned.
--
-- 'maxResults', 'getMetricData_maxResults' - The maximum number of results to return per page.
--
-- 'instanceId', 'getMetricData_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'startTime', 'getMetricData_startTime' - The timestamp, in UNIX Epoch time format, at which to start the
-- reporting interval for the retrieval of historical metrics data. The
-- time must be specified using a multiple of 5 minutes, such as 10:05,
-- 10:10, 10:15.
--
-- The start time cannot be earlier than 24 hours before the time of the
-- request. Historical metrics are available only for 24 hours.
--
-- 'endTime', 'getMetricData_endTime' - The timestamp, in UNIX Epoch time format, at which to end the reporting
-- interval for the retrieval of historical metrics data. The time must be
-- specified using an interval of 5 minutes, such as 11:00, 11:05, 11:10,
-- and must be later than the start time timestamp.
--
-- The time range between the start and end time must be less than 24
-- hours.
--
-- 'filters', 'getMetricData_filters' - The queues, up to 100, or channels, to use to filter the metrics
-- returned. Metric data is retrieved only for the resources associated
-- with the queues or channels included in the filter. You can include both
-- queue IDs and queue ARNs in the same request. VOICE, CHAT, and TASK
-- channels are supported.
--
-- To filter by @Queues@, enter the queue ID\/ARN, not the name of the
-- queue.
--
-- 'historicalMetrics', 'getMetricData_historicalMetrics' - The metrics to retrieve. Specify the name, unit, and statistic for each
-- metric. The following historical metrics are available. For a
-- description of each metric, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/historical-metrics-definitions.html Historical Metrics Definitions>
-- in the /Amazon Connect Administrator Guide/.
--
-- This API does not support a contacts incoming metric (there\'s no
-- CONTACTS_INCOMING metric missing from the documented list).
--
-- [ABANDON_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [AFTER_CONTACT_WORK_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [API_CONTACTS_HANDLED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CALLBACK_CONTACTS_HANDLED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_ABANDONED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_AGENT_HUNG_UP_FIRST]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_CONSULTED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HANDLED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HANDLED_INCOMING]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HANDLED_OUTBOUND]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HOLD_ABANDONS]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_MISSED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_QUEUED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_IN]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_IN_FROM_QUEUE]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_OUT]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_OUT_FROM_QUEUE]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [HANDLE_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [HOLD_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [INTERACTION_AND_HOLD_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [INTERACTION_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [OCCUPANCY]
--     Unit: PERCENT
--
--     Statistic: AVG
--
-- [QUEUE_ANSWER_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [QUEUED_TIME]
--     Unit: SECONDS
--
--     Statistic: MAX
--
-- [SERVICE_LEVEL]
--     You can include up to 20 SERVICE_LEVEL metrics in a request.
--
--     Unit: PERCENT
--
--     Statistic: AVG
--
--     Threshold: For @ThresholdValue@, enter any whole number from 1 to
--     604800 (inclusive), in seconds. For @Comparison@, you must enter
--     @LT@ (for \"Less than\").
newGetMetricData ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'filters'
  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
      }

-- | The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
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)

-- | The grouping applied to the metrics returned. For example, when results
-- are grouped by queue, the metrics returned are grouped by queue. The
-- values returned apply to the metrics for each queue rather than
-- aggregated for all queues.
--
-- If no grouping is specified, a summary of metrics for all queues is
-- returned.
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

-- | The maximum number of results to return per page.
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)

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
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)

-- | The timestamp, in UNIX Epoch time format, at which to start the
-- reporting interval for the retrieval of historical metrics data. The
-- time must be specified using a multiple of 5 minutes, such as 10:05,
-- 10:10, 10:15.
--
-- The start time cannot be earlier than 24 hours before the time of the
-- request. Historical metrics are available only for 24 hours.
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

-- | The timestamp, in UNIX Epoch time format, at which to end the reporting
-- interval for the retrieval of historical metrics data. The time must be
-- specified using an interval of 5 minutes, such as 11:00, 11:05, 11:10,
-- and must be later than the start time timestamp.
--
-- The time range between the start and end time must be less than 24
-- hours.
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

-- | The queues, up to 100, or channels, to use to filter the metrics
-- returned. Metric data is retrieved only for the resources associated
-- with the queues or channels included in the filter. You can include both
-- queue IDs and queue ARNs in the same request. VOICE, CHAT, and TASK
-- channels are supported.
--
-- To filter by @Queues@, enter the queue ID\/ARN, not the name of the
-- queue.
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)

-- | The metrics to retrieve. Specify the name, unit, and statistic for each
-- metric. The following historical metrics are available. For a
-- description of each metric, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/historical-metrics-definitions.html Historical Metrics Definitions>
-- in the /Amazon Connect Administrator Guide/.
--
-- This API does not support a contacts incoming metric (there\'s no
-- CONTACTS_INCOMING metric missing from the documented list).
--
-- [ABANDON_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [AFTER_CONTACT_WORK_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [API_CONTACTS_HANDLED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CALLBACK_CONTACTS_HANDLED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_ABANDONED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_AGENT_HUNG_UP_FIRST]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_CONSULTED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HANDLED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HANDLED_INCOMING]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HANDLED_OUTBOUND]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_HOLD_ABANDONS]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_MISSED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_QUEUED]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_IN]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_IN_FROM_QUEUE]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_OUT]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [CONTACTS_TRANSFERRED_OUT_FROM_QUEUE]
--     Unit: COUNT
--
--     Statistic: SUM
--
-- [HANDLE_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [HOLD_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [INTERACTION_AND_HOLD_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [INTERACTION_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [OCCUPANCY]
--     Unit: PERCENT
--
--     Statistic: AVG
--
-- [QUEUE_ANSWER_TIME]
--     Unit: SECONDS
--
--     Statistic: AVG
--
-- [QUEUED_TIME]
--     Unit: SECONDS
--
--     Statistic: MAX
--
-- [SERVICE_LEVEL]
--     You can include up to 20 SERVICE_LEVEL metrics in a request.
--
--     Unit: PERCENT
--
--     Statistic: AVG
--
--     Threshold: For @ThresholdValue@, enter any whole number from 1 to
--     604800 (inclusive), in seconds. For @Comparison@, you must enter
--     @LT@ (for \"Less than\").
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

-- | /See:/ 'newGetMetricDataResponse' smart constructor.
data GetMetricDataResponse = GetMetricDataResponse'
  { -- | Information about the historical metrics.
    --
    -- If no grouping is specified, a summary of metric data is returned.
    GetMetricDataResponse -> Maybe [HistoricalMetricResult]
metricResults :: Prelude.Maybe [HistoricalMetricResult],
    -- | If there are additional results, this is the token for the next set of
    -- results.
    --
    -- The token expires after 5 minutes from the time it is created.
    -- Subsequent requests that use the token must use the same request
    -- parameters as the request that generated the token.
    GetMetricDataResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    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)

-- |
-- Create a value of 'GetMetricDataResponse' 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:
--
-- 'metricResults', 'getMetricDataResponse_metricResults' - Information about the historical metrics.
--
-- If no grouping is specified, a summary of metric data is returned.
--
-- 'nextToken', 'getMetricDataResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- The token expires after 5 minutes from the time it is created.
-- Subsequent requests that use the token must use the same request
-- parameters as the request that generated the token.
--
-- 'httpStatus', 'getMetricDataResponse_httpStatus' - The response's http status code.
newGetMetricDataResponse ::
  -- | 'httpStatus'
  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_
    }

-- | Information about the historical metrics.
--
-- If no grouping is specified, a summary of metric data is returned.
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

-- | If there are additional results, this is the token for the next set of
-- results.
--
-- The token expires after 5 minutes from the time it is created.
-- Subsequent requests that use the token must use the same request
-- parameters as the request that generated the token.
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)

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