{-# 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.DescribeAnomalyDetectors
-- 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)
--
-- Lists the anomaly detection models that you have created in your
-- account. You can list all models in your account or filter the results
-- to only the models that are related to a certain namespace, metric name,
-- or metric dimension.
module Amazonka.CloudWatch.DescribeAnomalyDetectors
  ( -- * Creating a Request
    DescribeAnomalyDetectors (..),
    newDescribeAnomalyDetectors,

    -- * Request Lenses
    describeAnomalyDetectors_metricName,
    describeAnomalyDetectors_namespace,
    describeAnomalyDetectors_nextToken,
    describeAnomalyDetectors_dimensions,
    describeAnomalyDetectors_maxResults,

    -- * Destructuring the Response
    DescribeAnomalyDetectorsResponse (..),
    newDescribeAnomalyDetectorsResponse,

    -- * Response Lenses
    describeAnomalyDetectorsResponse_anomalyDetectors,
    describeAnomalyDetectorsResponse_nextToken,
    describeAnomalyDetectorsResponse_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:/ 'newDescribeAnomalyDetectors' smart constructor.
data DescribeAnomalyDetectors = DescribeAnomalyDetectors'
  { -- | Limits the results to only the anomaly detection models that are
    -- associated with the specified metric name. If there are multiple metrics
    -- with this name in different namespaces that have anomaly detection
    -- models, they\'re all returned.
    DescribeAnomalyDetectors -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
    -- | Limits the results to only the anomaly detection models that are
    -- associated with the specified namespace.
    DescribeAnomalyDetectors -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | Use the token returned by the previous operation to request the next
    -- page of results.
    DescribeAnomalyDetectors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Limits the results to only the anomaly detection models that are
    -- associated with the specified metric dimensions. If there are multiple
    -- metrics that have these dimensions and have anomaly detection models
    -- associated, they\'re all returned.
    DescribeAnomalyDetectors -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
    -- | The maximum number of results to return in one operation. The maximum
    -- value that you can specify is 100.
    --
    -- To retrieve the remaining results, make another call with the returned
    -- @NextToken@ value.
    DescribeAnomalyDetectors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool
(DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool)
-> (DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool)
-> Eq DescribeAnomalyDetectors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool
$c/= :: DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool
== :: DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool
$c== :: DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool
Prelude.Eq, ReadPrec [DescribeAnomalyDetectors]
ReadPrec DescribeAnomalyDetectors
Int -> ReadS DescribeAnomalyDetectors
ReadS [DescribeAnomalyDetectors]
(Int -> ReadS DescribeAnomalyDetectors)
-> ReadS [DescribeAnomalyDetectors]
-> ReadPrec DescribeAnomalyDetectors
-> ReadPrec [DescribeAnomalyDetectors]
-> Read DescribeAnomalyDetectors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAnomalyDetectors]
$creadListPrec :: ReadPrec [DescribeAnomalyDetectors]
readPrec :: ReadPrec DescribeAnomalyDetectors
$creadPrec :: ReadPrec DescribeAnomalyDetectors
readList :: ReadS [DescribeAnomalyDetectors]
$creadList :: ReadS [DescribeAnomalyDetectors]
readsPrec :: Int -> ReadS DescribeAnomalyDetectors
$creadsPrec :: Int -> ReadS DescribeAnomalyDetectors
Prelude.Read, Int -> DescribeAnomalyDetectors -> ShowS
[DescribeAnomalyDetectors] -> ShowS
DescribeAnomalyDetectors -> String
(Int -> DescribeAnomalyDetectors -> ShowS)
-> (DescribeAnomalyDetectors -> String)
-> ([DescribeAnomalyDetectors] -> ShowS)
-> Show DescribeAnomalyDetectors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAnomalyDetectors] -> ShowS
$cshowList :: [DescribeAnomalyDetectors] -> ShowS
show :: DescribeAnomalyDetectors -> String
$cshow :: DescribeAnomalyDetectors -> String
showsPrec :: Int -> DescribeAnomalyDetectors -> ShowS
$cshowsPrec :: Int -> DescribeAnomalyDetectors -> ShowS
Prelude.Show, (forall x.
 DescribeAnomalyDetectors -> Rep DescribeAnomalyDetectors x)
-> (forall x.
    Rep DescribeAnomalyDetectors x -> DescribeAnomalyDetectors)
-> Generic DescribeAnomalyDetectors
forall x.
Rep DescribeAnomalyDetectors x -> DescribeAnomalyDetectors
forall x.
DescribeAnomalyDetectors -> Rep DescribeAnomalyDetectors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAnomalyDetectors x -> DescribeAnomalyDetectors
$cfrom :: forall x.
DescribeAnomalyDetectors -> Rep DescribeAnomalyDetectors x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAnomalyDetectors' 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', 'describeAnomalyDetectors_metricName' - Limits the results to only the anomaly detection models that are
-- associated with the specified metric name. If there are multiple metrics
-- with this name in different namespaces that have anomaly detection
-- models, they\'re all returned.
--
-- 'namespace', 'describeAnomalyDetectors_namespace' - Limits the results to only the anomaly detection models that are
-- associated with the specified namespace.
--
-- 'nextToken', 'describeAnomalyDetectors_nextToken' - Use the token returned by the previous operation to request the next
-- page of results.
--
-- 'dimensions', 'describeAnomalyDetectors_dimensions' - Limits the results to only the anomaly detection models that are
-- associated with the specified metric dimensions. If there are multiple
-- metrics that have these dimensions and have anomaly detection models
-- associated, they\'re all returned.
--
-- 'maxResults', 'describeAnomalyDetectors_maxResults' - The maximum number of results to return in one operation. The maximum
-- value that you can specify is 100.
--
-- To retrieve the remaining results, make another call with the returned
-- @NextToken@ value.
newDescribeAnomalyDetectors ::
  DescribeAnomalyDetectors
newDescribeAnomalyDetectors :: DescribeAnomalyDetectors
newDescribeAnomalyDetectors =
  DescribeAnomalyDetectors' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Dimension]
-> Maybe Natural
-> DescribeAnomalyDetectors
DescribeAnomalyDetectors'
    { $sel:metricName:DescribeAnomalyDetectors' :: Maybe Text
metricName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:namespace:DescribeAnomalyDetectors' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAnomalyDetectors' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dimensions:DescribeAnomalyDetectors' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeAnomalyDetectors' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Limits the results to only the anomaly detection models that are
-- associated with the specified metric name. If there are multiple metrics
-- with this name in different namespaces that have anomaly detection
-- models, they\'re all returned.
describeAnomalyDetectors_metricName :: Lens.Lens' DescribeAnomalyDetectors (Prelude.Maybe Prelude.Text)
describeAnomalyDetectors_metricName :: (Maybe Text -> f (Maybe Text))
-> DescribeAnomalyDetectors -> f DescribeAnomalyDetectors
describeAnomalyDetectors_metricName = (DescribeAnomalyDetectors -> Maybe Text)
-> (DescribeAnomalyDetectors
    -> Maybe Text -> DescribeAnomalyDetectors)
-> Lens
     DescribeAnomalyDetectors
     DescribeAnomalyDetectors
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectors' {Maybe Text
metricName :: Maybe Text
$sel:metricName:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: DescribeAnomalyDetectors
s@DescribeAnomalyDetectors' {} Maybe Text
a -> DescribeAnomalyDetectors
s {$sel:metricName:DescribeAnomalyDetectors' :: Maybe Text
metricName = Maybe Text
a} :: DescribeAnomalyDetectors)

-- | Limits the results to only the anomaly detection models that are
-- associated with the specified namespace.
describeAnomalyDetectors_namespace :: Lens.Lens' DescribeAnomalyDetectors (Prelude.Maybe Prelude.Text)
describeAnomalyDetectors_namespace :: (Maybe Text -> f (Maybe Text))
-> DescribeAnomalyDetectors -> f DescribeAnomalyDetectors
describeAnomalyDetectors_namespace = (DescribeAnomalyDetectors -> Maybe Text)
-> (DescribeAnomalyDetectors
    -> Maybe Text -> DescribeAnomalyDetectors)
-> Lens
     DescribeAnomalyDetectors
     DescribeAnomalyDetectors
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectors' {Maybe Text
namespace :: Maybe Text
$sel:namespace:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: DescribeAnomalyDetectors
s@DescribeAnomalyDetectors' {} Maybe Text
a -> DescribeAnomalyDetectors
s {$sel:namespace:DescribeAnomalyDetectors' :: Maybe Text
namespace = Maybe Text
a} :: DescribeAnomalyDetectors)

-- | Use the token returned by the previous operation to request the next
-- page of results.
describeAnomalyDetectors_nextToken :: Lens.Lens' DescribeAnomalyDetectors (Prelude.Maybe Prelude.Text)
describeAnomalyDetectors_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAnomalyDetectors -> f DescribeAnomalyDetectors
describeAnomalyDetectors_nextToken = (DescribeAnomalyDetectors -> Maybe Text)
-> (DescribeAnomalyDetectors
    -> Maybe Text -> DescribeAnomalyDetectors)
-> Lens
     DescribeAnomalyDetectors
     DescribeAnomalyDetectors
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectors' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAnomalyDetectors
s@DescribeAnomalyDetectors' {} Maybe Text
a -> DescribeAnomalyDetectors
s {$sel:nextToken:DescribeAnomalyDetectors' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAnomalyDetectors)

-- | Limits the results to only the anomaly detection models that are
-- associated with the specified metric dimensions. If there are multiple
-- metrics that have these dimensions and have anomaly detection models
-- associated, they\'re all returned.
describeAnomalyDetectors_dimensions :: Lens.Lens' DescribeAnomalyDetectors (Prelude.Maybe [Dimension])
describeAnomalyDetectors_dimensions :: (Maybe [Dimension] -> f (Maybe [Dimension]))
-> DescribeAnomalyDetectors -> f DescribeAnomalyDetectors
describeAnomalyDetectors_dimensions = (DescribeAnomalyDetectors -> Maybe [Dimension])
-> (DescribeAnomalyDetectors
    -> Maybe [Dimension] -> DescribeAnomalyDetectors)
-> Lens
     DescribeAnomalyDetectors
     DescribeAnomalyDetectors
     (Maybe [Dimension])
     (Maybe [Dimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectors' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: DescribeAnomalyDetectors
s@DescribeAnomalyDetectors' {} Maybe [Dimension]
a -> DescribeAnomalyDetectors
s {$sel:dimensions:DescribeAnomalyDetectors' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: DescribeAnomalyDetectors) ((Maybe [Dimension] -> f (Maybe [Dimension]))
 -> DescribeAnomalyDetectors -> f DescribeAnomalyDetectors)
-> ((Maybe [Dimension] -> f (Maybe [Dimension]))
    -> Maybe [Dimension] -> f (Maybe [Dimension]))
-> (Maybe [Dimension] -> f (Maybe [Dimension]))
-> DescribeAnomalyDetectors
-> f DescribeAnomalyDetectors
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Dimension] [Dimension] [Dimension] [Dimension]
-> Iso
     (Maybe [Dimension])
     (Maybe [Dimension])
     (Maybe [Dimension])
     (Maybe [Dimension])
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 [Dimension] [Dimension] [Dimension] [Dimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of results to return in one operation. The maximum
-- value that you can specify is 100.
--
-- To retrieve the remaining results, make another call with the returned
-- @NextToken@ value.
describeAnomalyDetectors_maxResults :: Lens.Lens' DescribeAnomalyDetectors (Prelude.Maybe Prelude.Natural)
describeAnomalyDetectors_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeAnomalyDetectors -> f DescribeAnomalyDetectors
describeAnomalyDetectors_maxResults = (DescribeAnomalyDetectors -> Maybe Natural)
-> (DescribeAnomalyDetectors
    -> Maybe Natural -> DescribeAnomalyDetectors)
-> Lens
     DescribeAnomalyDetectors
     DescribeAnomalyDetectors
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectors' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeAnomalyDetectors
s@DescribeAnomalyDetectors' {} Maybe Natural
a -> DescribeAnomalyDetectors
s {$sel:maxResults:DescribeAnomalyDetectors' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeAnomalyDetectors)

instance Core.AWSRequest DescribeAnomalyDetectors where
  type
    AWSResponse DescribeAnomalyDetectors =
      DescribeAnomalyDetectorsResponse
  request :: DescribeAnomalyDetectors -> Request DescribeAnomalyDetectors
request = Service
-> DescribeAnomalyDetectors -> Request DescribeAnomalyDetectors
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAnomalyDetectors
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAnomalyDetectors)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeAnomalyDetectors))
-> Logger
-> Service
-> Proxy DescribeAnomalyDetectors
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAnomalyDetectors)))
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
"DescribeAnomalyDetectorsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [AnomalyDetector]
-> Maybe Text -> Int -> DescribeAnomalyDetectorsResponse
DescribeAnomalyDetectorsResponse'
            (Maybe [AnomalyDetector]
 -> Maybe Text -> Int -> DescribeAnomalyDetectorsResponse)
-> Either String (Maybe [AnomalyDetector])
-> Either
     String (Maybe Text -> Int -> DescribeAnomalyDetectorsResponse)
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
"AnomalyDetectors"
                            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 [AnomalyDetector]))
-> Either String (Maybe [AnomalyDetector])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AnomalyDetector])
-> [Node] -> Either String (Maybe [AnomalyDetector])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AnomalyDetector]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String (Maybe Text -> Int -> DescribeAnomalyDetectorsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeAnomalyDetectorsResponse)
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
"NextToken")
            Either String (Int -> DescribeAnomalyDetectorsResponse)
-> Either String Int
-> Either String DescribeAnomalyDetectorsResponse
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 DescribeAnomalyDetectors

instance Prelude.NFData DescribeAnomalyDetectors

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

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

instance Core.ToQuery DescribeAnomalyDetectors where
  toQuery :: DescribeAnomalyDetectors -> QueryString
toQuery DescribeAnomalyDetectors' {Maybe Natural
Maybe [Dimension]
Maybe Text
maxResults :: Maybe Natural
dimensions :: Maybe [Dimension]
nextToken :: Maybe Text
namespace :: Maybe Text
metricName :: Maybe Text
$sel:maxResults:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Natural
$sel:dimensions:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe [Dimension]
$sel:nextToken:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:namespace:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:metricName:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeAnomalyDetectors" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"MetricName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
metricName,
        ByteString
"Namespace" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
namespace,
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"Dimensions"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Dimension] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Dimension] -> QueryString)
-> Maybe [Dimension] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Dimension]
dimensions),
        ByteString
"MaxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newDescribeAnomalyDetectorsResponse' smart constructor.
data DescribeAnomalyDetectorsResponse = DescribeAnomalyDetectorsResponse'
  { -- | The list of anomaly detection models returned by the operation.
    DescribeAnomalyDetectorsResponse -> Maybe [AnomalyDetector]
anomalyDetectors :: Prelude.Maybe [AnomalyDetector],
    -- | A token that you can use in a subsequent operation to retrieve the next
    -- set of results.
    DescribeAnomalyDetectorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeAnomalyDetectorsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAnomalyDetectorsResponse
-> DescribeAnomalyDetectorsResponse -> Bool
(DescribeAnomalyDetectorsResponse
 -> DescribeAnomalyDetectorsResponse -> Bool)
-> (DescribeAnomalyDetectorsResponse
    -> DescribeAnomalyDetectorsResponse -> Bool)
-> Eq DescribeAnomalyDetectorsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAnomalyDetectorsResponse
-> DescribeAnomalyDetectorsResponse -> Bool
$c/= :: DescribeAnomalyDetectorsResponse
-> DescribeAnomalyDetectorsResponse -> Bool
== :: DescribeAnomalyDetectorsResponse
-> DescribeAnomalyDetectorsResponse -> Bool
$c== :: DescribeAnomalyDetectorsResponse
-> DescribeAnomalyDetectorsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAnomalyDetectorsResponse]
ReadPrec DescribeAnomalyDetectorsResponse
Int -> ReadS DescribeAnomalyDetectorsResponse
ReadS [DescribeAnomalyDetectorsResponse]
(Int -> ReadS DescribeAnomalyDetectorsResponse)
-> ReadS [DescribeAnomalyDetectorsResponse]
-> ReadPrec DescribeAnomalyDetectorsResponse
-> ReadPrec [DescribeAnomalyDetectorsResponse]
-> Read DescribeAnomalyDetectorsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAnomalyDetectorsResponse]
$creadListPrec :: ReadPrec [DescribeAnomalyDetectorsResponse]
readPrec :: ReadPrec DescribeAnomalyDetectorsResponse
$creadPrec :: ReadPrec DescribeAnomalyDetectorsResponse
readList :: ReadS [DescribeAnomalyDetectorsResponse]
$creadList :: ReadS [DescribeAnomalyDetectorsResponse]
readsPrec :: Int -> ReadS DescribeAnomalyDetectorsResponse
$creadsPrec :: Int -> ReadS DescribeAnomalyDetectorsResponse
Prelude.Read, Int -> DescribeAnomalyDetectorsResponse -> ShowS
[DescribeAnomalyDetectorsResponse] -> ShowS
DescribeAnomalyDetectorsResponse -> String
(Int -> DescribeAnomalyDetectorsResponse -> ShowS)
-> (DescribeAnomalyDetectorsResponse -> String)
-> ([DescribeAnomalyDetectorsResponse] -> ShowS)
-> Show DescribeAnomalyDetectorsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAnomalyDetectorsResponse] -> ShowS
$cshowList :: [DescribeAnomalyDetectorsResponse] -> ShowS
show :: DescribeAnomalyDetectorsResponse -> String
$cshow :: DescribeAnomalyDetectorsResponse -> String
showsPrec :: Int -> DescribeAnomalyDetectorsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAnomalyDetectorsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAnomalyDetectorsResponse
 -> Rep DescribeAnomalyDetectorsResponse x)
-> (forall x.
    Rep DescribeAnomalyDetectorsResponse x
    -> DescribeAnomalyDetectorsResponse)
-> Generic DescribeAnomalyDetectorsResponse
forall x.
Rep DescribeAnomalyDetectorsResponse x
-> DescribeAnomalyDetectorsResponse
forall x.
DescribeAnomalyDetectorsResponse
-> Rep DescribeAnomalyDetectorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAnomalyDetectorsResponse x
-> DescribeAnomalyDetectorsResponse
$cfrom :: forall x.
DescribeAnomalyDetectorsResponse
-> Rep DescribeAnomalyDetectorsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAnomalyDetectorsResponse' 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:
--
-- 'anomalyDetectors', 'describeAnomalyDetectorsResponse_anomalyDetectors' - The list of anomaly detection models returned by the operation.
--
-- 'nextToken', 'describeAnomalyDetectorsResponse_nextToken' - A token that you can use in a subsequent operation to retrieve the next
-- set of results.
--
-- 'httpStatus', 'describeAnomalyDetectorsResponse_httpStatus' - The response's http status code.
newDescribeAnomalyDetectorsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAnomalyDetectorsResponse
newDescribeAnomalyDetectorsResponse :: Int -> DescribeAnomalyDetectorsResponse
newDescribeAnomalyDetectorsResponse Int
pHttpStatus_ =
  DescribeAnomalyDetectorsResponse' :: Maybe [AnomalyDetector]
-> Maybe Text -> Int -> DescribeAnomalyDetectorsResponse
DescribeAnomalyDetectorsResponse'
    { $sel:anomalyDetectors:DescribeAnomalyDetectorsResponse' :: Maybe [AnomalyDetector]
anomalyDetectors =
        Maybe [AnomalyDetector]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAnomalyDetectorsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAnomalyDetectorsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of anomaly detection models returned by the operation.
describeAnomalyDetectorsResponse_anomalyDetectors :: Lens.Lens' DescribeAnomalyDetectorsResponse (Prelude.Maybe [AnomalyDetector])
describeAnomalyDetectorsResponse_anomalyDetectors :: (Maybe [AnomalyDetector] -> f (Maybe [AnomalyDetector]))
-> DescribeAnomalyDetectorsResponse
-> f DescribeAnomalyDetectorsResponse
describeAnomalyDetectorsResponse_anomalyDetectors = (DescribeAnomalyDetectorsResponse -> Maybe [AnomalyDetector])
-> (DescribeAnomalyDetectorsResponse
    -> Maybe [AnomalyDetector] -> DescribeAnomalyDetectorsResponse)
-> Lens
     DescribeAnomalyDetectorsResponse
     DescribeAnomalyDetectorsResponse
     (Maybe [AnomalyDetector])
     (Maybe [AnomalyDetector])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectorsResponse' {Maybe [AnomalyDetector]
anomalyDetectors :: Maybe [AnomalyDetector]
$sel:anomalyDetectors:DescribeAnomalyDetectorsResponse' :: DescribeAnomalyDetectorsResponse -> Maybe [AnomalyDetector]
anomalyDetectors} -> Maybe [AnomalyDetector]
anomalyDetectors) (\s :: DescribeAnomalyDetectorsResponse
s@DescribeAnomalyDetectorsResponse' {} Maybe [AnomalyDetector]
a -> DescribeAnomalyDetectorsResponse
s {$sel:anomalyDetectors:DescribeAnomalyDetectorsResponse' :: Maybe [AnomalyDetector]
anomalyDetectors = Maybe [AnomalyDetector]
a} :: DescribeAnomalyDetectorsResponse) ((Maybe [AnomalyDetector] -> f (Maybe [AnomalyDetector]))
 -> DescribeAnomalyDetectorsResponse
 -> f DescribeAnomalyDetectorsResponse)
-> ((Maybe [AnomalyDetector] -> f (Maybe [AnomalyDetector]))
    -> Maybe [AnomalyDetector] -> f (Maybe [AnomalyDetector]))
-> (Maybe [AnomalyDetector] -> f (Maybe [AnomalyDetector]))
-> DescribeAnomalyDetectorsResponse
-> f DescribeAnomalyDetectorsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AnomalyDetector]
  [AnomalyDetector]
  [AnomalyDetector]
  [AnomalyDetector]
-> Iso
     (Maybe [AnomalyDetector])
     (Maybe [AnomalyDetector])
     (Maybe [AnomalyDetector])
     (Maybe [AnomalyDetector])
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
  [AnomalyDetector]
  [AnomalyDetector]
  [AnomalyDetector]
  [AnomalyDetector]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token that you can use in a subsequent operation to retrieve the next
-- set of results.
describeAnomalyDetectorsResponse_nextToken :: Lens.Lens' DescribeAnomalyDetectorsResponse (Prelude.Maybe Prelude.Text)
describeAnomalyDetectorsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAnomalyDetectorsResponse
-> f DescribeAnomalyDetectorsResponse
describeAnomalyDetectorsResponse_nextToken = (DescribeAnomalyDetectorsResponse -> Maybe Text)
-> (DescribeAnomalyDetectorsResponse
    -> Maybe Text -> DescribeAnomalyDetectorsResponse)
-> Lens
     DescribeAnomalyDetectorsResponse
     DescribeAnomalyDetectorsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectorsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAnomalyDetectorsResponse' :: DescribeAnomalyDetectorsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAnomalyDetectorsResponse
s@DescribeAnomalyDetectorsResponse' {} Maybe Text
a -> DescribeAnomalyDetectorsResponse
s {$sel:nextToken:DescribeAnomalyDetectorsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAnomalyDetectorsResponse)

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

instance
  Prelude.NFData
    DescribeAnomalyDetectorsResponse