{-# 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.CloudWatch.GetInsightRuleReport
-- 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)
--
-- This operation returns the time series data collected by a Contributor
-- Insights rule. The data includes the identity and number of contributors
-- to the log group.
--
-- You can also optionally return one or more statistics about each data
-- point in the time series. These statistics can include the following:
--
-- -   @UniqueContributors@ -- the number of unique contributors for each
--     data point.
--
-- -   @MaxContributorValue@ -- the value of the top contributor for each
--     data point. The identity of the contributor might change for each
--     data point in the graph.
--
--     If this rule aggregates by COUNT, the top contributor for each data
--     point is the contributor with the most occurrences in that period.
--     If the rule aggregates by SUM, the top contributor is the
--     contributor with the highest sum in the log field specified by the
--     rule\'s @Value@, during that period.
--
-- -   @SampleCount@ -- the number of data points matched by the rule.
--
-- -   @Sum@ -- the sum of the values from all contributors during the time
--     period represented by that data point.
--
-- -   @Minimum@ -- the minimum value from a single observation during the
--     time period represented by that data point.
--
-- -   @Maximum@ -- the maximum value from a single observation during the
--     time period represented by that data point.
--
-- -   @Average@ -- the average value from all contributors during the time
--     period represented by that data point.
module Amazonka.CloudWatch.GetInsightRuleReport
  ( -- * Creating a Request
    GetInsightRuleReport (..),
    newGetInsightRuleReport,

    -- * Request Lenses
    getInsightRuleReport_maxContributorCount,
    getInsightRuleReport_metrics,
    getInsightRuleReport_orderBy,
    getInsightRuleReport_ruleName,
    getInsightRuleReport_startTime,
    getInsightRuleReport_endTime,
    getInsightRuleReport_period,

    -- * Destructuring the Response
    GetInsightRuleReportResponse (..),
    newGetInsightRuleReportResponse,

    -- * Response Lenses
    getInsightRuleReportResponse_keyLabels,
    getInsightRuleReportResponse_approximateUniqueCount,
    getInsightRuleReportResponse_aggregationStatistic,
    getInsightRuleReportResponse_aggregateValue,
    getInsightRuleReportResponse_contributors,
    getInsightRuleReportResponse_metricDatapoints,
    getInsightRuleReportResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetInsightRuleReport' smart constructor.
data GetInsightRuleReport = GetInsightRuleReport'
  { -- | The maximum number of contributors to include in the report. The range
    -- is 1 to 100. If you omit this, the default of 10 is used.
    GetInsightRuleReport -> Maybe Int
maxContributorCount :: Prelude.Maybe Prelude.Int,
    -- | Specifies which metrics to use for aggregation of contributor values for
    -- the report. You can specify one or more of the following metrics:
    --
    -- -   @UniqueContributors@ -- the number of unique contributors for each
    --     data point.
    --
    -- -   @MaxContributorValue@ -- the value of the top contributor for each
    --     data point. The identity of the contributor might change for each
    --     data point in the graph.
    --
    --     If this rule aggregates by COUNT, the top contributor for each data
    --     point is the contributor with the most occurrences in that period.
    --     If the rule aggregates by SUM, the top contributor is the
    --     contributor with the highest sum in the log field specified by the
    --     rule\'s @Value@, during that period.
    --
    -- -   @SampleCount@ -- the number of data points matched by the rule.
    --
    -- -   @Sum@ -- the sum of the values from all contributors during the time
    --     period represented by that data point.
    --
    -- -   @Minimum@ -- the minimum value from a single observation during the
    --     time period represented by that data point.
    --
    -- -   @Maximum@ -- the maximum value from a single observation during the
    --     time period represented by that data point.
    --
    -- -   @Average@ -- the average value from all contributors during the time
    --     period represented by that data point.
    GetInsightRuleReport -> Maybe [Text]
metrics :: Prelude.Maybe [Prelude.Text],
    -- | Determines what statistic to use to rank the contributors. Valid values
    -- are SUM and MAXIMUM.
    GetInsightRuleReport -> Maybe Text
orderBy :: Prelude.Maybe Prelude.Text,
    -- | The name of the rule that you want to see data from.
    GetInsightRuleReport -> Text
ruleName :: Prelude.Text,
    -- | The start time of the data to use in the report. When used in a raw HTTP
    -- Query API, it is formatted as @yyyy-MM-dd\'T\'HH:mm:ss@. For example,
    -- @2019-07-01T23:59:59@.
    GetInsightRuleReport -> ISO8601
startTime :: Core.ISO8601,
    -- | The end time of the data to use in the report. When used in a raw HTTP
    -- Query API, it is formatted as @yyyy-MM-dd\'T\'HH:mm:ss@. For example,
    -- @2019-07-01T23:59:59@.
    GetInsightRuleReport -> ISO8601
endTime :: Core.ISO8601,
    -- | The period, in seconds, to use for the statistics in the
    -- @InsightRuleMetricDatapoint@ results.
    GetInsightRuleReport -> Natural
period :: Prelude.Natural
  }
  deriving (GetInsightRuleReport -> GetInsightRuleReport -> Bool
(GetInsightRuleReport -> GetInsightRuleReport -> Bool)
-> (GetInsightRuleReport -> GetInsightRuleReport -> Bool)
-> Eq GetInsightRuleReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightRuleReport -> GetInsightRuleReport -> Bool
$c/= :: GetInsightRuleReport -> GetInsightRuleReport -> Bool
== :: GetInsightRuleReport -> GetInsightRuleReport -> Bool
$c== :: GetInsightRuleReport -> GetInsightRuleReport -> Bool
Prelude.Eq, ReadPrec [GetInsightRuleReport]
ReadPrec GetInsightRuleReport
Int -> ReadS GetInsightRuleReport
ReadS [GetInsightRuleReport]
(Int -> ReadS GetInsightRuleReport)
-> ReadS [GetInsightRuleReport]
-> ReadPrec GetInsightRuleReport
-> ReadPrec [GetInsightRuleReport]
-> Read GetInsightRuleReport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightRuleReport]
$creadListPrec :: ReadPrec [GetInsightRuleReport]
readPrec :: ReadPrec GetInsightRuleReport
$creadPrec :: ReadPrec GetInsightRuleReport
readList :: ReadS [GetInsightRuleReport]
$creadList :: ReadS [GetInsightRuleReport]
readsPrec :: Int -> ReadS GetInsightRuleReport
$creadsPrec :: Int -> ReadS GetInsightRuleReport
Prelude.Read, Int -> GetInsightRuleReport -> ShowS
[GetInsightRuleReport] -> ShowS
GetInsightRuleReport -> String
(Int -> GetInsightRuleReport -> ShowS)
-> (GetInsightRuleReport -> String)
-> ([GetInsightRuleReport] -> ShowS)
-> Show GetInsightRuleReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightRuleReport] -> ShowS
$cshowList :: [GetInsightRuleReport] -> ShowS
show :: GetInsightRuleReport -> String
$cshow :: GetInsightRuleReport -> String
showsPrec :: Int -> GetInsightRuleReport -> ShowS
$cshowsPrec :: Int -> GetInsightRuleReport -> ShowS
Prelude.Show, (forall x. GetInsightRuleReport -> Rep GetInsightRuleReport x)
-> (forall x. Rep GetInsightRuleReport x -> GetInsightRuleReport)
-> Generic GetInsightRuleReport
forall x. Rep GetInsightRuleReport x -> GetInsightRuleReport
forall x. GetInsightRuleReport -> Rep GetInsightRuleReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInsightRuleReport x -> GetInsightRuleReport
$cfrom :: forall x. GetInsightRuleReport -> Rep GetInsightRuleReport x
Prelude.Generic)

-- |
-- Create a value of 'GetInsightRuleReport' 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:
--
-- 'maxContributorCount', 'getInsightRuleReport_maxContributorCount' - The maximum number of contributors to include in the report. The range
-- is 1 to 100. If you omit this, the default of 10 is used.
--
-- 'metrics', 'getInsightRuleReport_metrics' - Specifies which metrics to use for aggregation of contributor values for
-- the report. You can specify one or more of the following metrics:
--
-- -   @UniqueContributors@ -- the number of unique contributors for each
--     data point.
--
-- -   @MaxContributorValue@ -- the value of the top contributor for each
--     data point. The identity of the contributor might change for each
--     data point in the graph.
--
--     If this rule aggregates by COUNT, the top contributor for each data
--     point is the contributor with the most occurrences in that period.
--     If the rule aggregates by SUM, the top contributor is the
--     contributor with the highest sum in the log field specified by the
--     rule\'s @Value@, during that period.
--
-- -   @SampleCount@ -- the number of data points matched by the rule.
--
-- -   @Sum@ -- the sum of the values from all contributors during the time
--     period represented by that data point.
--
-- -   @Minimum@ -- the minimum value from a single observation during the
--     time period represented by that data point.
--
-- -   @Maximum@ -- the maximum value from a single observation during the
--     time period represented by that data point.
--
-- -   @Average@ -- the average value from all contributors during the time
--     period represented by that data point.
--
-- 'orderBy', 'getInsightRuleReport_orderBy' - Determines what statistic to use to rank the contributors. Valid values
-- are SUM and MAXIMUM.
--
-- 'ruleName', 'getInsightRuleReport_ruleName' - The name of the rule that you want to see data from.
--
-- 'startTime', 'getInsightRuleReport_startTime' - The start time of the data to use in the report. When used in a raw HTTP
-- Query API, it is formatted as @yyyy-MM-dd\'T\'HH:mm:ss@. For example,
-- @2019-07-01T23:59:59@.
--
-- 'endTime', 'getInsightRuleReport_endTime' - The end time of the data to use in the report. When used in a raw HTTP
-- Query API, it is formatted as @yyyy-MM-dd\'T\'HH:mm:ss@. For example,
-- @2019-07-01T23:59:59@.
--
-- 'period', 'getInsightRuleReport_period' - The period, in seconds, to use for the statistics in the
-- @InsightRuleMetricDatapoint@ results.
newGetInsightRuleReport ::
  -- | 'ruleName'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'period'
  Prelude.Natural ->
  GetInsightRuleReport
newGetInsightRuleReport :: Text -> UTCTime -> UTCTime -> Natural -> GetInsightRuleReport
newGetInsightRuleReport
  Text
pRuleName_
  UTCTime
pStartTime_
  UTCTime
pEndTime_
  Natural
pPeriod_ =
    GetInsightRuleReport' :: Maybe Int
-> Maybe [Text]
-> Maybe Text
-> Text
-> ISO8601
-> ISO8601
-> Natural
-> GetInsightRuleReport
GetInsightRuleReport'
      { $sel:maxContributorCount:GetInsightRuleReport' :: Maybe Int
maxContributorCount =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:metrics:GetInsightRuleReport' :: Maybe [Text]
metrics = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:orderBy:GetInsightRuleReport' :: Maybe Text
orderBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:ruleName:GetInsightRuleReport' :: Text
ruleName = Text
pRuleName_,
        $sel:startTime:GetInsightRuleReport' :: ISO8601
startTime = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:endTime:GetInsightRuleReport' :: ISO8601
endTime = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
        $sel:period:GetInsightRuleReport' :: Natural
period = Natural
pPeriod_
      }

-- | The maximum number of contributors to include in the report. The range
-- is 1 to 100. If you omit this, the default of 10 is used.
getInsightRuleReport_maxContributorCount :: Lens.Lens' GetInsightRuleReport (Prelude.Maybe Prelude.Int)
getInsightRuleReport_maxContributorCount :: (Maybe Int -> f (Maybe Int))
-> GetInsightRuleReport -> f GetInsightRuleReport
getInsightRuleReport_maxContributorCount = (GetInsightRuleReport -> Maybe Int)
-> (GetInsightRuleReport -> Maybe Int -> GetInsightRuleReport)
-> Lens
     GetInsightRuleReport GetInsightRuleReport (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReport' {Maybe Int
maxContributorCount :: Maybe Int
$sel:maxContributorCount:GetInsightRuleReport' :: GetInsightRuleReport -> Maybe Int
maxContributorCount} -> Maybe Int
maxContributorCount) (\s :: GetInsightRuleReport
s@GetInsightRuleReport' {} Maybe Int
a -> GetInsightRuleReport
s {$sel:maxContributorCount:GetInsightRuleReport' :: Maybe Int
maxContributorCount = Maybe Int
a} :: GetInsightRuleReport)

-- | Specifies which metrics to use for aggregation of contributor values for
-- the report. You can specify one or more of the following metrics:
--
-- -   @UniqueContributors@ -- the number of unique contributors for each
--     data point.
--
-- -   @MaxContributorValue@ -- the value of the top contributor for each
--     data point. The identity of the contributor might change for each
--     data point in the graph.
--
--     If this rule aggregates by COUNT, the top contributor for each data
--     point is the contributor with the most occurrences in that period.
--     If the rule aggregates by SUM, the top contributor is the
--     contributor with the highest sum in the log field specified by the
--     rule\'s @Value@, during that period.
--
-- -   @SampleCount@ -- the number of data points matched by the rule.
--
-- -   @Sum@ -- the sum of the values from all contributors during the time
--     period represented by that data point.
--
-- -   @Minimum@ -- the minimum value from a single observation during the
--     time period represented by that data point.
--
-- -   @Maximum@ -- the maximum value from a single observation during the
--     time period represented by that data point.
--
-- -   @Average@ -- the average value from all contributors during the time
--     period represented by that data point.
getInsightRuleReport_metrics :: Lens.Lens' GetInsightRuleReport (Prelude.Maybe [Prelude.Text])
getInsightRuleReport_metrics :: (Maybe [Text] -> f (Maybe [Text]))
-> GetInsightRuleReport -> f GetInsightRuleReport
getInsightRuleReport_metrics = (GetInsightRuleReport -> Maybe [Text])
-> (GetInsightRuleReport -> Maybe [Text] -> GetInsightRuleReport)
-> Lens
     GetInsightRuleReport
     GetInsightRuleReport
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReport' {Maybe [Text]
metrics :: Maybe [Text]
$sel:metrics:GetInsightRuleReport' :: GetInsightRuleReport -> Maybe [Text]
metrics} -> Maybe [Text]
metrics) (\s :: GetInsightRuleReport
s@GetInsightRuleReport' {} Maybe [Text]
a -> GetInsightRuleReport
s {$sel:metrics:GetInsightRuleReport' :: Maybe [Text]
metrics = Maybe [Text]
a} :: GetInsightRuleReport) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetInsightRuleReport -> f GetInsightRuleReport)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetInsightRuleReport
-> f GetInsightRuleReport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Determines what statistic to use to rank the contributors. Valid values
-- are SUM and MAXIMUM.
getInsightRuleReport_orderBy :: Lens.Lens' GetInsightRuleReport (Prelude.Maybe Prelude.Text)
getInsightRuleReport_orderBy :: (Maybe Text -> f (Maybe Text))
-> GetInsightRuleReport -> f GetInsightRuleReport
getInsightRuleReport_orderBy = (GetInsightRuleReport -> Maybe Text)
-> (GetInsightRuleReport -> Maybe Text -> GetInsightRuleReport)
-> Lens
     GetInsightRuleReport GetInsightRuleReport (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReport' {Maybe Text
orderBy :: Maybe Text
$sel:orderBy:GetInsightRuleReport' :: GetInsightRuleReport -> Maybe Text
orderBy} -> Maybe Text
orderBy) (\s :: GetInsightRuleReport
s@GetInsightRuleReport' {} Maybe Text
a -> GetInsightRuleReport
s {$sel:orderBy:GetInsightRuleReport' :: Maybe Text
orderBy = Maybe Text
a} :: GetInsightRuleReport)

-- | The name of the rule that you want to see data from.
getInsightRuleReport_ruleName :: Lens.Lens' GetInsightRuleReport Prelude.Text
getInsightRuleReport_ruleName :: (Text -> f Text) -> GetInsightRuleReport -> f GetInsightRuleReport
getInsightRuleReport_ruleName = (GetInsightRuleReport -> Text)
-> (GetInsightRuleReport -> Text -> GetInsightRuleReport)
-> Lens GetInsightRuleReport GetInsightRuleReport Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReport' {Text
ruleName :: Text
$sel:ruleName:GetInsightRuleReport' :: GetInsightRuleReport -> Text
ruleName} -> Text
ruleName) (\s :: GetInsightRuleReport
s@GetInsightRuleReport' {} Text
a -> GetInsightRuleReport
s {$sel:ruleName:GetInsightRuleReport' :: Text
ruleName = Text
a} :: GetInsightRuleReport)

-- | The start time of the data to use in the report. When used in a raw HTTP
-- Query API, it is formatted as @yyyy-MM-dd\'T\'HH:mm:ss@. For example,
-- @2019-07-01T23:59:59@.
getInsightRuleReport_startTime :: Lens.Lens' GetInsightRuleReport Prelude.UTCTime
getInsightRuleReport_startTime :: (UTCTime -> f UTCTime)
-> GetInsightRuleReport -> f GetInsightRuleReport
getInsightRuleReport_startTime = (GetInsightRuleReport -> ISO8601)
-> (GetInsightRuleReport -> ISO8601 -> GetInsightRuleReport)
-> Lens GetInsightRuleReport GetInsightRuleReport ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReport' {ISO8601
startTime :: ISO8601
$sel:startTime:GetInsightRuleReport' :: GetInsightRuleReport -> ISO8601
startTime} -> ISO8601
startTime) (\s :: GetInsightRuleReport
s@GetInsightRuleReport' {} ISO8601
a -> GetInsightRuleReport
s {$sel:startTime:GetInsightRuleReport' :: ISO8601
startTime = ISO8601
a} :: GetInsightRuleReport) ((ISO8601 -> f ISO8601)
 -> GetInsightRuleReport -> f GetInsightRuleReport)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> GetInsightRuleReport
-> f GetInsightRuleReport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The end time of the data to use in the report. When used in a raw HTTP
-- Query API, it is formatted as @yyyy-MM-dd\'T\'HH:mm:ss@. For example,
-- @2019-07-01T23:59:59@.
getInsightRuleReport_endTime :: Lens.Lens' GetInsightRuleReport Prelude.UTCTime
getInsightRuleReport_endTime :: (UTCTime -> f UTCTime)
-> GetInsightRuleReport -> f GetInsightRuleReport
getInsightRuleReport_endTime = (GetInsightRuleReport -> ISO8601)
-> (GetInsightRuleReport -> ISO8601 -> GetInsightRuleReport)
-> Lens GetInsightRuleReport GetInsightRuleReport ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReport' {ISO8601
endTime :: ISO8601
$sel:endTime:GetInsightRuleReport' :: GetInsightRuleReport -> ISO8601
endTime} -> ISO8601
endTime) (\s :: GetInsightRuleReport
s@GetInsightRuleReport' {} ISO8601
a -> GetInsightRuleReport
s {$sel:endTime:GetInsightRuleReport' :: ISO8601
endTime = ISO8601
a} :: GetInsightRuleReport) ((ISO8601 -> f ISO8601)
 -> GetInsightRuleReport -> f GetInsightRuleReport)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> GetInsightRuleReport
-> f GetInsightRuleReport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The period, in seconds, to use for the statistics in the
-- @InsightRuleMetricDatapoint@ results.
getInsightRuleReport_period :: Lens.Lens' GetInsightRuleReport Prelude.Natural
getInsightRuleReport_period :: (Natural -> f Natural)
-> GetInsightRuleReport -> f GetInsightRuleReport
getInsightRuleReport_period = (GetInsightRuleReport -> Natural)
-> (GetInsightRuleReport -> Natural -> GetInsightRuleReport)
-> Lens GetInsightRuleReport GetInsightRuleReport Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReport' {Natural
period :: Natural
$sel:period:GetInsightRuleReport' :: GetInsightRuleReport -> Natural
period} -> Natural
period) (\s :: GetInsightRuleReport
s@GetInsightRuleReport' {} Natural
a -> GetInsightRuleReport
s {$sel:period:GetInsightRuleReport' :: Natural
period = Natural
a} :: GetInsightRuleReport)

instance Core.AWSRequest GetInsightRuleReport where
  type
    AWSResponse GetInsightRuleReport =
      GetInsightRuleReportResponse
  request :: GetInsightRuleReport -> Request GetInsightRuleReport
request = Service -> GetInsightRuleReport -> Request GetInsightRuleReport
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy GetInsightRuleReport
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInsightRuleReport)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse GetInsightRuleReport))
-> Logger
-> Service
-> Proxy GetInsightRuleReport
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInsightRuleReport)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"GetInsightRuleReportResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [Text]
-> Maybe Integer
-> Maybe Text
-> Maybe Double
-> Maybe [InsightRuleContributor]
-> Maybe [InsightRuleMetricDatapoint]
-> Int
-> GetInsightRuleReportResponse
GetInsightRuleReportResponse'
            (Maybe [Text]
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Double
 -> Maybe [InsightRuleContributor]
 -> Maybe [InsightRuleMetricDatapoint]
 -> Int
 -> GetInsightRuleReportResponse)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe Integer
      -> Maybe Text
      -> Maybe Double
      -> Maybe [InsightRuleContributor]
      -> Maybe [InsightRuleMetricDatapoint]
      -> Int
      -> GetInsightRuleReportResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"KeyLabels" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String
  (Maybe Integer
   -> Maybe Text
   -> Maybe Double
   -> Maybe [InsightRuleContributor]
   -> Maybe [InsightRuleMetricDatapoint]
   -> Int
   -> GetInsightRuleReportResponse)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Text
      -> Maybe Double
      -> Maybe [InsightRuleContributor]
      -> Maybe [InsightRuleMetricDatapoint]
      -> Int
      -> GetInsightRuleReportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ApproximateUniqueCount")
            Either
  String
  (Maybe Text
   -> Maybe Double
   -> Maybe [InsightRuleContributor]
   -> Maybe [InsightRuleMetricDatapoint]
   -> Int
   -> GetInsightRuleReportResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Double
      -> Maybe [InsightRuleContributor]
      -> Maybe [InsightRuleMetricDatapoint]
      -> Int
      -> GetInsightRuleReportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AggregationStatistic")
            Either
  String
  (Maybe Double
   -> Maybe [InsightRuleContributor]
   -> Maybe [InsightRuleMetricDatapoint]
   -> Int
   -> GetInsightRuleReportResponse)
-> Either String (Maybe Double)
-> Either
     String
     (Maybe [InsightRuleContributor]
      -> Maybe [InsightRuleMetricDatapoint]
      -> Int
      -> GetInsightRuleReportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AggregateValue")
            Either
  String
  (Maybe [InsightRuleContributor]
   -> Maybe [InsightRuleMetricDatapoint]
   -> Int
   -> GetInsightRuleReportResponse)
-> Either String (Maybe [InsightRuleContributor])
-> Either
     String
     (Maybe [InsightRuleMetricDatapoint]
      -> Int -> GetInsightRuleReportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Contributors" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [InsightRuleContributor]))
-> Either String (Maybe [InsightRuleContributor])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [InsightRuleContributor])
-> [Node] -> Either String (Maybe [InsightRuleContributor])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [InsightRuleContributor]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String
  (Maybe [InsightRuleMetricDatapoint]
   -> Int -> GetInsightRuleReportResponse)
-> Either String (Maybe [InsightRuleMetricDatapoint])
-> Either String (Int -> GetInsightRuleReportResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MetricDatapoints"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [InsightRuleMetricDatapoint]))
-> Either String (Maybe [InsightRuleMetricDatapoint])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [InsightRuleMetricDatapoint])
-> [Node] -> Either String (Maybe [InsightRuleMetricDatapoint])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [InsightRuleMetricDatapoint]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> GetInsightRuleReportResponse)
-> Either String Int -> Either String GetInsightRuleReportResponse
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 GetInsightRuleReport

instance Prelude.NFData GetInsightRuleReport

instance Core.ToHeaders GetInsightRuleReport where
  toHeaders :: GetInsightRuleReport -> ResponseHeaders
toHeaders = ResponseHeaders -> GetInsightRuleReport -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery GetInsightRuleReport where
  toQuery :: GetInsightRuleReport -> QueryString
toQuery GetInsightRuleReport' {Natural
Maybe Int
Maybe [Text]
Maybe Text
Text
ISO8601
period :: Natural
endTime :: ISO8601
startTime :: ISO8601
ruleName :: Text
orderBy :: Maybe Text
metrics :: Maybe [Text]
maxContributorCount :: Maybe Int
$sel:period:GetInsightRuleReport' :: GetInsightRuleReport -> Natural
$sel:endTime:GetInsightRuleReport' :: GetInsightRuleReport -> ISO8601
$sel:startTime:GetInsightRuleReport' :: GetInsightRuleReport -> ISO8601
$sel:ruleName:GetInsightRuleReport' :: GetInsightRuleReport -> Text
$sel:orderBy:GetInsightRuleReport' :: GetInsightRuleReport -> Maybe Text
$sel:metrics:GetInsightRuleReport' :: GetInsightRuleReport -> Maybe [Text]
$sel:maxContributorCount:GetInsightRuleReport' :: GetInsightRuleReport -> Maybe Int
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetInsightRuleReport" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"MaxContributorCount" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxContributorCount,
        ByteString
"Metrics"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
metrics),
        ByteString
"OrderBy" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
orderBy,
        ByteString
"RuleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
ruleName,
        ByteString
"StartTime" ByteString -> ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ISO8601
startTime,
        ByteString
"EndTime" ByteString -> ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ISO8601
endTime,
        ByteString
"Period" ByteString -> Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Natural
period
      ]

-- | /See:/ 'newGetInsightRuleReportResponse' smart constructor.
data GetInsightRuleReportResponse = GetInsightRuleReportResponse'
  { -- | An array of the strings used as the keys for this rule. The keys are the
    -- dimensions used to classify contributors. If the rule contains more than
    -- one key, then each unique combination of values for the keys is counted
    -- as a unique contributor.
    GetInsightRuleReportResponse -> Maybe [Text]
keyLabels :: Prelude.Maybe [Prelude.Text],
    -- | An approximate count of the unique contributors found by this rule in
    -- this time period.
    GetInsightRuleReportResponse -> Maybe Integer
approximateUniqueCount :: Prelude.Maybe Prelude.Integer,
    -- | Specifies whether this rule aggregates contributor data by COUNT or SUM.
    GetInsightRuleReportResponse -> Maybe Text
aggregationStatistic :: Prelude.Maybe Prelude.Text,
    -- | The sum of the values from all individual contributors that match the
    -- rule.
    GetInsightRuleReportResponse -> Maybe Double
aggregateValue :: Prelude.Maybe Prelude.Double,
    -- | An array of the unique contributors found by this rule in this time
    -- period. If the rule contains multiple keys, each combination of values
    -- for the keys counts as a unique contributor.
    GetInsightRuleReportResponse -> Maybe [InsightRuleContributor]
contributors :: Prelude.Maybe [InsightRuleContributor],
    -- | A time series of metric data points that matches the time period in the
    -- rule request.
    GetInsightRuleReportResponse -> Maybe [InsightRuleMetricDatapoint]
metricDatapoints :: Prelude.Maybe [InsightRuleMetricDatapoint],
    -- | The response's http status code.
    GetInsightRuleReportResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetInsightRuleReportResponse
-> GetInsightRuleReportResponse -> Bool
(GetInsightRuleReportResponse
 -> GetInsightRuleReportResponse -> Bool)
-> (GetInsightRuleReportResponse
    -> GetInsightRuleReportResponse -> Bool)
-> Eq GetInsightRuleReportResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightRuleReportResponse
-> GetInsightRuleReportResponse -> Bool
$c/= :: GetInsightRuleReportResponse
-> GetInsightRuleReportResponse -> Bool
== :: GetInsightRuleReportResponse
-> GetInsightRuleReportResponse -> Bool
$c== :: GetInsightRuleReportResponse
-> GetInsightRuleReportResponse -> Bool
Prelude.Eq, ReadPrec [GetInsightRuleReportResponse]
ReadPrec GetInsightRuleReportResponse
Int -> ReadS GetInsightRuleReportResponse
ReadS [GetInsightRuleReportResponse]
(Int -> ReadS GetInsightRuleReportResponse)
-> ReadS [GetInsightRuleReportResponse]
-> ReadPrec GetInsightRuleReportResponse
-> ReadPrec [GetInsightRuleReportResponse]
-> Read GetInsightRuleReportResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightRuleReportResponse]
$creadListPrec :: ReadPrec [GetInsightRuleReportResponse]
readPrec :: ReadPrec GetInsightRuleReportResponse
$creadPrec :: ReadPrec GetInsightRuleReportResponse
readList :: ReadS [GetInsightRuleReportResponse]
$creadList :: ReadS [GetInsightRuleReportResponse]
readsPrec :: Int -> ReadS GetInsightRuleReportResponse
$creadsPrec :: Int -> ReadS GetInsightRuleReportResponse
Prelude.Read, Int -> GetInsightRuleReportResponse -> ShowS
[GetInsightRuleReportResponse] -> ShowS
GetInsightRuleReportResponse -> String
(Int -> GetInsightRuleReportResponse -> ShowS)
-> (GetInsightRuleReportResponse -> String)
-> ([GetInsightRuleReportResponse] -> ShowS)
-> Show GetInsightRuleReportResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightRuleReportResponse] -> ShowS
$cshowList :: [GetInsightRuleReportResponse] -> ShowS
show :: GetInsightRuleReportResponse -> String
$cshow :: GetInsightRuleReportResponse -> String
showsPrec :: Int -> GetInsightRuleReportResponse -> ShowS
$cshowsPrec :: Int -> GetInsightRuleReportResponse -> ShowS
Prelude.Show, (forall x.
 GetInsightRuleReportResponse -> Rep GetInsightRuleReportResponse x)
-> (forall x.
    Rep GetInsightRuleReportResponse x -> GetInsightRuleReportResponse)
-> Generic GetInsightRuleReportResponse
forall x.
Rep GetInsightRuleReportResponse x -> GetInsightRuleReportResponse
forall x.
GetInsightRuleReportResponse -> Rep GetInsightRuleReportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInsightRuleReportResponse x -> GetInsightRuleReportResponse
$cfrom :: forall x.
GetInsightRuleReportResponse -> Rep GetInsightRuleReportResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetInsightRuleReportResponse' 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:
--
-- 'keyLabels', 'getInsightRuleReportResponse_keyLabels' - An array of the strings used as the keys for this rule. The keys are the
-- dimensions used to classify contributors. If the rule contains more than
-- one key, then each unique combination of values for the keys is counted
-- as a unique contributor.
--
-- 'approximateUniqueCount', 'getInsightRuleReportResponse_approximateUniqueCount' - An approximate count of the unique contributors found by this rule in
-- this time period.
--
-- 'aggregationStatistic', 'getInsightRuleReportResponse_aggregationStatistic' - Specifies whether this rule aggregates contributor data by COUNT or SUM.
--
-- 'aggregateValue', 'getInsightRuleReportResponse_aggregateValue' - The sum of the values from all individual contributors that match the
-- rule.
--
-- 'contributors', 'getInsightRuleReportResponse_contributors' - An array of the unique contributors found by this rule in this time
-- period. If the rule contains multiple keys, each combination of values
-- for the keys counts as a unique contributor.
--
-- 'metricDatapoints', 'getInsightRuleReportResponse_metricDatapoints' - A time series of metric data points that matches the time period in the
-- rule request.
--
-- 'httpStatus', 'getInsightRuleReportResponse_httpStatus' - The response's http status code.
newGetInsightRuleReportResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetInsightRuleReportResponse
newGetInsightRuleReportResponse :: Int -> GetInsightRuleReportResponse
newGetInsightRuleReportResponse Int
pHttpStatus_ =
  GetInsightRuleReportResponse' :: Maybe [Text]
-> Maybe Integer
-> Maybe Text
-> Maybe Double
-> Maybe [InsightRuleContributor]
-> Maybe [InsightRuleMetricDatapoint]
-> Int
-> GetInsightRuleReportResponse
GetInsightRuleReportResponse'
    { $sel:keyLabels:GetInsightRuleReportResponse' :: Maybe [Text]
keyLabels =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:approximateUniqueCount:GetInsightRuleReportResponse' :: Maybe Integer
approximateUniqueCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:aggregationStatistic:GetInsightRuleReportResponse' :: Maybe Text
aggregationStatistic = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aggregateValue:GetInsightRuleReportResponse' :: Maybe Double
aggregateValue = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:contributors:GetInsightRuleReportResponse' :: Maybe [InsightRuleContributor]
contributors = Maybe [InsightRuleContributor]
forall a. Maybe a
Prelude.Nothing,
      $sel:metricDatapoints:GetInsightRuleReportResponse' :: Maybe [InsightRuleMetricDatapoint]
metricDatapoints = Maybe [InsightRuleMetricDatapoint]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetInsightRuleReportResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of the strings used as the keys for this rule. The keys are the
-- dimensions used to classify contributors. If the rule contains more than
-- one key, then each unique combination of values for the keys is counted
-- as a unique contributor.
getInsightRuleReportResponse_keyLabels :: Lens.Lens' GetInsightRuleReportResponse (Prelude.Maybe [Prelude.Text])
getInsightRuleReportResponse_keyLabels :: (Maybe [Text] -> f (Maybe [Text]))
-> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse
getInsightRuleReportResponse_keyLabels = (GetInsightRuleReportResponse -> Maybe [Text])
-> (GetInsightRuleReportResponse
    -> Maybe [Text] -> GetInsightRuleReportResponse)
-> Lens
     GetInsightRuleReportResponse
     GetInsightRuleReportResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReportResponse' {Maybe [Text]
keyLabels :: Maybe [Text]
$sel:keyLabels:GetInsightRuleReportResponse' :: GetInsightRuleReportResponse -> Maybe [Text]
keyLabels} -> Maybe [Text]
keyLabels) (\s :: GetInsightRuleReportResponse
s@GetInsightRuleReportResponse' {} Maybe [Text]
a -> GetInsightRuleReportResponse
s {$sel:keyLabels:GetInsightRuleReportResponse' :: Maybe [Text]
keyLabels = Maybe [Text]
a} :: GetInsightRuleReportResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetInsightRuleReportResponse
-> f GetInsightRuleReportResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An approximate count of the unique contributors found by this rule in
-- this time period.
getInsightRuleReportResponse_approximateUniqueCount :: Lens.Lens' GetInsightRuleReportResponse (Prelude.Maybe Prelude.Integer)
getInsightRuleReportResponse_approximateUniqueCount :: (Maybe Integer -> f (Maybe Integer))
-> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse
getInsightRuleReportResponse_approximateUniqueCount = (GetInsightRuleReportResponse -> Maybe Integer)
-> (GetInsightRuleReportResponse
    -> Maybe Integer -> GetInsightRuleReportResponse)
-> Lens
     GetInsightRuleReportResponse
     GetInsightRuleReportResponse
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReportResponse' {Maybe Integer
approximateUniqueCount :: Maybe Integer
$sel:approximateUniqueCount:GetInsightRuleReportResponse' :: GetInsightRuleReportResponse -> Maybe Integer
approximateUniqueCount} -> Maybe Integer
approximateUniqueCount) (\s :: GetInsightRuleReportResponse
s@GetInsightRuleReportResponse' {} Maybe Integer
a -> GetInsightRuleReportResponse
s {$sel:approximateUniqueCount:GetInsightRuleReportResponse' :: Maybe Integer
approximateUniqueCount = Maybe Integer
a} :: GetInsightRuleReportResponse)

-- | Specifies whether this rule aggregates contributor data by COUNT or SUM.
getInsightRuleReportResponse_aggregationStatistic :: Lens.Lens' GetInsightRuleReportResponse (Prelude.Maybe Prelude.Text)
getInsightRuleReportResponse_aggregationStatistic :: (Maybe Text -> f (Maybe Text))
-> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse
getInsightRuleReportResponse_aggregationStatistic = (GetInsightRuleReportResponse -> Maybe Text)
-> (GetInsightRuleReportResponse
    -> Maybe Text -> GetInsightRuleReportResponse)
-> Lens
     GetInsightRuleReportResponse
     GetInsightRuleReportResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReportResponse' {Maybe Text
aggregationStatistic :: Maybe Text
$sel:aggregationStatistic:GetInsightRuleReportResponse' :: GetInsightRuleReportResponse -> Maybe Text
aggregationStatistic} -> Maybe Text
aggregationStatistic) (\s :: GetInsightRuleReportResponse
s@GetInsightRuleReportResponse' {} Maybe Text
a -> GetInsightRuleReportResponse
s {$sel:aggregationStatistic:GetInsightRuleReportResponse' :: Maybe Text
aggregationStatistic = Maybe Text
a} :: GetInsightRuleReportResponse)

-- | The sum of the values from all individual contributors that match the
-- rule.
getInsightRuleReportResponse_aggregateValue :: Lens.Lens' GetInsightRuleReportResponse (Prelude.Maybe Prelude.Double)
getInsightRuleReportResponse_aggregateValue :: (Maybe Double -> f (Maybe Double))
-> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse
getInsightRuleReportResponse_aggregateValue = (GetInsightRuleReportResponse -> Maybe Double)
-> (GetInsightRuleReportResponse
    -> Maybe Double -> GetInsightRuleReportResponse)
-> Lens
     GetInsightRuleReportResponse
     GetInsightRuleReportResponse
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReportResponse' {Maybe Double
aggregateValue :: Maybe Double
$sel:aggregateValue:GetInsightRuleReportResponse' :: GetInsightRuleReportResponse -> Maybe Double
aggregateValue} -> Maybe Double
aggregateValue) (\s :: GetInsightRuleReportResponse
s@GetInsightRuleReportResponse' {} Maybe Double
a -> GetInsightRuleReportResponse
s {$sel:aggregateValue:GetInsightRuleReportResponse' :: Maybe Double
aggregateValue = Maybe Double
a} :: GetInsightRuleReportResponse)

-- | An array of the unique contributors found by this rule in this time
-- period. If the rule contains multiple keys, each combination of values
-- for the keys counts as a unique contributor.
getInsightRuleReportResponse_contributors :: Lens.Lens' GetInsightRuleReportResponse (Prelude.Maybe [InsightRuleContributor])
getInsightRuleReportResponse_contributors :: (Maybe [InsightRuleContributor]
 -> f (Maybe [InsightRuleContributor]))
-> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse
getInsightRuleReportResponse_contributors = (GetInsightRuleReportResponse -> Maybe [InsightRuleContributor])
-> (GetInsightRuleReportResponse
    -> Maybe [InsightRuleContributor] -> GetInsightRuleReportResponse)
-> Lens
     GetInsightRuleReportResponse
     GetInsightRuleReportResponse
     (Maybe [InsightRuleContributor])
     (Maybe [InsightRuleContributor])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReportResponse' {Maybe [InsightRuleContributor]
contributors :: Maybe [InsightRuleContributor]
$sel:contributors:GetInsightRuleReportResponse' :: GetInsightRuleReportResponse -> Maybe [InsightRuleContributor]
contributors} -> Maybe [InsightRuleContributor]
contributors) (\s :: GetInsightRuleReportResponse
s@GetInsightRuleReportResponse' {} Maybe [InsightRuleContributor]
a -> GetInsightRuleReportResponse
s {$sel:contributors:GetInsightRuleReportResponse' :: Maybe [InsightRuleContributor]
contributors = Maybe [InsightRuleContributor]
a} :: GetInsightRuleReportResponse) ((Maybe [InsightRuleContributor]
  -> f (Maybe [InsightRuleContributor]))
 -> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse)
-> ((Maybe [InsightRuleContributor]
     -> f (Maybe [InsightRuleContributor]))
    -> Maybe [InsightRuleContributor]
    -> f (Maybe [InsightRuleContributor]))
-> (Maybe [InsightRuleContributor]
    -> f (Maybe [InsightRuleContributor]))
-> GetInsightRuleReportResponse
-> f GetInsightRuleReportResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InsightRuleContributor]
  [InsightRuleContributor]
  [InsightRuleContributor]
  [InsightRuleContributor]
-> Iso
     (Maybe [InsightRuleContributor])
     (Maybe [InsightRuleContributor])
     (Maybe [InsightRuleContributor])
     (Maybe [InsightRuleContributor])
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
  [InsightRuleContributor]
  [InsightRuleContributor]
  [InsightRuleContributor]
  [InsightRuleContributor]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A time series of metric data points that matches the time period in the
-- rule request.
getInsightRuleReportResponse_metricDatapoints :: Lens.Lens' GetInsightRuleReportResponse (Prelude.Maybe [InsightRuleMetricDatapoint])
getInsightRuleReportResponse_metricDatapoints :: (Maybe [InsightRuleMetricDatapoint]
 -> f (Maybe [InsightRuleMetricDatapoint]))
-> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse
getInsightRuleReportResponse_metricDatapoints = (GetInsightRuleReportResponse
 -> Maybe [InsightRuleMetricDatapoint])
-> (GetInsightRuleReportResponse
    -> Maybe [InsightRuleMetricDatapoint]
    -> GetInsightRuleReportResponse)
-> Lens
     GetInsightRuleReportResponse
     GetInsightRuleReportResponse
     (Maybe [InsightRuleMetricDatapoint])
     (Maybe [InsightRuleMetricDatapoint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightRuleReportResponse' {Maybe [InsightRuleMetricDatapoint]
metricDatapoints :: Maybe [InsightRuleMetricDatapoint]
$sel:metricDatapoints:GetInsightRuleReportResponse' :: GetInsightRuleReportResponse -> Maybe [InsightRuleMetricDatapoint]
metricDatapoints} -> Maybe [InsightRuleMetricDatapoint]
metricDatapoints) (\s :: GetInsightRuleReportResponse
s@GetInsightRuleReportResponse' {} Maybe [InsightRuleMetricDatapoint]
a -> GetInsightRuleReportResponse
s {$sel:metricDatapoints:GetInsightRuleReportResponse' :: Maybe [InsightRuleMetricDatapoint]
metricDatapoints = Maybe [InsightRuleMetricDatapoint]
a} :: GetInsightRuleReportResponse) ((Maybe [InsightRuleMetricDatapoint]
  -> f (Maybe [InsightRuleMetricDatapoint]))
 -> GetInsightRuleReportResponse -> f GetInsightRuleReportResponse)
-> ((Maybe [InsightRuleMetricDatapoint]
     -> f (Maybe [InsightRuleMetricDatapoint]))
    -> Maybe [InsightRuleMetricDatapoint]
    -> f (Maybe [InsightRuleMetricDatapoint]))
-> (Maybe [InsightRuleMetricDatapoint]
    -> f (Maybe [InsightRuleMetricDatapoint]))
-> GetInsightRuleReportResponse
-> f GetInsightRuleReportResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InsightRuleMetricDatapoint]
  [InsightRuleMetricDatapoint]
  [InsightRuleMetricDatapoint]
  [InsightRuleMetricDatapoint]
-> Iso
     (Maybe [InsightRuleMetricDatapoint])
     (Maybe [InsightRuleMetricDatapoint])
     (Maybe [InsightRuleMetricDatapoint])
     (Maybe [InsightRuleMetricDatapoint])
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
  [InsightRuleMetricDatapoint]
  [InsightRuleMetricDatapoint]
  [InsightRuleMetricDatapoint]
  [InsightRuleMetricDatapoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetInsightRuleReportResponse