{-# 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.LookoutMetrics.ListAnomalyGroupTimeSeries
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets a list of anomalous metrics for a measure in an anomaly group.
module Amazonka.LookoutMetrics.ListAnomalyGroupTimeSeries
  ( -- * Creating a Request
    ListAnomalyGroupTimeSeries (..),
    newListAnomalyGroupTimeSeries,

    -- * Request Lenses
    listAnomalyGroupTimeSeries_nextToken,
    listAnomalyGroupTimeSeries_maxResults,
    listAnomalyGroupTimeSeries_anomalyDetectorArn,
    listAnomalyGroupTimeSeries_anomalyGroupId,
    listAnomalyGroupTimeSeries_metricName,

    -- * Destructuring the Response
    ListAnomalyGroupTimeSeriesResponse (..),
    newListAnomalyGroupTimeSeriesResponse,

    -- * Response Lenses
    listAnomalyGroupTimeSeriesResponse_timeSeriesList,
    listAnomalyGroupTimeSeriesResponse_timestampList,
    listAnomalyGroupTimeSeriesResponse_metricName,
    listAnomalyGroupTimeSeriesResponse_anomalyGroupId,
    listAnomalyGroupTimeSeriesResponse_nextToken,
    listAnomalyGroupTimeSeriesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListAnomalyGroupTimeSeries' smart constructor.
data ListAnomalyGroupTimeSeries = ListAnomalyGroupTimeSeries'
  { -- | Specify the pagination token that\'s returned by a previous request to
    -- retrieve the next page of results.
    ListAnomalyGroupTimeSeries -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    ListAnomalyGroupTimeSeries -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the anomaly detector.
    ListAnomalyGroupTimeSeries -> Text
anomalyDetectorArn :: Prelude.Text,
    -- | The ID of the anomaly group.
    ListAnomalyGroupTimeSeries -> Text
anomalyGroupId :: Prelude.Text,
    -- | The name of the measure field.
    ListAnomalyGroupTimeSeries -> Text
metricName :: Prelude.Text
  }
  deriving (ListAnomalyGroupTimeSeries -> ListAnomalyGroupTimeSeries -> Bool
(ListAnomalyGroupTimeSeries -> ListAnomalyGroupTimeSeries -> Bool)
-> (ListAnomalyGroupTimeSeries
    -> ListAnomalyGroupTimeSeries -> Bool)
-> Eq ListAnomalyGroupTimeSeries
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAnomalyGroupTimeSeries -> ListAnomalyGroupTimeSeries -> Bool
$c/= :: ListAnomalyGroupTimeSeries -> ListAnomalyGroupTimeSeries -> Bool
== :: ListAnomalyGroupTimeSeries -> ListAnomalyGroupTimeSeries -> Bool
$c== :: ListAnomalyGroupTimeSeries -> ListAnomalyGroupTimeSeries -> Bool
Prelude.Eq, ReadPrec [ListAnomalyGroupTimeSeries]
ReadPrec ListAnomalyGroupTimeSeries
Int -> ReadS ListAnomalyGroupTimeSeries
ReadS [ListAnomalyGroupTimeSeries]
(Int -> ReadS ListAnomalyGroupTimeSeries)
-> ReadS [ListAnomalyGroupTimeSeries]
-> ReadPrec ListAnomalyGroupTimeSeries
-> ReadPrec [ListAnomalyGroupTimeSeries]
-> Read ListAnomalyGroupTimeSeries
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAnomalyGroupTimeSeries]
$creadListPrec :: ReadPrec [ListAnomalyGroupTimeSeries]
readPrec :: ReadPrec ListAnomalyGroupTimeSeries
$creadPrec :: ReadPrec ListAnomalyGroupTimeSeries
readList :: ReadS [ListAnomalyGroupTimeSeries]
$creadList :: ReadS [ListAnomalyGroupTimeSeries]
readsPrec :: Int -> ReadS ListAnomalyGroupTimeSeries
$creadsPrec :: Int -> ReadS ListAnomalyGroupTimeSeries
Prelude.Read, Int -> ListAnomalyGroupTimeSeries -> ShowS
[ListAnomalyGroupTimeSeries] -> ShowS
ListAnomalyGroupTimeSeries -> String
(Int -> ListAnomalyGroupTimeSeries -> ShowS)
-> (ListAnomalyGroupTimeSeries -> String)
-> ([ListAnomalyGroupTimeSeries] -> ShowS)
-> Show ListAnomalyGroupTimeSeries
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAnomalyGroupTimeSeries] -> ShowS
$cshowList :: [ListAnomalyGroupTimeSeries] -> ShowS
show :: ListAnomalyGroupTimeSeries -> String
$cshow :: ListAnomalyGroupTimeSeries -> String
showsPrec :: Int -> ListAnomalyGroupTimeSeries -> ShowS
$cshowsPrec :: Int -> ListAnomalyGroupTimeSeries -> ShowS
Prelude.Show, (forall x.
 ListAnomalyGroupTimeSeries -> Rep ListAnomalyGroupTimeSeries x)
-> (forall x.
    Rep ListAnomalyGroupTimeSeries x -> ListAnomalyGroupTimeSeries)
-> Generic ListAnomalyGroupTimeSeries
forall x.
Rep ListAnomalyGroupTimeSeries x -> ListAnomalyGroupTimeSeries
forall x.
ListAnomalyGroupTimeSeries -> Rep ListAnomalyGroupTimeSeries x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAnomalyGroupTimeSeries x -> ListAnomalyGroupTimeSeries
$cfrom :: forall x.
ListAnomalyGroupTimeSeries -> Rep ListAnomalyGroupTimeSeries x
Prelude.Generic)

-- |
-- Create a value of 'ListAnomalyGroupTimeSeries' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listAnomalyGroupTimeSeries_nextToken' - Specify the pagination token that\'s returned by a previous request to
-- retrieve the next page of results.
--
-- 'maxResults', 'listAnomalyGroupTimeSeries_maxResults' - The maximum number of results to return.
--
-- 'anomalyDetectorArn', 'listAnomalyGroupTimeSeries_anomalyDetectorArn' - The Amazon Resource Name (ARN) of the anomaly detector.
--
-- 'anomalyGroupId', 'listAnomalyGroupTimeSeries_anomalyGroupId' - The ID of the anomaly group.
--
-- 'metricName', 'listAnomalyGroupTimeSeries_metricName' - The name of the measure field.
newListAnomalyGroupTimeSeries ::
  -- | 'anomalyDetectorArn'
  Prelude.Text ->
  -- | 'anomalyGroupId'
  Prelude.Text ->
  -- | 'metricName'
  Prelude.Text ->
  ListAnomalyGroupTimeSeries
newListAnomalyGroupTimeSeries :: Text -> Text -> Text -> ListAnomalyGroupTimeSeries
newListAnomalyGroupTimeSeries
  Text
pAnomalyDetectorArn_
  Text
pAnomalyGroupId_
  Text
pMetricName_ =
    ListAnomalyGroupTimeSeries' :: Maybe Text
-> Maybe Natural
-> Text
-> Text
-> Text
-> ListAnomalyGroupTimeSeries
ListAnomalyGroupTimeSeries'
      { $sel:nextToken:ListAnomalyGroupTimeSeries' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListAnomalyGroupTimeSeries' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:anomalyDetectorArn:ListAnomalyGroupTimeSeries' :: Text
anomalyDetectorArn = Text
pAnomalyDetectorArn_,
        $sel:anomalyGroupId:ListAnomalyGroupTimeSeries' :: Text
anomalyGroupId = Text
pAnomalyGroupId_,
        $sel:metricName:ListAnomalyGroupTimeSeries' :: Text
metricName = Text
pMetricName_
      }

-- | Specify the pagination token that\'s returned by a previous request to
-- retrieve the next page of results.
listAnomalyGroupTimeSeries_nextToken :: Lens.Lens' ListAnomalyGroupTimeSeries (Prelude.Maybe Prelude.Text)
listAnomalyGroupTimeSeries_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAnomalyGroupTimeSeries -> f ListAnomalyGroupTimeSeries
listAnomalyGroupTimeSeries_nextToken = (ListAnomalyGroupTimeSeries -> Maybe Text)
-> (ListAnomalyGroupTimeSeries
    -> Maybe Text -> ListAnomalyGroupTimeSeries)
-> Lens
     ListAnomalyGroupTimeSeries
     ListAnomalyGroupTimeSeries
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeries' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAnomalyGroupTimeSeries
s@ListAnomalyGroupTimeSeries' {} Maybe Text
a -> ListAnomalyGroupTimeSeries
s {$sel:nextToken:ListAnomalyGroupTimeSeries' :: Maybe Text
nextToken = Maybe Text
a} :: ListAnomalyGroupTimeSeries)

-- | The maximum number of results to return.
listAnomalyGroupTimeSeries_maxResults :: Lens.Lens' ListAnomalyGroupTimeSeries (Prelude.Maybe Prelude.Natural)
listAnomalyGroupTimeSeries_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAnomalyGroupTimeSeries -> f ListAnomalyGroupTimeSeries
listAnomalyGroupTimeSeries_maxResults = (ListAnomalyGroupTimeSeries -> Maybe Natural)
-> (ListAnomalyGroupTimeSeries
    -> Maybe Natural -> ListAnomalyGroupTimeSeries)
-> Lens
     ListAnomalyGroupTimeSeries
     ListAnomalyGroupTimeSeries
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeries' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAnomalyGroupTimeSeries
s@ListAnomalyGroupTimeSeries' {} Maybe Natural
a -> ListAnomalyGroupTimeSeries
s {$sel:maxResults:ListAnomalyGroupTimeSeries' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAnomalyGroupTimeSeries)

-- | The Amazon Resource Name (ARN) of the anomaly detector.
listAnomalyGroupTimeSeries_anomalyDetectorArn :: Lens.Lens' ListAnomalyGroupTimeSeries Prelude.Text
listAnomalyGroupTimeSeries_anomalyDetectorArn :: (Text -> f Text)
-> ListAnomalyGroupTimeSeries -> f ListAnomalyGroupTimeSeries
listAnomalyGroupTimeSeries_anomalyDetectorArn = (ListAnomalyGroupTimeSeries -> Text)
-> (ListAnomalyGroupTimeSeries
    -> Text -> ListAnomalyGroupTimeSeries)
-> Lens
     ListAnomalyGroupTimeSeries ListAnomalyGroupTimeSeries Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeries' {Text
anomalyDetectorArn :: Text
$sel:anomalyDetectorArn:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Text
anomalyDetectorArn} -> Text
anomalyDetectorArn) (\s :: ListAnomalyGroupTimeSeries
s@ListAnomalyGroupTimeSeries' {} Text
a -> ListAnomalyGroupTimeSeries
s {$sel:anomalyDetectorArn:ListAnomalyGroupTimeSeries' :: Text
anomalyDetectorArn = Text
a} :: ListAnomalyGroupTimeSeries)

-- | The ID of the anomaly group.
listAnomalyGroupTimeSeries_anomalyGroupId :: Lens.Lens' ListAnomalyGroupTimeSeries Prelude.Text
listAnomalyGroupTimeSeries_anomalyGroupId :: (Text -> f Text)
-> ListAnomalyGroupTimeSeries -> f ListAnomalyGroupTimeSeries
listAnomalyGroupTimeSeries_anomalyGroupId = (ListAnomalyGroupTimeSeries -> Text)
-> (ListAnomalyGroupTimeSeries
    -> Text -> ListAnomalyGroupTimeSeries)
-> Lens
     ListAnomalyGroupTimeSeries ListAnomalyGroupTimeSeries Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeries' {Text
anomalyGroupId :: Text
$sel:anomalyGroupId:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Text
anomalyGroupId} -> Text
anomalyGroupId) (\s :: ListAnomalyGroupTimeSeries
s@ListAnomalyGroupTimeSeries' {} Text
a -> ListAnomalyGroupTimeSeries
s {$sel:anomalyGroupId:ListAnomalyGroupTimeSeries' :: Text
anomalyGroupId = Text
a} :: ListAnomalyGroupTimeSeries)

-- | The name of the measure field.
listAnomalyGroupTimeSeries_metricName :: Lens.Lens' ListAnomalyGroupTimeSeries Prelude.Text
listAnomalyGroupTimeSeries_metricName :: (Text -> f Text)
-> ListAnomalyGroupTimeSeries -> f ListAnomalyGroupTimeSeries
listAnomalyGroupTimeSeries_metricName = (ListAnomalyGroupTimeSeries -> Text)
-> (ListAnomalyGroupTimeSeries
    -> Text -> ListAnomalyGroupTimeSeries)
-> Lens
     ListAnomalyGroupTimeSeries ListAnomalyGroupTimeSeries Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeries' {Text
metricName :: Text
$sel:metricName:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Text
metricName} -> Text
metricName) (\s :: ListAnomalyGroupTimeSeries
s@ListAnomalyGroupTimeSeries' {} Text
a -> ListAnomalyGroupTimeSeries
s {$sel:metricName:ListAnomalyGroupTimeSeries' :: Text
metricName = Text
a} :: ListAnomalyGroupTimeSeries)

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

instance Prelude.NFData ListAnomalyGroupTimeSeries

instance Core.ToHeaders ListAnomalyGroupTimeSeries where
  toHeaders :: ListAnomalyGroupTimeSeries -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListAnomalyGroupTimeSeries -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListAnomalyGroupTimeSeries where
  toJSON :: ListAnomalyGroupTimeSeries -> Value
toJSON ListAnomalyGroupTimeSeries' {Maybe Natural
Maybe Text
Text
metricName :: Text
anomalyGroupId :: Text
anomalyDetectorArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:metricName:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Text
$sel:anomalyGroupId:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Text
$sel:anomalyDetectorArn:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Text
$sel:maxResults:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Maybe Natural
$sel:nextToken:ListAnomalyGroupTimeSeries' :: ListAnomalyGroupTimeSeries -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AnomalyDetectorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
anomalyDetectorArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AnomalyGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
anomalyGroupId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricName)
          ]
      )

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

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

-- | /See:/ 'newListAnomalyGroupTimeSeriesResponse' smart constructor.
data ListAnomalyGroupTimeSeriesResponse = ListAnomalyGroupTimeSeriesResponse'
  { -- | A list of anomalous metrics.
    ListAnomalyGroupTimeSeriesResponse -> Maybe [TimeSeries]
timeSeriesList :: Prelude.Maybe [TimeSeries],
    -- | Timestamps for the anomalous metrics.
    ListAnomalyGroupTimeSeriesResponse -> Maybe [Text]
timestampList :: Prelude.Maybe [Prelude.Text],
    -- | The name of the measure field.
    ListAnomalyGroupTimeSeriesResponse -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the anomaly group.
    ListAnomalyGroupTimeSeriesResponse -> Maybe Text
anomalyGroupId :: Prelude.Maybe Prelude.Text,
    -- | The pagination token that\'s included if more results are available.
    ListAnomalyGroupTimeSeriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAnomalyGroupTimeSeriesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAnomalyGroupTimeSeriesResponse
-> ListAnomalyGroupTimeSeriesResponse -> Bool
(ListAnomalyGroupTimeSeriesResponse
 -> ListAnomalyGroupTimeSeriesResponse -> Bool)
-> (ListAnomalyGroupTimeSeriesResponse
    -> ListAnomalyGroupTimeSeriesResponse -> Bool)
-> Eq ListAnomalyGroupTimeSeriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAnomalyGroupTimeSeriesResponse
-> ListAnomalyGroupTimeSeriesResponse -> Bool
$c/= :: ListAnomalyGroupTimeSeriesResponse
-> ListAnomalyGroupTimeSeriesResponse -> Bool
== :: ListAnomalyGroupTimeSeriesResponse
-> ListAnomalyGroupTimeSeriesResponse -> Bool
$c== :: ListAnomalyGroupTimeSeriesResponse
-> ListAnomalyGroupTimeSeriesResponse -> Bool
Prelude.Eq, ReadPrec [ListAnomalyGroupTimeSeriesResponse]
ReadPrec ListAnomalyGroupTimeSeriesResponse
Int -> ReadS ListAnomalyGroupTimeSeriesResponse
ReadS [ListAnomalyGroupTimeSeriesResponse]
(Int -> ReadS ListAnomalyGroupTimeSeriesResponse)
-> ReadS [ListAnomalyGroupTimeSeriesResponse]
-> ReadPrec ListAnomalyGroupTimeSeriesResponse
-> ReadPrec [ListAnomalyGroupTimeSeriesResponse]
-> Read ListAnomalyGroupTimeSeriesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAnomalyGroupTimeSeriesResponse]
$creadListPrec :: ReadPrec [ListAnomalyGroupTimeSeriesResponse]
readPrec :: ReadPrec ListAnomalyGroupTimeSeriesResponse
$creadPrec :: ReadPrec ListAnomalyGroupTimeSeriesResponse
readList :: ReadS [ListAnomalyGroupTimeSeriesResponse]
$creadList :: ReadS [ListAnomalyGroupTimeSeriesResponse]
readsPrec :: Int -> ReadS ListAnomalyGroupTimeSeriesResponse
$creadsPrec :: Int -> ReadS ListAnomalyGroupTimeSeriesResponse
Prelude.Read, Int -> ListAnomalyGroupTimeSeriesResponse -> ShowS
[ListAnomalyGroupTimeSeriesResponse] -> ShowS
ListAnomalyGroupTimeSeriesResponse -> String
(Int -> ListAnomalyGroupTimeSeriesResponse -> ShowS)
-> (ListAnomalyGroupTimeSeriesResponse -> String)
-> ([ListAnomalyGroupTimeSeriesResponse] -> ShowS)
-> Show ListAnomalyGroupTimeSeriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAnomalyGroupTimeSeriesResponse] -> ShowS
$cshowList :: [ListAnomalyGroupTimeSeriesResponse] -> ShowS
show :: ListAnomalyGroupTimeSeriesResponse -> String
$cshow :: ListAnomalyGroupTimeSeriesResponse -> String
showsPrec :: Int -> ListAnomalyGroupTimeSeriesResponse -> ShowS
$cshowsPrec :: Int -> ListAnomalyGroupTimeSeriesResponse -> ShowS
Prelude.Show, (forall x.
 ListAnomalyGroupTimeSeriesResponse
 -> Rep ListAnomalyGroupTimeSeriesResponse x)
-> (forall x.
    Rep ListAnomalyGroupTimeSeriesResponse x
    -> ListAnomalyGroupTimeSeriesResponse)
-> Generic ListAnomalyGroupTimeSeriesResponse
forall x.
Rep ListAnomalyGroupTimeSeriesResponse x
-> ListAnomalyGroupTimeSeriesResponse
forall x.
ListAnomalyGroupTimeSeriesResponse
-> Rep ListAnomalyGroupTimeSeriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAnomalyGroupTimeSeriesResponse x
-> ListAnomalyGroupTimeSeriesResponse
$cfrom :: forall x.
ListAnomalyGroupTimeSeriesResponse
-> Rep ListAnomalyGroupTimeSeriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAnomalyGroupTimeSeriesResponse' 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:
--
-- 'timeSeriesList', 'listAnomalyGroupTimeSeriesResponse_timeSeriesList' - A list of anomalous metrics.
--
-- 'timestampList', 'listAnomalyGroupTimeSeriesResponse_timestampList' - Timestamps for the anomalous metrics.
--
-- 'metricName', 'listAnomalyGroupTimeSeriesResponse_metricName' - The name of the measure field.
--
-- 'anomalyGroupId', 'listAnomalyGroupTimeSeriesResponse_anomalyGroupId' - The ID of the anomaly group.
--
-- 'nextToken', 'listAnomalyGroupTimeSeriesResponse_nextToken' - The pagination token that\'s included if more results are available.
--
-- 'httpStatus', 'listAnomalyGroupTimeSeriesResponse_httpStatus' - The response's http status code.
newListAnomalyGroupTimeSeriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAnomalyGroupTimeSeriesResponse
newListAnomalyGroupTimeSeriesResponse :: Int -> ListAnomalyGroupTimeSeriesResponse
newListAnomalyGroupTimeSeriesResponse Int
pHttpStatus_ =
  ListAnomalyGroupTimeSeriesResponse' :: Maybe [TimeSeries]
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> ListAnomalyGroupTimeSeriesResponse
ListAnomalyGroupTimeSeriesResponse'
    { $sel:timeSeriesList:ListAnomalyGroupTimeSeriesResponse' :: Maybe [TimeSeries]
timeSeriesList =
        Maybe [TimeSeries]
forall a. Maybe a
Prelude.Nothing,
      $sel:timestampList:ListAnomalyGroupTimeSeriesResponse' :: Maybe [Text]
timestampList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:ListAnomalyGroupTimeSeriesResponse' :: Maybe Text
metricName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:anomalyGroupId:ListAnomalyGroupTimeSeriesResponse' :: Maybe Text
anomalyGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAnomalyGroupTimeSeriesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAnomalyGroupTimeSeriesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of anomalous metrics.
listAnomalyGroupTimeSeriesResponse_timeSeriesList :: Lens.Lens' ListAnomalyGroupTimeSeriesResponse (Prelude.Maybe [TimeSeries])
listAnomalyGroupTimeSeriesResponse_timeSeriesList :: (Maybe [TimeSeries] -> f (Maybe [TimeSeries]))
-> ListAnomalyGroupTimeSeriesResponse
-> f ListAnomalyGroupTimeSeriesResponse
listAnomalyGroupTimeSeriesResponse_timeSeriesList = (ListAnomalyGroupTimeSeriesResponse -> Maybe [TimeSeries])
-> (ListAnomalyGroupTimeSeriesResponse
    -> Maybe [TimeSeries] -> ListAnomalyGroupTimeSeriesResponse)
-> Lens
     ListAnomalyGroupTimeSeriesResponse
     ListAnomalyGroupTimeSeriesResponse
     (Maybe [TimeSeries])
     (Maybe [TimeSeries])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeriesResponse' {Maybe [TimeSeries]
timeSeriesList :: Maybe [TimeSeries]
$sel:timeSeriesList:ListAnomalyGroupTimeSeriesResponse' :: ListAnomalyGroupTimeSeriesResponse -> Maybe [TimeSeries]
timeSeriesList} -> Maybe [TimeSeries]
timeSeriesList) (\s :: ListAnomalyGroupTimeSeriesResponse
s@ListAnomalyGroupTimeSeriesResponse' {} Maybe [TimeSeries]
a -> ListAnomalyGroupTimeSeriesResponse
s {$sel:timeSeriesList:ListAnomalyGroupTimeSeriesResponse' :: Maybe [TimeSeries]
timeSeriesList = Maybe [TimeSeries]
a} :: ListAnomalyGroupTimeSeriesResponse) ((Maybe [TimeSeries] -> f (Maybe [TimeSeries]))
 -> ListAnomalyGroupTimeSeriesResponse
 -> f ListAnomalyGroupTimeSeriesResponse)
-> ((Maybe [TimeSeries] -> f (Maybe [TimeSeries]))
    -> Maybe [TimeSeries] -> f (Maybe [TimeSeries]))
-> (Maybe [TimeSeries] -> f (Maybe [TimeSeries]))
-> ListAnomalyGroupTimeSeriesResponse
-> f ListAnomalyGroupTimeSeriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TimeSeries] [TimeSeries] [TimeSeries] [TimeSeries]
-> Iso
     (Maybe [TimeSeries])
     (Maybe [TimeSeries])
     (Maybe [TimeSeries])
     (Maybe [TimeSeries])
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 [TimeSeries] [TimeSeries] [TimeSeries] [TimeSeries]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Timestamps for the anomalous metrics.
listAnomalyGroupTimeSeriesResponse_timestampList :: Lens.Lens' ListAnomalyGroupTimeSeriesResponse (Prelude.Maybe [Prelude.Text])
listAnomalyGroupTimeSeriesResponse_timestampList :: (Maybe [Text] -> f (Maybe [Text]))
-> ListAnomalyGroupTimeSeriesResponse
-> f ListAnomalyGroupTimeSeriesResponse
listAnomalyGroupTimeSeriesResponse_timestampList = (ListAnomalyGroupTimeSeriesResponse -> Maybe [Text])
-> (ListAnomalyGroupTimeSeriesResponse
    -> Maybe [Text] -> ListAnomalyGroupTimeSeriesResponse)
-> Lens
     ListAnomalyGroupTimeSeriesResponse
     ListAnomalyGroupTimeSeriesResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeriesResponse' {Maybe [Text]
timestampList :: Maybe [Text]
$sel:timestampList:ListAnomalyGroupTimeSeriesResponse' :: ListAnomalyGroupTimeSeriesResponse -> Maybe [Text]
timestampList} -> Maybe [Text]
timestampList) (\s :: ListAnomalyGroupTimeSeriesResponse
s@ListAnomalyGroupTimeSeriesResponse' {} Maybe [Text]
a -> ListAnomalyGroupTimeSeriesResponse
s {$sel:timestampList:ListAnomalyGroupTimeSeriesResponse' :: Maybe [Text]
timestampList = Maybe [Text]
a} :: ListAnomalyGroupTimeSeriesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListAnomalyGroupTimeSeriesResponse
 -> f ListAnomalyGroupTimeSeriesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListAnomalyGroupTimeSeriesResponse
-> f ListAnomalyGroupTimeSeriesResponse
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

-- | The name of the measure field.
listAnomalyGroupTimeSeriesResponse_metricName :: Lens.Lens' ListAnomalyGroupTimeSeriesResponse (Prelude.Maybe Prelude.Text)
listAnomalyGroupTimeSeriesResponse_metricName :: (Maybe Text -> f (Maybe Text))
-> ListAnomalyGroupTimeSeriesResponse
-> f ListAnomalyGroupTimeSeriesResponse
listAnomalyGroupTimeSeriesResponse_metricName = (ListAnomalyGroupTimeSeriesResponse -> Maybe Text)
-> (ListAnomalyGroupTimeSeriesResponse
    -> Maybe Text -> ListAnomalyGroupTimeSeriesResponse)
-> Lens
     ListAnomalyGroupTimeSeriesResponse
     ListAnomalyGroupTimeSeriesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeriesResponse' {Maybe Text
metricName :: Maybe Text
$sel:metricName:ListAnomalyGroupTimeSeriesResponse' :: ListAnomalyGroupTimeSeriesResponse -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: ListAnomalyGroupTimeSeriesResponse
s@ListAnomalyGroupTimeSeriesResponse' {} Maybe Text
a -> ListAnomalyGroupTimeSeriesResponse
s {$sel:metricName:ListAnomalyGroupTimeSeriesResponse' :: Maybe Text
metricName = Maybe Text
a} :: ListAnomalyGroupTimeSeriesResponse)

-- | The ID of the anomaly group.
listAnomalyGroupTimeSeriesResponse_anomalyGroupId :: Lens.Lens' ListAnomalyGroupTimeSeriesResponse (Prelude.Maybe Prelude.Text)
listAnomalyGroupTimeSeriesResponse_anomalyGroupId :: (Maybe Text -> f (Maybe Text))
-> ListAnomalyGroupTimeSeriesResponse
-> f ListAnomalyGroupTimeSeriesResponse
listAnomalyGroupTimeSeriesResponse_anomalyGroupId = (ListAnomalyGroupTimeSeriesResponse -> Maybe Text)
-> (ListAnomalyGroupTimeSeriesResponse
    -> Maybe Text -> ListAnomalyGroupTimeSeriesResponse)
-> Lens
     ListAnomalyGroupTimeSeriesResponse
     ListAnomalyGroupTimeSeriesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeriesResponse' {Maybe Text
anomalyGroupId :: Maybe Text
$sel:anomalyGroupId:ListAnomalyGroupTimeSeriesResponse' :: ListAnomalyGroupTimeSeriesResponse -> Maybe Text
anomalyGroupId} -> Maybe Text
anomalyGroupId) (\s :: ListAnomalyGroupTimeSeriesResponse
s@ListAnomalyGroupTimeSeriesResponse' {} Maybe Text
a -> ListAnomalyGroupTimeSeriesResponse
s {$sel:anomalyGroupId:ListAnomalyGroupTimeSeriesResponse' :: Maybe Text
anomalyGroupId = Maybe Text
a} :: ListAnomalyGroupTimeSeriesResponse)

-- | The pagination token that\'s included if more results are available.
listAnomalyGroupTimeSeriesResponse_nextToken :: Lens.Lens' ListAnomalyGroupTimeSeriesResponse (Prelude.Maybe Prelude.Text)
listAnomalyGroupTimeSeriesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAnomalyGroupTimeSeriesResponse
-> f ListAnomalyGroupTimeSeriesResponse
listAnomalyGroupTimeSeriesResponse_nextToken = (ListAnomalyGroupTimeSeriesResponse -> Maybe Text)
-> (ListAnomalyGroupTimeSeriesResponse
    -> Maybe Text -> ListAnomalyGroupTimeSeriesResponse)
-> Lens
     ListAnomalyGroupTimeSeriesResponse
     ListAnomalyGroupTimeSeriesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomalyGroupTimeSeriesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAnomalyGroupTimeSeriesResponse' :: ListAnomalyGroupTimeSeriesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAnomalyGroupTimeSeriesResponse
s@ListAnomalyGroupTimeSeriesResponse' {} Maybe Text
a -> ListAnomalyGroupTimeSeriesResponse
s {$sel:nextToken:ListAnomalyGroupTimeSeriesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAnomalyGroupTimeSeriesResponse)

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

instance
  Prelude.NFData
    ListAnomalyGroupTimeSeriesResponse