{-# 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.Lightsail.GetInstanceMetricData
-- 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)
--
-- Returns the data points for the specified Amazon Lightsail instance
-- metric, given an instance name.
--
-- Metrics report the utilization of your resources, and the error counts
-- generated by them. Monitor and collect metric data regularly to maintain
-- the reliability, availability, and performance of your resources.
module Amazonka.Lightsail.GetInstanceMetricData
  ( -- * Creating a Request
    GetInstanceMetricData (..),
    newGetInstanceMetricData,

    -- * Request Lenses
    getInstanceMetricData_instanceName,
    getInstanceMetricData_metricName,
    getInstanceMetricData_period,
    getInstanceMetricData_startTime,
    getInstanceMetricData_endTime,
    getInstanceMetricData_unit,
    getInstanceMetricData_statistics,

    -- * Destructuring the Response
    GetInstanceMetricDataResponse (..),
    newGetInstanceMetricDataResponse,

    -- * Response Lenses
    getInstanceMetricDataResponse_metricName,
    getInstanceMetricDataResponse_metricData,
    getInstanceMetricDataResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetInstanceMetricData' smart constructor.
data GetInstanceMetricData = GetInstanceMetricData'
  { -- | The name of the instance for which you want to get metrics data.
    GetInstanceMetricData -> Text
instanceName :: Prelude.Text,
    -- | The metric for which you want to return information.
    --
    -- Valid instance metric names are listed below, along with the most useful
    -- @statistics@ to include in your request, and the published @unit@ value.
    --
    -- -   __@BurstCapacityPercentage@__ - The percentage of CPU performance
    --     available for your instance to burst above its baseline. Your
    --     instance continuously accrues and consumes burst capacity. Burst
    --     capacity stops accruing when your instance\'s
    --     @BurstCapacityPercentage@ reaches 100%. For more information, see
    --     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-instance-burst-capacity Viewing instance burst capacity in Amazon Lightsail>.
    --
    --     @Statistics@: The most useful statistics are @Maximum@ and
    --     @Average@.
    --
    --     @Unit@: The published unit is @Percent@.
    --
    -- -   __@BurstCapacityTime@__ - The available amount of time for your
    --     instance to burst at 100% CPU utilization. Your instance
    --     continuously accrues and consumes burst capacity. Burst capacity
    --     time stops accruing when your instance\'s @BurstCapacityPercentage@
    --     metric reaches 100%.
    --
    --     Burst capacity time is consumed at the full rate only when your
    --     instance operates at 100% CPU utilization. For example, if your
    --     instance operates at 50% CPU utilization in the burstable zone for a
    --     5-minute period, then it consumes CPU burst capacity minutes at a
    --     50% rate in that period. Your instance consumed 2 minutes and 30
    --     seconds of CPU burst capacity minutes in the 5-minute period. For
    --     more information, see
    --     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-instance-burst-capacity Viewing instance burst capacity in Amazon Lightsail>.
    --
    --     @Statistics@: The most useful statistics are @Maximum@ and
    --     @Average@.
    --
    --     @Unit@: The published unit is @Seconds@.
    --
    -- -   __@CPUUtilization@__ - The percentage of allocated compute units
    --     that are currently in use on the instance. This metric identifies
    --     the processing power to run the applications on the instance. Tools
    --     in your operating system can show a lower percentage than Lightsail
    --     when the instance is not allocated a full processor core.
    --
    --     @Statistics@: The most useful statistics are @Maximum@ and
    --     @Average@.
    --
    --     @Unit@: The published unit is @Percent@.
    --
    -- -   __@NetworkIn@__ - The number of bytes received on all network
    --     interfaces by the instance. This metric identifies the volume of
    --     incoming network traffic to the instance. The number reported is the
    --     number of bytes received during the period. Because this metric is
    --     reported in 5-minute intervals, divide the reported number by 300 to
    --     find Bytes\/second.
    --
    --     @Statistics@: The most useful statistic is @Sum@.
    --
    --     @Unit@: The published unit is @Bytes@.
    --
    -- -   __@NetworkOut@__ - The number of bytes sent out on all network
    --     interfaces by the instance. This metric identifies the volume of
    --     outgoing network traffic from the instance. The number reported is
    --     the number of bytes sent during the period. Because this metric is
    --     reported in 5-minute intervals, divide the reported number by 300 to
    --     find Bytes\/second.
    --
    --     @Statistics@: The most useful statistic is @Sum@.
    --
    --     @Unit@: The published unit is @Bytes@.
    --
    -- -   __@StatusCheckFailed@__ - Reports whether the instance passed or
    --     failed both the instance status check and the system status check.
    --     This metric can be either 0 (passed) or 1 (failed). This metric data
    --     is available in 1-minute (60 seconds) granularity.
    --
    --     @Statistics@: The most useful statistic is @Sum@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@StatusCheckFailed_Instance@__ - Reports whether the instance
    --     passed or failed the instance status check. This metric can be
    --     either 0 (passed) or 1 (failed). This metric data is available in
    --     1-minute (60 seconds) granularity.
    --
    --     @Statistics@: The most useful statistic is @Sum@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@StatusCheckFailed_System@__ - Reports whether the instance passed
    --     or failed the system status check. This metric can be either 0
    --     (passed) or 1 (failed). This metric data is available in 1-minute
    --     (60 seconds) granularity.
    --
    --     @Statistics@: The most useful statistic is @Sum@.
    --
    --     @Unit@: The published unit is @Count@.
    GetInstanceMetricData -> InstanceMetricName
metricName :: InstanceMetricName,
    -- | The granularity, in seconds, of the returned data points.
    --
    -- The @StatusCheckFailed@, @StatusCheckFailed_Instance@, and
    -- @StatusCheckFailed_System@ instance metric data is available in 1-minute
    -- (60 seconds) granularity. All other instance metric data is available in
    -- 5-minute (300 seconds) granularity.
    GetInstanceMetricData -> Natural
period :: Prelude.Natural,
    -- | The start time of the time period.
    GetInstanceMetricData -> POSIX
startTime :: Core.POSIX,
    -- | The end time of the time period.
    GetInstanceMetricData -> POSIX
endTime :: Core.POSIX,
    -- | The unit for the metric data request. Valid units depend on the metric
    -- data being requested. For the valid units to specify with each available
    -- metric, see the @metricName@ parameter.
    GetInstanceMetricData -> MetricUnit
unit :: MetricUnit,
    -- | The statistic for the metric.
    --
    -- The following statistics are available:
    --
    -- -   @Minimum@ - The lowest value observed during the specified period.
    --     Use this value to determine low volumes of activity for your
    --     application.
    --
    -- -   @Maximum@ - The highest value observed during the specified period.
    --     Use this value to determine high volumes of activity for your
    --     application.
    --
    -- -   @Sum@ - All values submitted for the matching metric added together.
    --     You can use this statistic to determine the total volume of a
    --     metric.
    --
    -- -   @Average@ - The value of Sum \/ SampleCount during the specified
    --     period. By comparing this statistic with the Minimum and Maximum
    --     values, you can determine the full scope of a metric and how close
    --     the average use is to the Minimum and Maximum values. This
    --     comparison helps you to know when to increase or decrease your
    --     resources.
    --
    -- -   @SampleCount@ - The count, or number, of data points used for the
    --     statistical calculation.
    GetInstanceMetricData -> [MetricStatistic]
statistics :: [MetricStatistic]
  }
  deriving (GetInstanceMetricData -> GetInstanceMetricData -> Bool
(GetInstanceMetricData -> GetInstanceMetricData -> Bool)
-> (GetInstanceMetricData -> GetInstanceMetricData -> Bool)
-> Eq GetInstanceMetricData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceMetricData -> GetInstanceMetricData -> Bool
$c/= :: GetInstanceMetricData -> GetInstanceMetricData -> Bool
== :: GetInstanceMetricData -> GetInstanceMetricData -> Bool
$c== :: GetInstanceMetricData -> GetInstanceMetricData -> Bool
Prelude.Eq, ReadPrec [GetInstanceMetricData]
ReadPrec GetInstanceMetricData
Int -> ReadS GetInstanceMetricData
ReadS [GetInstanceMetricData]
(Int -> ReadS GetInstanceMetricData)
-> ReadS [GetInstanceMetricData]
-> ReadPrec GetInstanceMetricData
-> ReadPrec [GetInstanceMetricData]
-> Read GetInstanceMetricData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceMetricData]
$creadListPrec :: ReadPrec [GetInstanceMetricData]
readPrec :: ReadPrec GetInstanceMetricData
$creadPrec :: ReadPrec GetInstanceMetricData
readList :: ReadS [GetInstanceMetricData]
$creadList :: ReadS [GetInstanceMetricData]
readsPrec :: Int -> ReadS GetInstanceMetricData
$creadsPrec :: Int -> ReadS GetInstanceMetricData
Prelude.Read, Int -> GetInstanceMetricData -> ShowS
[GetInstanceMetricData] -> ShowS
GetInstanceMetricData -> String
(Int -> GetInstanceMetricData -> ShowS)
-> (GetInstanceMetricData -> String)
-> ([GetInstanceMetricData] -> ShowS)
-> Show GetInstanceMetricData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceMetricData] -> ShowS
$cshowList :: [GetInstanceMetricData] -> ShowS
show :: GetInstanceMetricData -> String
$cshow :: GetInstanceMetricData -> String
showsPrec :: Int -> GetInstanceMetricData -> ShowS
$cshowsPrec :: Int -> GetInstanceMetricData -> ShowS
Prelude.Show, (forall x. GetInstanceMetricData -> Rep GetInstanceMetricData x)
-> (forall x. Rep GetInstanceMetricData x -> GetInstanceMetricData)
-> Generic GetInstanceMetricData
forall x. Rep GetInstanceMetricData x -> GetInstanceMetricData
forall x. GetInstanceMetricData -> Rep GetInstanceMetricData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInstanceMetricData x -> GetInstanceMetricData
$cfrom :: forall x. GetInstanceMetricData -> Rep GetInstanceMetricData x
Prelude.Generic)

-- |
-- Create a value of 'GetInstanceMetricData' 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:
--
-- 'instanceName', 'getInstanceMetricData_instanceName' - The name of the instance for which you want to get metrics data.
--
-- 'metricName', 'getInstanceMetricData_metricName' - The metric for which you want to return information.
--
-- Valid instance metric names are listed below, along with the most useful
-- @statistics@ to include in your request, and the published @unit@ value.
--
-- -   __@BurstCapacityPercentage@__ - The percentage of CPU performance
--     available for your instance to burst above its baseline. Your
--     instance continuously accrues and consumes burst capacity. Burst
--     capacity stops accruing when your instance\'s
--     @BurstCapacityPercentage@ reaches 100%. For more information, see
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-instance-burst-capacity Viewing instance burst capacity in Amazon Lightsail>.
--
--     @Statistics@: The most useful statistics are @Maximum@ and
--     @Average@.
--
--     @Unit@: The published unit is @Percent@.
--
-- -   __@BurstCapacityTime@__ - The available amount of time for your
--     instance to burst at 100% CPU utilization. Your instance
--     continuously accrues and consumes burst capacity. Burst capacity
--     time stops accruing when your instance\'s @BurstCapacityPercentage@
--     metric reaches 100%.
--
--     Burst capacity time is consumed at the full rate only when your
--     instance operates at 100% CPU utilization. For example, if your
--     instance operates at 50% CPU utilization in the burstable zone for a
--     5-minute period, then it consumes CPU burst capacity minutes at a
--     50% rate in that period. Your instance consumed 2 minutes and 30
--     seconds of CPU burst capacity minutes in the 5-minute period. For
--     more information, see
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-instance-burst-capacity Viewing instance burst capacity in Amazon Lightsail>.
--
--     @Statistics@: The most useful statistics are @Maximum@ and
--     @Average@.
--
--     @Unit@: The published unit is @Seconds@.
--
-- -   __@CPUUtilization@__ - The percentage of allocated compute units
--     that are currently in use on the instance. This metric identifies
--     the processing power to run the applications on the instance. Tools
--     in your operating system can show a lower percentage than Lightsail
--     when the instance is not allocated a full processor core.
--
--     @Statistics@: The most useful statistics are @Maximum@ and
--     @Average@.
--
--     @Unit@: The published unit is @Percent@.
--
-- -   __@NetworkIn@__ - The number of bytes received on all network
--     interfaces by the instance. This metric identifies the volume of
--     incoming network traffic to the instance. The number reported is the
--     number of bytes received during the period. Because this metric is
--     reported in 5-minute intervals, divide the reported number by 300 to
--     find Bytes\/second.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Bytes@.
--
-- -   __@NetworkOut@__ - The number of bytes sent out on all network
--     interfaces by the instance. This metric identifies the volume of
--     outgoing network traffic from the instance. The number reported is
--     the number of bytes sent during the period. Because this metric is
--     reported in 5-minute intervals, divide the reported number by 300 to
--     find Bytes\/second.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Bytes@.
--
-- -   __@StatusCheckFailed@__ - Reports whether the instance passed or
--     failed both the instance status check and the system status check.
--     This metric can be either 0 (passed) or 1 (failed). This metric data
--     is available in 1-minute (60 seconds) granularity.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@StatusCheckFailed_Instance@__ - Reports whether the instance
--     passed or failed the instance status check. This metric can be
--     either 0 (passed) or 1 (failed). This metric data is available in
--     1-minute (60 seconds) granularity.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@StatusCheckFailed_System@__ - Reports whether the instance passed
--     or failed the system status check. This metric can be either 0
--     (passed) or 1 (failed). This metric data is available in 1-minute
--     (60 seconds) granularity.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- 'period', 'getInstanceMetricData_period' - The granularity, in seconds, of the returned data points.
--
-- The @StatusCheckFailed@, @StatusCheckFailed_Instance@, and
-- @StatusCheckFailed_System@ instance metric data is available in 1-minute
-- (60 seconds) granularity. All other instance metric data is available in
-- 5-minute (300 seconds) granularity.
--
-- 'startTime', 'getInstanceMetricData_startTime' - The start time of the time period.
--
-- 'endTime', 'getInstanceMetricData_endTime' - The end time of the time period.
--
-- 'unit', 'getInstanceMetricData_unit' - The unit for the metric data request. Valid units depend on the metric
-- data being requested. For the valid units to specify with each available
-- metric, see the @metricName@ parameter.
--
-- 'statistics', 'getInstanceMetricData_statistics' - The statistic for the metric.
--
-- The following statistics are available:
--
-- -   @Minimum@ - The lowest value observed during the specified period.
--     Use this value to determine low volumes of activity for your
--     application.
--
-- -   @Maximum@ - The highest value observed during the specified period.
--     Use this value to determine high volumes of activity for your
--     application.
--
-- -   @Sum@ - All values submitted for the matching metric added together.
--     You can use this statistic to determine the total volume of a
--     metric.
--
-- -   @Average@ - The value of Sum \/ SampleCount during the specified
--     period. By comparing this statistic with the Minimum and Maximum
--     values, you can determine the full scope of a metric and how close
--     the average use is to the Minimum and Maximum values. This
--     comparison helps you to know when to increase or decrease your
--     resources.
--
-- -   @SampleCount@ - The count, or number, of data points used for the
--     statistical calculation.
newGetInstanceMetricData ::
  -- | 'instanceName'
  Prelude.Text ->
  -- | 'metricName'
  InstanceMetricName ->
  -- | 'period'
  Prelude.Natural ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'unit'
  MetricUnit ->
  GetInstanceMetricData
newGetInstanceMetricData :: Text
-> InstanceMetricName
-> Natural
-> UTCTime
-> UTCTime
-> MetricUnit
-> GetInstanceMetricData
newGetInstanceMetricData
  Text
pInstanceName_
  InstanceMetricName
pMetricName_
  Natural
pPeriod_
  UTCTime
pStartTime_
  UTCTime
pEndTime_
  MetricUnit
pUnit_ =
    GetInstanceMetricData' :: Text
-> InstanceMetricName
-> Natural
-> POSIX
-> POSIX
-> MetricUnit
-> [MetricStatistic]
-> GetInstanceMetricData
GetInstanceMetricData'
      { $sel:instanceName:GetInstanceMetricData' :: Text
instanceName =
          Text
pInstanceName_,
        $sel:metricName:GetInstanceMetricData' :: InstanceMetricName
metricName = InstanceMetricName
pMetricName_,
        $sel:period:GetInstanceMetricData' :: Natural
period = Natural
pPeriod_,
        $sel:startTime:GetInstanceMetricData' :: 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:GetInstanceMetricData' :: 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:unit:GetInstanceMetricData' :: MetricUnit
unit = MetricUnit
pUnit_,
        $sel:statistics:GetInstanceMetricData' :: [MetricStatistic]
statistics = [MetricStatistic]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The name of the instance for which you want to get metrics data.
getInstanceMetricData_instanceName :: Lens.Lens' GetInstanceMetricData Prelude.Text
getInstanceMetricData_instanceName :: (Text -> f Text)
-> GetInstanceMetricData -> f GetInstanceMetricData
getInstanceMetricData_instanceName = (GetInstanceMetricData -> Text)
-> (GetInstanceMetricData -> Text -> GetInstanceMetricData)
-> Lens GetInstanceMetricData GetInstanceMetricData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricData' {Text
instanceName :: Text
$sel:instanceName:GetInstanceMetricData' :: GetInstanceMetricData -> Text
instanceName} -> Text
instanceName) (\s :: GetInstanceMetricData
s@GetInstanceMetricData' {} Text
a -> GetInstanceMetricData
s {$sel:instanceName:GetInstanceMetricData' :: Text
instanceName = Text
a} :: GetInstanceMetricData)

-- | The metric for which you want to return information.
--
-- Valid instance metric names are listed below, along with the most useful
-- @statistics@ to include in your request, and the published @unit@ value.
--
-- -   __@BurstCapacityPercentage@__ - The percentage of CPU performance
--     available for your instance to burst above its baseline. Your
--     instance continuously accrues and consumes burst capacity. Burst
--     capacity stops accruing when your instance\'s
--     @BurstCapacityPercentage@ reaches 100%. For more information, see
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-instance-burst-capacity Viewing instance burst capacity in Amazon Lightsail>.
--
--     @Statistics@: The most useful statistics are @Maximum@ and
--     @Average@.
--
--     @Unit@: The published unit is @Percent@.
--
-- -   __@BurstCapacityTime@__ - The available amount of time for your
--     instance to burst at 100% CPU utilization. Your instance
--     continuously accrues and consumes burst capacity. Burst capacity
--     time stops accruing when your instance\'s @BurstCapacityPercentage@
--     metric reaches 100%.
--
--     Burst capacity time is consumed at the full rate only when your
--     instance operates at 100% CPU utilization. For example, if your
--     instance operates at 50% CPU utilization in the burstable zone for a
--     5-minute period, then it consumes CPU burst capacity minutes at a
--     50% rate in that period. Your instance consumed 2 minutes and 30
--     seconds of CPU burst capacity minutes in the 5-minute period. For
--     more information, see
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-instance-burst-capacity Viewing instance burst capacity in Amazon Lightsail>.
--
--     @Statistics@: The most useful statistics are @Maximum@ and
--     @Average@.
--
--     @Unit@: The published unit is @Seconds@.
--
-- -   __@CPUUtilization@__ - The percentage of allocated compute units
--     that are currently in use on the instance. This metric identifies
--     the processing power to run the applications on the instance. Tools
--     in your operating system can show a lower percentage than Lightsail
--     when the instance is not allocated a full processor core.
--
--     @Statistics@: The most useful statistics are @Maximum@ and
--     @Average@.
--
--     @Unit@: The published unit is @Percent@.
--
-- -   __@NetworkIn@__ - The number of bytes received on all network
--     interfaces by the instance. This metric identifies the volume of
--     incoming network traffic to the instance. The number reported is the
--     number of bytes received during the period. Because this metric is
--     reported in 5-minute intervals, divide the reported number by 300 to
--     find Bytes\/second.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Bytes@.
--
-- -   __@NetworkOut@__ - The number of bytes sent out on all network
--     interfaces by the instance. This metric identifies the volume of
--     outgoing network traffic from the instance. The number reported is
--     the number of bytes sent during the period. Because this metric is
--     reported in 5-minute intervals, divide the reported number by 300 to
--     find Bytes\/second.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Bytes@.
--
-- -   __@StatusCheckFailed@__ - Reports whether the instance passed or
--     failed both the instance status check and the system status check.
--     This metric can be either 0 (passed) or 1 (failed). This metric data
--     is available in 1-minute (60 seconds) granularity.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@StatusCheckFailed_Instance@__ - Reports whether the instance
--     passed or failed the instance status check. This metric can be
--     either 0 (passed) or 1 (failed). This metric data is available in
--     1-minute (60 seconds) granularity.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@StatusCheckFailed_System@__ - Reports whether the instance passed
--     or failed the system status check. This metric can be either 0
--     (passed) or 1 (failed). This metric data is available in 1-minute
--     (60 seconds) granularity.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
getInstanceMetricData_metricName :: Lens.Lens' GetInstanceMetricData InstanceMetricName
getInstanceMetricData_metricName :: (InstanceMetricName -> f InstanceMetricName)
-> GetInstanceMetricData -> f GetInstanceMetricData
getInstanceMetricData_metricName = (GetInstanceMetricData -> InstanceMetricName)
-> (GetInstanceMetricData
    -> InstanceMetricName -> GetInstanceMetricData)
-> Lens
     GetInstanceMetricData
     GetInstanceMetricData
     InstanceMetricName
     InstanceMetricName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricData' {InstanceMetricName
metricName :: InstanceMetricName
$sel:metricName:GetInstanceMetricData' :: GetInstanceMetricData -> InstanceMetricName
metricName} -> InstanceMetricName
metricName) (\s :: GetInstanceMetricData
s@GetInstanceMetricData' {} InstanceMetricName
a -> GetInstanceMetricData
s {$sel:metricName:GetInstanceMetricData' :: InstanceMetricName
metricName = InstanceMetricName
a} :: GetInstanceMetricData)

-- | The granularity, in seconds, of the returned data points.
--
-- The @StatusCheckFailed@, @StatusCheckFailed_Instance@, and
-- @StatusCheckFailed_System@ instance metric data is available in 1-minute
-- (60 seconds) granularity. All other instance metric data is available in
-- 5-minute (300 seconds) granularity.
getInstanceMetricData_period :: Lens.Lens' GetInstanceMetricData Prelude.Natural
getInstanceMetricData_period :: (Natural -> f Natural)
-> GetInstanceMetricData -> f GetInstanceMetricData
getInstanceMetricData_period = (GetInstanceMetricData -> Natural)
-> (GetInstanceMetricData -> Natural -> GetInstanceMetricData)
-> Lens GetInstanceMetricData GetInstanceMetricData Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricData' {Natural
period :: Natural
$sel:period:GetInstanceMetricData' :: GetInstanceMetricData -> Natural
period} -> Natural
period) (\s :: GetInstanceMetricData
s@GetInstanceMetricData' {} Natural
a -> GetInstanceMetricData
s {$sel:period:GetInstanceMetricData' :: Natural
period = Natural
a} :: GetInstanceMetricData)

-- | The start time of the time period.
getInstanceMetricData_startTime :: Lens.Lens' GetInstanceMetricData Prelude.UTCTime
getInstanceMetricData_startTime :: (UTCTime -> f UTCTime)
-> GetInstanceMetricData -> f GetInstanceMetricData
getInstanceMetricData_startTime = (GetInstanceMetricData -> POSIX)
-> (GetInstanceMetricData -> POSIX -> GetInstanceMetricData)
-> Lens GetInstanceMetricData GetInstanceMetricData POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricData' {POSIX
startTime :: POSIX
$sel:startTime:GetInstanceMetricData' :: GetInstanceMetricData -> POSIX
startTime} -> POSIX
startTime) (\s :: GetInstanceMetricData
s@GetInstanceMetricData' {} POSIX
a -> GetInstanceMetricData
s {$sel:startTime:GetInstanceMetricData' :: POSIX
startTime = POSIX
a} :: GetInstanceMetricData) ((POSIX -> f POSIX)
 -> GetInstanceMetricData -> f GetInstanceMetricData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetInstanceMetricData
-> f GetInstanceMetricData
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 end time of the time period.
getInstanceMetricData_endTime :: Lens.Lens' GetInstanceMetricData Prelude.UTCTime
getInstanceMetricData_endTime :: (UTCTime -> f UTCTime)
-> GetInstanceMetricData -> f GetInstanceMetricData
getInstanceMetricData_endTime = (GetInstanceMetricData -> POSIX)
-> (GetInstanceMetricData -> POSIX -> GetInstanceMetricData)
-> Lens GetInstanceMetricData GetInstanceMetricData POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricData' {POSIX
endTime :: POSIX
$sel:endTime:GetInstanceMetricData' :: GetInstanceMetricData -> POSIX
endTime} -> POSIX
endTime) (\s :: GetInstanceMetricData
s@GetInstanceMetricData' {} POSIX
a -> GetInstanceMetricData
s {$sel:endTime:GetInstanceMetricData' :: POSIX
endTime = POSIX
a} :: GetInstanceMetricData) ((POSIX -> f POSIX)
 -> GetInstanceMetricData -> f GetInstanceMetricData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetInstanceMetricData
-> f GetInstanceMetricData
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 unit for the metric data request. Valid units depend on the metric
-- data being requested. For the valid units to specify with each available
-- metric, see the @metricName@ parameter.
getInstanceMetricData_unit :: Lens.Lens' GetInstanceMetricData MetricUnit
getInstanceMetricData_unit :: (MetricUnit -> f MetricUnit)
-> GetInstanceMetricData -> f GetInstanceMetricData
getInstanceMetricData_unit = (GetInstanceMetricData -> MetricUnit)
-> (GetInstanceMetricData -> MetricUnit -> GetInstanceMetricData)
-> Lens
     GetInstanceMetricData GetInstanceMetricData MetricUnit MetricUnit
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricData' {MetricUnit
unit :: MetricUnit
$sel:unit:GetInstanceMetricData' :: GetInstanceMetricData -> MetricUnit
unit} -> MetricUnit
unit) (\s :: GetInstanceMetricData
s@GetInstanceMetricData' {} MetricUnit
a -> GetInstanceMetricData
s {$sel:unit:GetInstanceMetricData' :: MetricUnit
unit = MetricUnit
a} :: GetInstanceMetricData)

-- | The statistic for the metric.
--
-- The following statistics are available:
--
-- -   @Minimum@ - The lowest value observed during the specified period.
--     Use this value to determine low volumes of activity for your
--     application.
--
-- -   @Maximum@ - The highest value observed during the specified period.
--     Use this value to determine high volumes of activity for your
--     application.
--
-- -   @Sum@ - All values submitted for the matching metric added together.
--     You can use this statistic to determine the total volume of a
--     metric.
--
-- -   @Average@ - The value of Sum \/ SampleCount during the specified
--     period. By comparing this statistic with the Minimum and Maximum
--     values, you can determine the full scope of a metric and how close
--     the average use is to the Minimum and Maximum values. This
--     comparison helps you to know when to increase or decrease your
--     resources.
--
-- -   @SampleCount@ - The count, or number, of data points used for the
--     statistical calculation.
getInstanceMetricData_statistics :: Lens.Lens' GetInstanceMetricData [MetricStatistic]
getInstanceMetricData_statistics :: ([MetricStatistic] -> f [MetricStatistic])
-> GetInstanceMetricData -> f GetInstanceMetricData
getInstanceMetricData_statistics = (GetInstanceMetricData -> [MetricStatistic])
-> (GetInstanceMetricData
    -> [MetricStatistic] -> GetInstanceMetricData)
-> Lens
     GetInstanceMetricData
     GetInstanceMetricData
     [MetricStatistic]
     [MetricStatistic]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricData' {[MetricStatistic]
statistics :: [MetricStatistic]
$sel:statistics:GetInstanceMetricData' :: GetInstanceMetricData -> [MetricStatistic]
statistics} -> [MetricStatistic]
statistics) (\s :: GetInstanceMetricData
s@GetInstanceMetricData' {} [MetricStatistic]
a -> GetInstanceMetricData
s {$sel:statistics:GetInstanceMetricData' :: [MetricStatistic]
statistics = [MetricStatistic]
a} :: GetInstanceMetricData) (([MetricStatistic] -> f [MetricStatistic])
 -> GetInstanceMetricData -> f GetInstanceMetricData)
-> (([MetricStatistic] -> f [MetricStatistic])
    -> [MetricStatistic] -> f [MetricStatistic])
-> ([MetricStatistic] -> f [MetricStatistic])
-> GetInstanceMetricData
-> f GetInstanceMetricData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MetricStatistic] -> f [MetricStatistic])
-> [MetricStatistic] -> f [MetricStatistic]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest GetInstanceMetricData where
  type
    AWSResponse GetInstanceMetricData =
      GetInstanceMetricDataResponse
  request :: GetInstanceMetricData -> Request GetInstanceMetricData
request = Service -> GetInstanceMetricData -> Request GetInstanceMetricData
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetInstanceMetricData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInstanceMetricData)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetInstanceMetricData))
-> Logger
-> Service
-> Proxy GetInstanceMetricData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInstanceMetricData)))
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 InstanceMetricName
-> Maybe [MetricDatapoint] -> Int -> GetInstanceMetricDataResponse
GetInstanceMetricDataResponse'
            (Maybe InstanceMetricName
 -> Maybe [MetricDatapoint] -> Int -> GetInstanceMetricDataResponse)
-> Either String (Maybe InstanceMetricName)
-> Either
     String
     (Maybe [MetricDatapoint] -> Int -> GetInstanceMetricDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe InstanceMetricName)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"metricName")
            Either
  String
  (Maybe [MetricDatapoint] -> Int -> GetInstanceMetricDataResponse)
-> Either String (Maybe [MetricDatapoint])
-> Either String (Int -> GetInstanceMetricDataResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [MetricDatapoint]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"metricData" Either String (Maybe (Maybe [MetricDatapoint]))
-> Maybe [MetricDatapoint]
-> Either String (Maybe [MetricDatapoint])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MetricDatapoint]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> GetInstanceMetricDataResponse)
-> Either String Int -> Either String GetInstanceMetricDataResponse
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 GetInstanceMetricData

instance Prelude.NFData GetInstanceMetricData

instance Core.ToHeaders GetInstanceMetricData where
  toHeaders :: GetInstanceMetricData -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetInstanceMetricData -> 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
"Lightsail_20161128.GetInstanceMetricData" ::
                          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 GetInstanceMetricData where
  toJSON :: GetInstanceMetricData -> Value
toJSON GetInstanceMetricData' {Natural
[MetricStatistic]
Text
POSIX
InstanceMetricName
MetricUnit
statistics :: [MetricStatistic]
unit :: MetricUnit
endTime :: POSIX
startTime :: POSIX
period :: Natural
metricName :: InstanceMetricName
instanceName :: Text
$sel:statistics:GetInstanceMetricData' :: GetInstanceMetricData -> [MetricStatistic]
$sel:unit:GetInstanceMetricData' :: GetInstanceMetricData -> MetricUnit
$sel:endTime:GetInstanceMetricData' :: GetInstanceMetricData -> POSIX
$sel:startTime:GetInstanceMetricData' :: GetInstanceMetricData -> POSIX
$sel:period:GetInstanceMetricData' :: GetInstanceMetricData -> Natural
$sel:metricName:GetInstanceMetricData' :: GetInstanceMetricData -> InstanceMetricName
$sel:instanceName:GetInstanceMetricData' :: GetInstanceMetricData -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"instanceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"metricName" Text -> InstanceMetricName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InstanceMetricName
metricName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"period" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
period),
            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
"unit" Text -> MetricUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MetricUnit
unit),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"statistics" Text -> [MetricStatistic] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [MetricStatistic]
statistics)
          ]
      )

instance Core.ToPath GetInstanceMetricData where
  toPath :: GetInstanceMetricData -> ByteString
toPath = ByteString -> GetInstanceMetricData -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery GetInstanceMetricData where
  toQuery :: GetInstanceMetricData -> QueryString
toQuery = QueryString -> GetInstanceMetricData -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetInstanceMetricDataResponse' smart constructor.
data GetInstanceMetricDataResponse = GetInstanceMetricDataResponse'
  { -- | The name of the metric returned.
    GetInstanceMetricDataResponse -> Maybe InstanceMetricName
metricName :: Prelude.Maybe InstanceMetricName,
    -- | An array of objects that describe the metric data returned.
    GetInstanceMetricDataResponse -> Maybe [MetricDatapoint]
metricData :: Prelude.Maybe [MetricDatapoint],
    -- | The response's http status code.
    GetInstanceMetricDataResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetInstanceMetricDataResponse
-> GetInstanceMetricDataResponse -> Bool
(GetInstanceMetricDataResponse
 -> GetInstanceMetricDataResponse -> Bool)
-> (GetInstanceMetricDataResponse
    -> GetInstanceMetricDataResponse -> Bool)
-> Eq GetInstanceMetricDataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceMetricDataResponse
-> GetInstanceMetricDataResponse -> Bool
$c/= :: GetInstanceMetricDataResponse
-> GetInstanceMetricDataResponse -> Bool
== :: GetInstanceMetricDataResponse
-> GetInstanceMetricDataResponse -> Bool
$c== :: GetInstanceMetricDataResponse
-> GetInstanceMetricDataResponse -> Bool
Prelude.Eq, ReadPrec [GetInstanceMetricDataResponse]
ReadPrec GetInstanceMetricDataResponse
Int -> ReadS GetInstanceMetricDataResponse
ReadS [GetInstanceMetricDataResponse]
(Int -> ReadS GetInstanceMetricDataResponse)
-> ReadS [GetInstanceMetricDataResponse]
-> ReadPrec GetInstanceMetricDataResponse
-> ReadPrec [GetInstanceMetricDataResponse]
-> Read GetInstanceMetricDataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceMetricDataResponse]
$creadListPrec :: ReadPrec [GetInstanceMetricDataResponse]
readPrec :: ReadPrec GetInstanceMetricDataResponse
$creadPrec :: ReadPrec GetInstanceMetricDataResponse
readList :: ReadS [GetInstanceMetricDataResponse]
$creadList :: ReadS [GetInstanceMetricDataResponse]
readsPrec :: Int -> ReadS GetInstanceMetricDataResponse
$creadsPrec :: Int -> ReadS GetInstanceMetricDataResponse
Prelude.Read, Int -> GetInstanceMetricDataResponse -> ShowS
[GetInstanceMetricDataResponse] -> ShowS
GetInstanceMetricDataResponse -> String
(Int -> GetInstanceMetricDataResponse -> ShowS)
-> (GetInstanceMetricDataResponse -> String)
-> ([GetInstanceMetricDataResponse] -> ShowS)
-> Show GetInstanceMetricDataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceMetricDataResponse] -> ShowS
$cshowList :: [GetInstanceMetricDataResponse] -> ShowS
show :: GetInstanceMetricDataResponse -> String
$cshow :: GetInstanceMetricDataResponse -> String
showsPrec :: Int -> GetInstanceMetricDataResponse -> ShowS
$cshowsPrec :: Int -> GetInstanceMetricDataResponse -> ShowS
Prelude.Show, (forall x.
 GetInstanceMetricDataResponse
 -> Rep GetInstanceMetricDataResponse x)
-> (forall x.
    Rep GetInstanceMetricDataResponse x
    -> GetInstanceMetricDataResponse)
-> Generic GetInstanceMetricDataResponse
forall x.
Rep GetInstanceMetricDataResponse x
-> GetInstanceMetricDataResponse
forall x.
GetInstanceMetricDataResponse
-> Rep GetInstanceMetricDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInstanceMetricDataResponse x
-> GetInstanceMetricDataResponse
$cfrom :: forall x.
GetInstanceMetricDataResponse
-> Rep GetInstanceMetricDataResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetInstanceMetricDataResponse' 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:
--
-- 'metricName', 'getInstanceMetricDataResponse_metricName' - The name of the metric returned.
--
-- 'metricData', 'getInstanceMetricDataResponse_metricData' - An array of objects that describe the metric data returned.
--
-- 'httpStatus', 'getInstanceMetricDataResponse_httpStatus' - The response's http status code.
newGetInstanceMetricDataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetInstanceMetricDataResponse
newGetInstanceMetricDataResponse :: Int -> GetInstanceMetricDataResponse
newGetInstanceMetricDataResponse Int
pHttpStatus_ =
  GetInstanceMetricDataResponse' :: Maybe InstanceMetricName
-> Maybe [MetricDatapoint] -> Int -> GetInstanceMetricDataResponse
GetInstanceMetricDataResponse'
    { $sel:metricName:GetInstanceMetricDataResponse' :: Maybe InstanceMetricName
metricName =
        Maybe InstanceMetricName
forall a. Maybe a
Prelude.Nothing,
      $sel:metricData:GetInstanceMetricDataResponse' :: Maybe [MetricDatapoint]
metricData = Maybe [MetricDatapoint]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetInstanceMetricDataResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The name of the metric returned.
getInstanceMetricDataResponse_metricName :: Lens.Lens' GetInstanceMetricDataResponse (Prelude.Maybe InstanceMetricName)
getInstanceMetricDataResponse_metricName :: (Maybe InstanceMetricName -> f (Maybe InstanceMetricName))
-> GetInstanceMetricDataResponse -> f GetInstanceMetricDataResponse
getInstanceMetricDataResponse_metricName = (GetInstanceMetricDataResponse -> Maybe InstanceMetricName)
-> (GetInstanceMetricDataResponse
    -> Maybe InstanceMetricName -> GetInstanceMetricDataResponse)
-> Lens
     GetInstanceMetricDataResponse
     GetInstanceMetricDataResponse
     (Maybe InstanceMetricName)
     (Maybe InstanceMetricName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricDataResponse' {Maybe InstanceMetricName
metricName :: Maybe InstanceMetricName
$sel:metricName:GetInstanceMetricDataResponse' :: GetInstanceMetricDataResponse -> Maybe InstanceMetricName
metricName} -> Maybe InstanceMetricName
metricName) (\s :: GetInstanceMetricDataResponse
s@GetInstanceMetricDataResponse' {} Maybe InstanceMetricName
a -> GetInstanceMetricDataResponse
s {$sel:metricName:GetInstanceMetricDataResponse' :: Maybe InstanceMetricName
metricName = Maybe InstanceMetricName
a} :: GetInstanceMetricDataResponse)

-- | An array of objects that describe the metric data returned.
getInstanceMetricDataResponse_metricData :: Lens.Lens' GetInstanceMetricDataResponse (Prelude.Maybe [MetricDatapoint])
getInstanceMetricDataResponse_metricData :: (Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
-> GetInstanceMetricDataResponse -> f GetInstanceMetricDataResponse
getInstanceMetricDataResponse_metricData = (GetInstanceMetricDataResponse -> Maybe [MetricDatapoint])
-> (GetInstanceMetricDataResponse
    -> Maybe [MetricDatapoint] -> GetInstanceMetricDataResponse)
-> Lens
     GetInstanceMetricDataResponse
     GetInstanceMetricDataResponse
     (Maybe [MetricDatapoint])
     (Maybe [MetricDatapoint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricDataResponse' {Maybe [MetricDatapoint]
metricData :: Maybe [MetricDatapoint]
$sel:metricData:GetInstanceMetricDataResponse' :: GetInstanceMetricDataResponse -> Maybe [MetricDatapoint]
metricData} -> Maybe [MetricDatapoint]
metricData) (\s :: GetInstanceMetricDataResponse
s@GetInstanceMetricDataResponse' {} Maybe [MetricDatapoint]
a -> GetInstanceMetricDataResponse
s {$sel:metricData:GetInstanceMetricDataResponse' :: Maybe [MetricDatapoint]
metricData = Maybe [MetricDatapoint]
a} :: GetInstanceMetricDataResponse) ((Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
 -> GetInstanceMetricDataResponse
 -> f GetInstanceMetricDataResponse)
-> ((Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
    -> Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
-> (Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
-> GetInstanceMetricDataResponse
-> f GetInstanceMetricDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MetricDatapoint]
  [MetricDatapoint]
  [MetricDatapoint]
  [MetricDatapoint]
-> Iso
     (Maybe [MetricDatapoint])
     (Maybe [MetricDatapoint])
     (Maybe [MetricDatapoint])
     (Maybe [MetricDatapoint])
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
  [MetricDatapoint]
  [MetricDatapoint]
  [MetricDatapoint]
  [MetricDatapoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
getInstanceMetricDataResponse_httpStatus :: Lens.Lens' GetInstanceMetricDataResponse Prelude.Int
getInstanceMetricDataResponse_httpStatus :: (Int -> f Int)
-> GetInstanceMetricDataResponse -> f GetInstanceMetricDataResponse
getInstanceMetricDataResponse_httpStatus = (GetInstanceMetricDataResponse -> Int)
-> (GetInstanceMetricDataResponse
    -> Int -> GetInstanceMetricDataResponse)
-> Lens
     GetInstanceMetricDataResponse GetInstanceMetricDataResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceMetricDataResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInstanceMetricDataResponse' :: GetInstanceMetricDataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInstanceMetricDataResponse
s@GetInstanceMetricDataResponse' {} Int
a -> GetInstanceMetricDataResponse
s {$sel:httpStatus:GetInstanceMetricDataResponse' :: Int
httpStatus = Int
a} :: GetInstanceMetricDataResponse)

instance Prelude.NFData GetInstanceMetricDataResponse