{-# 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.GetLoadBalancerMetricData
-- 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 information about health metrics for your Lightsail load
-- balancer.
--
-- 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.GetLoadBalancerMetricData
  ( -- * Creating a Request
    GetLoadBalancerMetricData (..),
    newGetLoadBalancerMetricData,

    -- * Request Lenses
    getLoadBalancerMetricData_loadBalancerName,
    getLoadBalancerMetricData_metricName,
    getLoadBalancerMetricData_period,
    getLoadBalancerMetricData_startTime,
    getLoadBalancerMetricData_endTime,
    getLoadBalancerMetricData_unit,
    getLoadBalancerMetricData_statistics,

    -- * Destructuring the Response
    GetLoadBalancerMetricDataResponse (..),
    newGetLoadBalancerMetricDataResponse,

    -- * Response Lenses
    getLoadBalancerMetricDataResponse_metricName,
    getLoadBalancerMetricDataResponse_metricData,
    getLoadBalancerMetricDataResponse_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:/ 'newGetLoadBalancerMetricData' smart constructor.
data GetLoadBalancerMetricData = GetLoadBalancerMetricData'
  { -- | The name of the load balancer.
    GetLoadBalancerMetricData -> Text
loadBalancerName :: Prelude.Text,
    -- | The metric for which you want to return information.
    --
    -- Valid load balancer metric names are listed below, along with the most
    -- useful @statistics@ to include in your request, and the published @unit@
    -- value.
    --
    -- -   __@ClientTLSNegotiationErrorCount@__ - The number of TLS connections
    --     initiated by the client that did not establish a session with the
    --     load balancer due to a TLS error generated by the load balancer.
    --     Possible causes include a mismatch of ciphers or protocols.
    --
    --     @Statistics@: The most useful statistic is @Sum@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@HealthyHostCount@__ - The number of target instances that are
    --     considered healthy.
    --
    --     @Statistics@: The most useful statistic are @Average@, @Minimum@,
    --     and @Maximum@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@HTTPCode_Instance_2XX_Count@__ - The number of HTTP 2XX response
    --     codes generated by the target instances. This does not include any
    --     response codes generated by the load balancer.
    --
    --     @Statistics@: The most useful statistic is @Sum@. Note that
    --     @Minimum@, @Maximum@, and @Average@ all return @1@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@HTTPCode_Instance_3XX_Count@__ - The number of HTTP 3XX response
    --     codes generated by the target instances. This does not include any
    --     response codes generated by the load balancer.
    --
    --     @Statistics@: The most useful statistic is @Sum@. Note that
    --     @Minimum@, @Maximum@, and @Average@ all return @1@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@HTTPCode_Instance_4XX_Count@__ - The number of HTTP 4XX response
    --     codes generated by the target instances. This does not include any
    --     response codes generated by the load balancer.
    --
    --     @Statistics@: The most useful statistic is @Sum@. Note that
    --     @Minimum@, @Maximum@, and @Average@ all return @1@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@HTTPCode_Instance_5XX_Count@__ - The number of HTTP 5XX response
    --     codes generated by the target instances. This does not include any
    --     response codes generated by the load balancer.
    --
    --     @Statistics@: The most useful statistic is @Sum@. Note that
    --     @Minimum@, @Maximum@, and @Average@ all return @1@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@HTTPCode_LB_4XX_Count@__ - The number of HTTP 4XX client error
    --     codes that originated from the load balancer. Client errors are
    --     generated when requests are malformed or incomplete. These requests
    --     were not received by the target instance. This count does not
    --     include response codes generated by the target instances.
    --
    --     @Statistics@: The most useful statistic is @Sum@. Note that
    --     @Minimum@, @Maximum@, and @Average@ all return @1@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@HTTPCode_LB_5XX_Count@__ - The number of HTTP 5XX server error
    --     codes that originated from the load balancer. This does not include
    --     any response codes generated by the target instance. This metric is
    --     reported if there are no healthy instances attached to the load
    --     balancer, or if the request rate exceeds the capacity of the
    --     instances (spillover) or the load balancer.
    --
    --     @Statistics@: The most useful statistic is @Sum@. Note that
    --     @Minimum@, @Maximum@, and @Average@ all return @1@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@InstanceResponseTime@__ - The time elapsed, in seconds, after the
    --     request leaves the load balancer until a response from the target
    --     instance is received.
    --
    --     @Statistics@: The most useful statistic is @Average@.
    --
    --     @Unit@: The published unit is @Seconds@.
    --
    -- -   __@RejectedConnectionCount@__ - The number of connections that were
    --     rejected because the load balancer had reached its maximum number of
    --     connections.
    --
    --     @Statistics@: The most useful statistic is @Sum@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@RequestCount@__ - The number of requests processed over IPv4.
    --     This count includes only the requests with a response generated by a
    --     target instance of the load balancer.
    --
    --     @Statistics@: The most useful statistic is @Sum@. Note that
    --     @Minimum@, @Maximum@, and @Average@ all return @1@.
    --
    --     @Unit@: The published unit is @Count@.
    --
    -- -   __@UnhealthyHostCount@__ - The number of target instances that are
    --     considered unhealthy.
    --
    --     @Statistics@: The most useful statistic are @Average@, @Minimum@,
    --     and @Maximum@.
    --
    --     @Unit@: The published unit is @Count@.
    GetLoadBalancerMetricData -> LoadBalancerMetricName
metricName :: LoadBalancerMetricName,
    -- | The granularity, in seconds, of the returned data points.
    GetLoadBalancerMetricData -> Natural
period :: Prelude.Natural,
    -- | The start time of the period.
    GetLoadBalancerMetricData -> POSIX
startTime :: Core.POSIX,
    -- | The end time of the period.
    GetLoadBalancerMetricData -> POSIX
endTime :: Core.POSIX,
    -- | The unit for the metric data request. Valid units depend on the metric
    -- data being requested. For the valid units with each available metric,
    -- see the @metricName@ parameter.
    GetLoadBalancerMetricData -> 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.
    GetLoadBalancerMetricData -> [MetricStatistic]
statistics :: [MetricStatistic]
  }
  deriving (GetLoadBalancerMetricData -> GetLoadBalancerMetricData -> Bool
(GetLoadBalancerMetricData -> GetLoadBalancerMetricData -> Bool)
-> (GetLoadBalancerMetricData -> GetLoadBalancerMetricData -> Bool)
-> Eq GetLoadBalancerMetricData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLoadBalancerMetricData -> GetLoadBalancerMetricData -> Bool
$c/= :: GetLoadBalancerMetricData -> GetLoadBalancerMetricData -> Bool
== :: GetLoadBalancerMetricData -> GetLoadBalancerMetricData -> Bool
$c== :: GetLoadBalancerMetricData -> GetLoadBalancerMetricData -> Bool
Prelude.Eq, ReadPrec [GetLoadBalancerMetricData]
ReadPrec GetLoadBalancerMetricData
Int -> ReadS GetLoadBalancerMetricData
ReadS [GetLoadBalancerMetricData]
(Int -> ReadS GetLoadBalancerMetricData)
-> ReadS [GetLoadBalancerMetricData]
-> ReadPrec GetLoadBalancerMetricData
-> ReadPrec [GetLoadBalancerMetricData]
-> Read GetLoadBalancerMetricData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLoadBalancerMetricData]
$creadListPrec :: ReadPrec [GetLoadBalancerMetricData]
readPrec :: ReadPrec GetLoadBalancerMetricData
$creadPrec :: ReadPrec GetLoadBalancerMetricData
readList :: ReadS [GetLoadBalancerMetricData]
$creadList :: ReadS [GetLoadBalancerMetricData]
readsPrec :: Int -> ReadS GetLoadBalancerMetricData
$creadsPrec :: Int -> ReadS GetLoadBalancerMetricData
Prelude.Read, Int -> GetLoadBalancerMetricData -> ShowS
[GetLoadBalancerMetricData] -> ShowS
GetLoadBalancerMetricData -> String
(Int -> GetLoadBalancerMetricData -> ShowS)
-> (GetLoadBalancerMetricData -> String)
-> ([GetLoadBalancerMetricData] -> ShowS)
-> Show GetLoadBalancerMetricData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLoadBalancerMetricData] -> ShowS
$cshowList :: [GetLoadBalancerMetricData] -> ShowS
show :: GetLoadBalancerMetricData -> String
$cshow :: GetLoadBalancerMetricData -> String
showsPrec :: Int -> GetLoadBalancerMetricData -> ShowS
$cshowsPrec :: Int -> GetLoadBalancerMetricData -> ShowS
Prelude.Show, (forall x.
 GetLoadBalancerMetricData -> Rep GetLoadBalancerMetricData x)
-> (forall x.
    Rep GetLoadBalancerMetricData x -> GetLoadBalancerMetricData)
-> Generic GetLoadBalancerMetricData
forall x.
Rep GetLoadBalancerMetricData x -> GetLoadBalancerMetricData
forall x.
GetLoadBalancerMetricData -> Rep GetLoadBalancerMetricData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLoadBalancerMetricData x -> GetLoadBalancerMetricData
$cfrom :: forall x.
GetLoadBalancerMetricData -> Rep GetLoadBalancerMetricData x
Prelude.Generic)

-- |
-- Create a value of 'GetLoadBalancerMetricData' 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:
--
-- 'loadBalancerName', 'getLoadBalancerMetricData_loadBalancerName' - The name of the load balancer.
--
-- 'metricName', 'getLoadBalancerMetricData_metricName' - The metric for which you want to return information.
--
-- Valid load balancer metric names are listed below, along with the most
-- useful @statistics@ to include in your request, and the published @unit@
-- value.
--
-- -   __@ClientTLSNegotiationErrorCount@__ - The number of TLS connections
--     initiated by the client that did not establish a session with the
--     load balancer due to a TLS error generated by the load balancer.
--     Possible causes include a mismatch of ciphers or protocols.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HealthyHostCount@__ - The number of target instances that are
--     considered healthy.
--
--     @Statistics@: The most useful statistic are @Average@, @Minimum@,
--     and @Maximum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_2XX_Count@__ - The number of HTTP 2XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_3XX_Count@__ - The number of HTTP 3XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_4XX_Count@__ - The number of HTTP 4XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_5XX_Count@__ - The number of HTTP 5XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_LB_4XX_Count@__ - The number of HTTP 4XX client error
--     codes that originated from the load balancer. Client errors are
--     generated when requests are malformed or incomplete. These requests
--     were not received by the target instance. This count does not
--     include response codes generated by the target instances.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_LB_5XX_Count@__ - The number of HTTP 5XX server error
--     codes that originated from the load balancer. This does not include
--     any response codes generated by the target instance. This metric is
--     reported if there are no healthy instances attached to the load
--     balancer, or if the request rate exceeds the capacity of the
--     instances (spillover) or the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@InstanceResponseTime@__ - The time elapsed, in seconds, after the
--     request leaves the load balancer until a response from the target
--     instance is received.
--
--     @Statistics@: The most useful statistic is @Average@.
--
--     @Unit@: The published unit is @Seconds@.
--
-- -   __@RejectedConnectionCount@__ - The number of connections that were
--     rejected because the load balancer had reached its maximum number of
--     connections.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@RequestCount@__ - The number of requests processed over IPv4.
--     This count includes only the requests with a response generated by a
--     target instance of the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@UnhealthyHostCount@__ - The number of target instances that are
--     considered unhealthy.
--
--     @Statistics@: The most useful statistic are @Average@, @Minimum@,
--     and @Maximum@.
--
--     @Unit@: The published unit is @Count@.
--
-- 'period', 'getLoadBalancerMetricData_period' - The granularity, in seconds, of the returned data points.
--
-- 'startTime', 'getLoadBalancerMetricData_startTime' - The start time of the period.
--
-- 'endTime', 'getLoadBalancerMetricData_endTime' - The end time of the period.
--
-- 'unit', 'getLoadBalancerMetricData_unit' - The unit for the metric data request. Valid units depend on the metric
-- data being requested. For the valid units with each available metric,
-- see the @metricName@ parameter.
--
-- 'statistics', 'getLoadBalancerMetricData_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.
newGetLoadBalancerMetricData ::
  -- | 'loadBalancerName'
  Prelude.Text ->
  -- | 'metricName'
  LoadBalancerMetricName ->
  -- | 'period'
  Prelude.Natural ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'unit'
  MetricUnit ->
  GetLoadBalancerMetricData
newGetLoadBalancerMetricData :: Text
-> LoadBalancerMetricName
-> Natural
-> UTCTime
-> UTCTime
-> MetricUnit
-> GetLoadBalancerMetricData
newGetLoadBalancerMetricData
  Text
pLoadBalancerName_
  LoadBalancerMetricName
pMetricName_
  Natural
pPeriod_
  UTCTime
pStartTime_
  UTCTime
pEndTime_
  MetricUnit
pUnit_ =
    GetLoadBalancerMetricData' :: Text
-> LoadBalancerMetricName
-> Natural
-> POSIX
-> POSIX
-> MetricUnit
-> [MetricStatistic]
-> GetLoadBalancerMetricData
GetLoadBalancerMetricData'
      { $sel:loadBalancerName:GetLoadBalancerMetricData' :: Text
loadBalancerName =
          Text
pLoadBalancerName_,
        $sel:metricName:GetLoadBalancerMetricData' :: LoadBalancerMetricName
metricName = LoadBalancerMetricName
pMetricName_,
        $sel:period:GetLoadBalancerMetricData' :: Natural
period = Natural
pPeriod_,
        $sel:startTime:GetLoadBalancerMetricData' :: 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:GetLoadBalancerMetricData' :: 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:GetLoadBalancerMetricData' :: MetricUnit
unit = MetricUnit
pUnit_,
        $sel:statistics:GetLoadBalancerMetricData' :: [MetricStatistic]
statistics = [MetricStatistic]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The name of the load balancer.
getLoadBalancerMetricData_loadBalancerName :: Lens.Lens' GetLoadBalancerMetricData Prelude.Text
getLoadBalancerMetricData_loadBalancerName :: (Text -> f Text)
-> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData
getLoadBalancerMetricData_loadBalancerName = (GetLoadBalancerMetricData -> Text)
-> (GetLoadBalancerMetricData -> Text -> GetLoadBalancerMetricData)
-> Lens
     GetLoadBalancerMetricData GetLoadBalancerMetricData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricData' {Text
loadBalancerName :: Text
$sel:loadBalancerName:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> Text
loadBalancerName} -> Text
loadBalancerName) (\s :: GetLoadBalancerMetricData
s@GetLoadBalancerMetricData' {} Text
a -> GetLoadBalancerMetricData
s {$sel:loadBalancerName:GetLoadBalancerMetricData' :: Text
loadBalancerName = Text
a} :: GetLoadBalancerMetricData)

-- | The metric for which you want to return information.
--
-- Valid load balancer metric names are listed below, along with the most
-- useful @statistics@ to include in your request, and the published @unit@
-- value.
--
-- -   __@ClientTLSNegotiationErrorCount@__ - The number of TLS connections
--     initiated by the client that did not establish a session with the
--     load balancer due to a TLS error generated by the load balancer.
--     Possible causes include a mismatch of ciphers or protocols.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HealthyHostCount@__ - The number of target instances that are
--     considered healthy.
--
--     @Statistics@: The most useful statistic are @Average@, @Minimum@,
--     and @Maximum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_2XX_Count@__ - The number of HTTP 2XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_3XX_Count@__ - The number of HTTP 3XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_4XX_Count@__ - The number of HTTP 4XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_Instance_5XX_Count@__ - The number of HTTP 5XX response
--     codes generated by the target instances. This does not include any
--     response codes generated by the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_LB_4XX_Count@__ - The number of HTTP 4XX client error
--     codes that originated from the load balancer. Client errors are
--     generated when requests are malformed or incomplete. These requests
--     were not received by the target instance. This count does not
--     include response codes generated by the target instances.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@HTTPCode_LB_5XX_Count@__ - The number of HTTP 5XX server error
--     codes that originated from the load balancer. This does not include
--     any response codes generated by the target instance. This metric is
--     reported if there are no healthy instances attached to the load
--     balancer, or if the request rate exceeds the capacity of the
--     instances (spillover) or the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@InstanceResponseTime@__ - The time elapsed, in seconds, after the
--     request leaves the load balancer until a response from the target
--     instance is received.
--
--     @Statistics@: The most useful statistic is @Average@.
--
--     @Unit@: The published unit is @Seconds@.
--
-- -   __@RejectedConnectionCount@__ - The number of connections that were
--     rejected because the load balancer had reached its maximum number of
--     connections.
--
--     @Statistics@: The most useful statistic is @Sum@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@RequestCount@__ - The number of requests processed over IPv4.
--     This count includes only the requests with a response generated by a
--     target instance of the load balancer.
--
--     @Statistics@: The most useful statistic is @Sum@. Note that
--     @Minimum@, @Maximum@, and @Average@ all return @1@.
--
--     @Unit@: The published unit is @Count@.
--
-- -   __@UnhealthyHostCount@__ - The number of target instances that are
--     considered unhealthy.
--
--     @Statistics@: The most useful statistic are @Average@, @Minimum@,
--     and @Maximum@.
--
--     @Unit@: The published unit is @Count@.
getLoadBalancerMetricData_metricName :: Lens.Lens' GetLoadBalancerMetricData LoadBalancerMetricName
getLoadBalancerMetricData_metricName :: (LoadBalancerMetricName -> f LoadBalancerMetricName)
-> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData
getLoadBalancerMetricData_metricName = (GetLoadBalancerMetricData -> LoadBalancerMetricName)
-> (GetLoadBalancerMetricData
    -> LoadBalancerMetricName -> GetLoadBalancerMetricData)
-> Lens
     GetLoadBalancerMetricData
     GetLoadBalancerMetricData
     LoadBalancerMetricName
     LoadBalancerMetricName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricData' {LoadBalancerMetricName
metricName :: LoadBalancerMetricName
$sel:metricName:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> LoadBalancerMetricName
metricName} -> LoadBalancerMetricName
metricName) (\s :: GetLoadBalancerMetricData
s@GetLoadBalancerMetricData' {} LoadBalancerMetricName
a -> GetLoadBalancerMetricData
s {$sel:metricName:GetLoadBalancerMetricData' :: LoadBalancerMetricName
metricName = LoadBalancerMetricName
a} :: GetLoadBalancerMetricData)

-- | The granularity, in seconds, of the returned data points.
getLoadBalancerMetricData_period :: Lens.Lens' GetLoadBalancerMetricData Prelude.Natural
getLoadBalancerMetricData_period :: (Natural -> f Natural)
-> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData
getLoadBalancerMetricData_period = (GetLoadBalancerMetricData -> Natural)
-> (GetLoadBalancerMetricData
    -> Natural -> GetLoadBalancerMetricData)
-> Lens
     GetLoadBalancerMetricData GetLoadBalancerMetricData Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricData' {Natural
period :: Natural
$sel:period:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> Natural
period} -> Natural
period) (\s :: GetLoadBalancerMetricData
s@GetLoadBalancerMetricData' {} Natural
a -> GetLoadBalancerMetricData
s {$sel:period:GetLoadBalancerMetricData' :: Natural
period = Natural
a} :: GetLoadBalancerMetricData)

-- | The start time of the period.
getLoadBalancerMetricData_startTime :: Lens.Lens' GetLoadBalancerMetricData Prelude.UTCTime
getLoadBalancerMetricData_startTime :: (UTCTime -> f UTCTime)
-> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData
getLoadBalancerMetricData_startTime = (GetLoadBalancerMetricData -> POSIX)
-> (GetLoadBalancerMetricData
    -> POSIX -> GetLoadBalancerMetricData)
-> Lens
     GetLoadBalancerMetricData GetLoadBalancerMetricData POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricData' {POSIX
startTime :: POSIX
$sel:startTime:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> POSIX
startTime} -> POSIX
startTime) (\s :: GetLoadBalancerMetricData
s@GetLoadBalancerMetricData' {} POSIX
a -> GetLoadBalancerMetricData
s {$sel:startTime:GetLoadBalancerMetricData' :: POSIX
startTime = POSIX
a} :: GetLoadBalancerMetricData) ((POSIX -> f POSIX)
 -> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetLoadBalancerMetricData
-> f GetLoadBalancerMetricData
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 period.
getLoadBalancerMetricData_endTime :: Lens.Lens' GetLoadBalancerMetricData Prelude.UTCTime
getLoadBalancerMetricData_endTime :: (UTCTime -> f UTCTime)
-> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData
getLoadBalancerMetricData_endTime = (GetLoadBalancerMetricData -> POSIX)
-> (GetLoadBalancerMetricData
    -> POSIX -> GetLoadBalancerMetricData)
-> Lens
     GetLoadBalancerMetricData GetLoadBalancerMetricData POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricData' {POSIX
endTime :: POSIX
$sel:endTime:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> POSIX
endTime} -> POSIX
endTime) (\s :: GetLoadBalancerMetricData
s@GetLoadBalancerMetricData' {} POSIX
a -> GetLoadBalancerMetricData
s {$sel:endTime:GetLoadBalancerMetricData' :: POSIX
endTime = POSIX
a} :: GetLoadBalancerMetricData) ((POSIX -> f POSIX)
 -> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetLoadBalancerMetricData
-> f GetLoadBalancerMetricData
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 with each available metric,
-- see the @metricName@ parameter.
getLoadBalancerMetricData_unit :: Lens.Lens' GetLoadBalancerMetricData MetricUnit
getLoadBalancerMetricData_unit :: (MetricUnit -> f MetricUnit)
-> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData
getLoadBalancerMetricData_unit = (GetLoadBalancerMetricData -> MetricUnit)
-> (GetLoadBalancerMetricData
    -> MetricUnit -> GetLoadBalancerMetricData)
-> Lens
     GetLoadBalancerMetricData
     GetLoadBalancerMetricData
     MetricUnit
     MetricUnit
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricData' {MetricUnit
unit :: MetricUnit
$sel:unit:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> MetricUnit
unit} -> MetricUnit
unit) (\s :: GetLoadBalancerMetricData
s@GetLoadBalancerMetricData' {} MetricUnit
a -> GetLoadBalancerMetricData
s {$sel:unit:GetLoadBalancerMetricData' :: MetricUnit
unit = MetricUnit
a} :: GetLoadBalancerMetricData)

-- | 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.
getLoadBalancerMetricData_statistics :: Lens.Lens' GetLoadBalancerMetricData [MetricStatistic]
getLoadBalancerMetricData_statistics :: ([MetricStatistic] -> f [MetricStatistic])
-> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData
getLoadBalancerMetricData_statistics = (GetLoadBalancerMetricData -> [MetricStatistic])
-> (GetLoadBalancerMetricData
    -> [MetricStatistic] -> GetLoadBalancerMetricData)
-> Lens
     GetLoadBalancerMetricData
     GetLoadBalancerMetricData
     [MetricStatistic]
     [MetricStatistic]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricData' {[MetricStatistic]
statistics :: [MetricStatistic]
$sel:statistics:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> [MetricStatistic]
statistics} -> [MetricStatistic]
statistics) (\s :: GetLoadBalancerMetricData
s@GetLoadBalancerMetricData' {} [MetricStatistic]
a -> GetLoadBalancerMetricData
s {$sel:statistics:GetLoadBalancerMetricData' :: [MetricStatistic]
statistics = [MetricStatistic]
a} :: GetLoadBalancerMetricData) (([MetricStatistic] -> f [MetricStatistic])
 -> GetLoadBalancerMetricData -> f GetLoadBalancerMetricData)
-> (([MetricStatistic] -> f [MetricStatistic])
    -> [MetricStatistic] -> f [MetricStatistic])
-> ([MetricStatistic] -> f [MetricStatistic])
-> GetLoadBalancerMetricData
-> f GetLoadBalancerMetricData
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 GetLoadBalancerMetricData where
  type
    AWSResponse GetLoadBalancerMetricData =
      GetLoadBalancerMetricDataResponse
  request :: GetLoadBalancerMetricData -> Request GetLoadBalancerMetricData
request = Service
-> GetLoadBalancerMetricData -> Request GetLoadBalancerMetricData
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetLoadBalancerMetricData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetLoadBalancerMetricData)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetLoadBalancerMetricData))
-> Logger
-> Service
-> Proxy GetLoadBalancerMetricData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetLoadBalancerMetricData)))
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 LoadBalancerMetricName
-> Maybe [MetricDatapoint]
-> Int
-> GetLoadBalancerMetricDataResponse
GetLoadBalancerMetricDataResponse'
            (Maybe LoadBalancerMetricName
 -> Maybe [MetricDatapoint]
 -> Int
 -> GetLoadBalancerMetricDataResponse)
-> Either String (Maybe LoadBalancerMetricName)
-> Either
     String
     (Maybe [MetricDatapoint]
      -> Int -> GetLoadBalancerMetricDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe LoadBalancerMetricName)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"metricName")
            Either
  String
  (Maybe [MetricDatapoint]
   -> Int -> GetLoadBalancerMetricDataResponse)
-> Either String (Maybe [MetricDatapoint])
-> Either String (Int -> GetLoadBalancerMetricDataResponse)
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 -> GetLoadBalancerMetricDataResponse)
-> Either String Int
-> Either String GetLoadBalancerMetricDataResponse
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 GetLoadBalancerMetricData

instance Prelude.NFData GetLoadBalancerMetricData

instance Core.ToHeaders GetLoadBalancerMetricData where
  toHeaders :: GetLoadBalancerMetricData -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetLoadBalancerMetricData -> 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.GetLoadBalancerMetricData" ::
                          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 GetLoadBalancerMetricData where
  toJSON :: GetLoadBalancerMetricData -> Value
toJSON GetLoadBalancerMetricData' {Natural
[MetricStatistic]
Text
POSIX
LoadBalancerMetricName
MetricUnit
statistics :: [MetricStatistic]
unit :: MetricUnit
endTime :: POSIX
startTime :: POSIX
period :: Natural
metricName :: LoadBalancerMetricName
loadBalancerName :: Text
$sel:statistics:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> [MetricStatistic]
$sel:unit:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> MetricUnit
$sel:endTime:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> POSIX
$sel:startTime:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> POSIX
$sel:period:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> Natural
$sel:metricName:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> LoadBalancerMetricName
$sel:loadBalancerName:GetLoadBalancerMetricData' :: GetLoadBalancerMetricData -> 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
"loadBalancerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
loadBalancerName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"metricName" Text -> LoadBalancerMetricName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LoadBalancerMetricName
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 GetLoadBalancerMetricData where
  toPath :: GetLoadBalancerMetricData -> ByteString
toPath = ByteString -> GetLoadBalancerMetricData -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

-- | An array of objects that describe the metric data returned.
getLoadBalancerMetricDataResponse_metricData :: Lens.Lens' GetLoadBalancerMetricDataResponse (Prelude.Maybe [MetricDatapoint])
getLoadBalancerMetricDataResponse_metricData :: (Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
-> GetLoadBalancerMetricDataResponse
-> f GetLoadBalancerMetricDataResponse
getLoadBalancerMetricDataResponse_metricData = (GetLoadBalancerMetricDataResponse -> Maybe [MetricDatapoint])
-> (GetLoadBalancerMetricDataResponse
    -> Maybe [MetricDatapoint] -> GetLoadBalancerMetricDataResponse)
-> Lens
     GetLoadBalancerMetricDataResponse
     GetLoadBalancerMetricDataResponse
     (Maybe [MetricDatapoint])
     (Maybe [MetricDatapoint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricDataResponse' {Maybe [MetricDatapoint]
metricData :: Maybe [MetricDatapoint]
$sel:metricData:GetLoadBalancerMetricDataResponse' :: GetLoadBalancerMetricDataResponse -> Maybe [MetricDatapoint]
metricData} -> Maybe [MetricDatapoint]
metricData) (\s :: GetLoadBalancerMetricDataResponse
s@GetLoadBalancerMetricDataResponse' {} Maybe [MetricDatapoint]
a -> GetLoadBalancerMetricDataResponse
s {$sel:metricData:GetLoadBalancerMetricDataResponse' :: Maybe [MetricDatapoint]
metricData = Maybe [MetricDatapoint]
a} :: GetLoadBalancerMetricDataResponse) ((Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
 -> GetLoadBalancerMetricDataResponse
 -> f GetLoadBalancerMetricDataResponse)
-> ((Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
    -> Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
-> (Maybe [MetricDatapoint] -> f (Maybe [MetricDatapoint]))
-> GetLoadBalancerMetricDataResponse
-> f GetLoadBalancerMetricDataResponse
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.
getLoadBalancerMetricDataResponse_httpStatus :: Lens.Lens' GetLoadBalancerMetricDataResponse Prelude.Int
getLoadBalancerMetricDataResponse_httpStatus :: (Int -> f Int)
-> GetLoadBalancerMetricDataResponse
-> f GetLoadBalancerMetricDataResponse
getLoadBalancerMetricDataResponse_httpStatus = (GetLoadBalancerMetricDataResponse -> Int)
-> (GetLoadBalancerMetricDataResponse
    -> Int -> GetLoadBalancerMetricDataResponse)
-> Lens
     GetLoadBalancerMetricDataResponse
     GetLoadBalancerMetricDataResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoadBalancerMetricDataResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetLoadBalancerMetricDataResponse' :: GetLoadBalancerMetricDataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetLoadBalancerMetricDataResponse
s@GetLoadBalancerMetricDataResponse' {} Int
a -> GetLoadBalancerMetricDataResponse
s {$sel:httpStatus:GetLoadBalancerMetricDataResponse' :: Int
httpStatus = Int
a} :: GetLoadBalancerMetricDataResponse)

instance
  Prelude.NFData
    GetLoadBalancerMetricDataResponse