{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the anomaly detection models that you have created in your
-- account. For single metric anomaly detectors, you can list all of the
-- models in your account or filter the results to only the models that are
-- related to a certain namespace, metric name, or metric dimension. For
-- metric math anomaly detectors, you can list them by adding @METRIC_MATH@
-- to the @AnomalyDetectorTypes@ array. This will return all metric math
-- anomaly detectors in your account.
--
-- This operation returns paginated results.
module Amazonka.CloudWatch.DescribeAnomalyDetectors
  ( -- * Creating a Request
    DescribeAnomalyDetectors (..),
    newDescribeAnomalyDetectors,

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

    -- * 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | The anomaly detector types to request when using
    -- @DescribeAnomalyDetectorsInput@. If empty, defaults to @SINGLE_METRIC@.
    DescribeAnomalyDetectors -> Maybe [AnomalyDetectorType]
anomalyDetectorTypes :: Prelude.Maybe [AnomalyDetectorType],
    -- | 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,
    -- | 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
  }
  deriving (DescribeAnomalyDetectors -> DescribeAnomalyDetectors -> Bool
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]
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
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.
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:
--
-- 'anomalyDetectorTypes', 'describeAnomalyDetectors_anomalyDetectorTypes' - The anomaly detector types to request when using
-- @DescribeAnomalyDetectorsInput@. If empty, defaults to @SINGLE_METRIC@.
--
-- '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.
--
-- '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.
newDescribeAnomalyDetectors ::
  DescribeAnomalyDetectors
newDescribeAnomalyDetectors :: DescribeAnomalyDetectors
newDescribeAnomalyDetectors =
  DescribeAnomalyDetectors'
    { $sel:anomalyDetectorTypes:DescribeAnomalyDetectors' :: Maybe [AnomalyDetectorType]
anomalyDetectorTypes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dimensions:DescribeAnomalyDetectors' :: Maybe [Dimension]
dimensions = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeAnomalyDetectors' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:DescribeAnomalyDetectors' :: Maybe Text
metricName = forall a. Maybe a
Prelude.Nothing,
      $sel:namespace:DescribeAnomalyDetectors' :: Maybe Text
namespace = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAnomalyDetectors' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The anomaly detector types to request when using
-- @DescribeAnomalyDetectorsInput@. If empty, defaults to @SINGLE_METRIC@.
describeAnomalyDetectors_anomalyDetectorTypes :: Lens.Lens' DescribeAnomalyDetectors (Prelude.Maybe [AnomalyDetectorType])
describeAnomalyDetectors_anomalyDetectorTypes :: Lens' DescribeAnomalyDetectors (Maybe [AnomalyDetectorType])
describeAnomalyDetectors_anomalyDetectorTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAnomalyDetectors' {Maybe [AnomalyDetectorType]
anomalyDetectorTypes :: Maybe [AnomalyDetectorType]
$sel:anomalyDetectorTypes:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe [AnomalyDetectorType]
anomalyDetectorTypes} -> Maybe [AnomalyDetectorType]
anomalyDetectorTypes) (\s :: DescribeAnomalyDetectors
s@DescribeAnomalyDetectors' {} Maybe [AnomalyDetectorType]
a -> DescribeAnomalyDetectors
s {$sel:anomalyDetectorTypes:DescribeAnomalyDetectors' :: Maybe [AnomalyDetectorType]
anomalyDetectorTypes = Maybe [AnomalyDetectorType]
a} :: DescribeAnomalyDetectors) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' DescribeAnomalyDetectors (Maybe [Dimension])
describeAnomalyDetectors_dimensions = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' DescribeAnomalyDetectors (Maybe Natural)
describeAnomalyDetectors_maxResults = 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)

-- | 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 :: Lens' DescribeAnomalyDetectors (Maybe Text)
describeAnomalyDetectors_metricName = 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 :: Lens' DescribeAnomalyDetectors (Maybe Text)
describeAnomalyDetectors_namespace = 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 :: Lens' DescribeAnomalyDetectors (Maybe Text)
describeAnomalyDetectors_nextToken = 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)

instance Core.AWSPager DescribeAnomalyDetectors where
  page :: DescribeAnomalyDetectors
-> AWSResponse DescribeAnomalyDetectors
-> Maybe DescribeAnomalyDetectors
page DescribeAnomalyDetectors
rq AWSResponse DescribeAnomalyDetectors
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAnomalyDetectors
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAnomalyDetectorsResponse (Maybe Text)
describeAnomalyDetectorsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAnomalyDetectors
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAnomalyDetectorsResponse (Maybe [AnomalyDetector])
describeAnomalyDetectorsResponse_anomalyDetectors
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeAnomalyDetectors
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeAnomalyDetectors (Maybe Text)
describeAnomalyDetectors_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeAnomalyDetectors
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAnomalyDetectorsResponse (Maybe Text)
describeAnomalyDetectorsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeAnomalyDetectors where
  type
    AWSResponse DescribeAnomalyDetectors =
      DescribeAnomalyDetectorsResponse
  request :: (Service -> Service)
-> DescribeAnomalyDetectors -> Request DescribeAnomalyDetectors
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeAnomalyDetectors
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAnomalyDetectors)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"AnomalyDetectors"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeAnomalyDetectors where
  hashWithSalt :: Int -> DescribeAnomalyDetectors -> Int
hashWithSalt Int
_salt DescribeAnomalyDetectors' {Maybe Natural
Maybe [AnomalyDetectorType]
Maybe [Dimension]
Maybe Text
nextToken :: Maybe Text
namespace :: Maybe Text
metricName :: Maybe Text
maxResults :: Maybe Natural
dimensions :: Maybe [Dimension]
anomalyDetectorTypes :: Maybe [AnomalyDetectorType]
$sel:nextToken:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:namespace:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:metricName:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:maxResults:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Natural
$sel:dimensions:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe [Dimension]
$sel:anomalyDetectorTypes:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe [AnomalyDetectorType]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AnomalyDetectorType]
anomalyDetectorTypes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Dimension]
dimensions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metricName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
namespace
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData DescribeAnomalyDetectors where
  rnf :: DescribeAnomalyDetectors -> ()
rnf DescribeAnomalyDetectors' {Maybe Natural
Maybe [AnomalyDetectorType]
Maybe [Dimension]
Maybe Text
nextToken :: Maybe Text
namespace :: Maybe Text
metricName :: Maybe Text
maxResults :: Maybe Natural
dimensions :: Maybe [Dimension]
anomalyDetectorTypes :: Maybe [AnomalyDetectorType]
$sel:nextToken:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:namespace:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:metricName:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Text
$sel:maxResults:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe Natural
$sel:dimensions:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe [Dimension]
$sel:anomalyDetectorTypes:DescribeAnomalyDetectors' :: DescribeAnomalyDetectors -> Maybe [AnomalyDetectorType]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AnomalyDetectorType]
anomalyDetectorTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Dimension]
dimensions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metricName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
namespace
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

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

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

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

-- | /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
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]
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
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.
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'
    { $sel:anomalyDetectors:DescribeAnomalyDetectorsResponse' :: Maybe [AnomalyDetector]
anomalyDetectors =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAnomalyDetectorsResponse' :: Maybe Text
nextToken = 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 :: Lens' DescribeAnomalyDetectorsResponse (Maybe [AnomalyDetector])
describeAnomalyDetectorsResponse_anomalyDetectors = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' DescribeAnomalyDetectorsResponse (Maybe Text)
describeAnomalyDetectorsResponse_nextToken = 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 :: Lens' DescribeAnomalyDetectorsResponse Int
describeAnomalyDetectorsResponse_httpStatus = 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
  where
  rnf :: DescribeAnomalyDetectorsResponse -> ()
rnf DescribeAnomalyDetectorsResponse' {Int
Maybe [AnomalyDetector]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
anomalyDetectors :: Maybe [AnomalyDetector]
$sel:httpStatus:DescribeAnomalyDetectorsResponse' :: DescribeAnomalyDetectorsResponse -> Int
$sel:nextToken:DescribeAnomalyDetectorsResponse' :: DescribeAnomalyDetectorsResponse -> Maybe Text
$sel:anomalyDetectors:DescribeAnomalyDetectorsResponse' :: DescribeAnomalyDetectorsResponse -> Maybe [AnomalyDetector]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AnomalyDetector]
anomalyDetectors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus