{-# 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.DevOpsGuru.ListAnomaliesForInsight
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of the anomalies that belong to an insight that you
-- specify using its ID.
--
-- This operation returns paginated results.
module Amazonka.DevOpsGuru.ListAnomaliesForInsight
  ( -- * Creating a Request
    ListAnomaliesForInsight (..),
    newListAnomaliesForInsight,

    -- * Request Lenses
    listAnomaliesForInsight_accountId,
    listAnomaliesForInsight_maxResults,
    listAnomaliesForInsight_nextToken,
    listAnomaliesForInsight_startTimeRange,
    listAnomaliesForInsight_insightId,

    -- * Destructuring the Response
    ListAnomaliesForInsightResponse (..),
    newListAnomaliesForInsightResponse,

    -- * Response Lenses
    listAnomaliesForInsightResponse_nextToken,
    listAnomaliesForInsightResponse_proactiveAnomalies,
    listAnomaliesForInsightResponse_reactiveAnomalies,
    listAnomaliesForInsightResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListAnomaliesForInsight' smart constructor.
data ListAnomaliesForInsight = ListAnomaliesForInsight'
  { -- | The ID of the Amazon Web Services account.
    ListAnomaliesForInsight -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return with a single call. To retrieve
    -- the remaining results, make another call with the returned @nextToken@
    -- value.
    ListAnomaliesForInsight -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If this value is null, it retrieves the first page.
    ListAnomaliesForInsight -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A time range used to specify when the requested anomalies started. All
    -- returned anomalies started during this time range.
    ListAnomaliesForInsight -> Maybe StartTimeRange
startTimeRange :: Prelude.Maybe StartTimeRange,
    -- | The ID of the insight. The returned anomalies belong to this insight.
    ListAnomaliesForInsight -> Text
insightId :: Prelude.Text
  }
  deriving (ListAnomaliesForInsight -> ListAnomaliesForInsight -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAnomaliesForInsight -> ListAnomaliesForInsight -> Bool
$c/= :: ListAnomaliesForInsight -> ListAnomaliesForInsight -> Bool
== :: ListAnomaliesForInsight -> ListAnomaliesForInsight -> Bool
$c== :: ListAnomaliesForInsight -> ListAnomaliesForInsight -> Bool
Prelude.Eq, ReadPrec [ListAnomaliesForInsight]
ReadPrec ListAnomaliesForInsight
Int -> ReadS ListAnomaliesForInsight
ReadS [ListAnomaliesForInsight]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAnomaliesForInsight]
$creadListPrec :: ReadPrec [ListAnomaliesForInsight]
readPrec :: ReadPrec ListAnomaliesForInsight
$creadPrec :: ReadPrec ListAnomaliesForInsight
readList :: ReadS [ListAnomaliesForInsight]
$creadList :: ReadS [ListAnomaliesForInsight]
readsPrec :: Int -> ReadS ListAnomaliesForInsight
$creadsPrec :: Int -> ReadS ListAnomaliesForInsight
Prelude.Read, Int -> ListAnomaliesForInsight -> ShowS
[ListAnomaliesForInsight] -> ShowS
ListAnomaliesForInsight -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAnomaliesForInsight] -> ShowS
$cshowList :: [ListAnomaliesForInsight] -> ShowS
show :: ListAnomaliesForInsight -> String
$cshow :: ListAnomaliesForInsight -> String
showsPrec :: Int -> ListAnomaliesForInsight -> ShowS
$cshowsPrec :: Int -> ListAnomaliesForInsight -> ShowS
Prelude.Show, forall x. Rep ListAnomaliesForInsight x -> ListAnomaliesForInsight
forall x. ListAnomaliesForInsight -> Rep ListAnomaliesForInsight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAnomaliesForInsight x -> ListAnomaliesForInsight
$cfrom :: forall x. ListAnomaliesForInsight -> Rep ListAnomaliesForInsight x
Prelude.Generic)

-- |
-- Create a value of 'ListAnomaliesForInsight' 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:
--
-- 'accountId', 'listAnomaliesForInsight_accountId' - The ID of the Amazon Web Services account.
--
-- 'maxResults', 'listAnomaliesForInsight_maxResults' - The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
--
-- 'nextToken', 'listAnomaliesForInsight_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
--
-- 'startTimeRange', 'listAnomaliesForInsight_startTimeRange' - A time range used to specify when the requested anomalies started. All
-- returned anomalies started during this time range.
--
-- 'insightId', 'listAnomaliesForInsight_insightId' - The ID of the insight. The returned anomalies belong to this insight.
newListAnomaliesForInsight ::
  -- | 'insightId'
  Prelude.Text ->
  ListAnomaliesForInsight
newListAnomaliesForInsight :: Text -> ListAnomaliesForInsight
newListAnomaliesForInsight Text
pInsightId_ =
  ListAnomaliesForInsight'
    { $sel:accountId:ListAnomaliesForInsight' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAnomaliesForInsight' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAnomaliesForInsight' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:startTimeRange:ListAnomaliesForInsight' :: Maybe StartTimeRange
startTimeRange = forall a. Maybe a
Prelude.Nothing,
      $sel:insightId:ListAnomaliesForInsight' :: Text
insightId = Text
pInsightId_
    }

-- | The ID of the Amazon Web Services account.
listAnomaliesForInsight_accountId :: Lens.Lens' ListAnomaliesForInsight (Prelude.Maybe Prelude.Text)
listAnomaliesForInsight_accountId :: Lens' ListAnomaliesForInsight (Maybe Text)
listAnomaliesForInsight_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsight' {Maybe Text
accountId :: Maybe Text
$sel:accountId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: ListAnomaliesForInsight
s@ListAnomaliesForInsight' {} Maybe Text
a -> ListAnomaliesForInsight
s {$sel:accountId:ListAnomaliesForInsight' :: Maybe Text
accountId = Maybe Text
a} :: ListAnomaliesForInsight)

-- | The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
listAnomaliesForInsight_maxResults :: Lens.Lens' ListAnomaliesForInsight (Prelude.Maybe Prelude.Natural)
listAnomaliesForInsight_maxResults :: Lens' ListAnomaliesForInsight (Maybe Natural)
listAnomaliesForInsight_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsight' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAnomaliesForInsight
s@ListAnomaliesForInsight' {} Maybe Natural
a -> ListAnomaliesForInsight
s {$sel:maxResults:ListAnomaliesForInsight' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAnomaliesForInsight)

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
listAnomaliesForInsight_nextToken :: Lens.Lens' ListAnomaliesForInsight (Prelude.Maybe Prelude.Text)
listAnomaliesForInsight_nextToken :: Lens' ListAnomaliesForInsight (Maybe Text)
listAnomaliesForInsight_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsight' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAnomaliesForInsight
s@ListAnomaliesForInsight' {} Maybe Text
a -> ListAnomaliesForInsight
s {$sel:nextToken:ListAnomaliesForInsight' :: Maybe Text
nextToken = Maybe Text
a} :: ListAnomaliesForInsight)

-- | A time range used to specify when the requested anomalies started. All
-- returned anomalies started during this time range.
listAnomaliesForInsight_startTimeRange :: Lens.Lens' ListAnomaliesForInsight (Prelude.Maybe StartTimeRange)
listAnomaliesForInsight_startTimeRange :: Lens' ListAnomaliesForInsight (Maybe StartTimeRange)
listAnomaliesForInsight_startTimeRange = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsight' {Maybe StartTimeRange
startTimeRange :: Maybe StartTimeRange
$sel:startTimeRange:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe StartTimeRange
startTimeRange} -> Maybe StartTimeRange
startTimeRange) (\s :: ListAnomaliesForInsight
s@ListAnomaliesForInsight' {} Maybe StartTimeRange
a -> ListAnomaliesForInsight
s {$sel:startTimeRange:ListAnomaliesForInsight' :: Maybe StartTimeRange
startTimeRange = Maybe StartTimeRange
a} :: ListAnomaliesForInsight)

-- | The ID of the insight. The returned anomalies belong to this insight.
listAnomaliesForInsight_insightId :: Lens.Lens' ListAnomaliesForInsight Prelude.Text
listAnomaliesForInsight_insightId :: Lens' ListAnomaliesForInsight Text
listAnomaliesForInsight_insightId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsight' {Text
insightId :: Text
$sel:insightId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Text
insightId} -> Text
insightId) (\s :: ListAnomaliesForInsight
s@ListAnomaliesForInsight' {} Text
a -> ListAnomaliesForInsight
s {$sel:insightId:ListAnomaliesForInsight' :: Text
insightId = Text
a} :: ListAnomaliesForInsight)

instance Core.AWSPager ListAnomaliesForInsight where
  page :: ListAnomaliesForInsight
-> AWSResponse ListAnomaliesForInsight
-> Maybe ListAnomaliesForInsight
page ListAnomaliesForInsight
rq AWSResponse ListAnomaliesForInsight
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAnomaliesForInsight
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAnomaliesForInsightResponse (Maybe Text)
listAnomaliesForInsightResponse_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 ListAnomaliesForInsight
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListAnomaliesForInsightResponse (Maybe [ReactiveAnomalySummary])
listAnomaliesForInsightResponse_reactiveAnomalies
            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 ListAnomaliesForInsight
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListAnomaliesForInsightResponse (Maybe [ProactiveAnomalySummary])
listAnomaliesForInsightResponse_proactiveAnomalies
            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.$ ListAnomaliesForInsight
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAnomaliesForInsight (Maybe Text)
listAnomaliesForInsight_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAnomaliesForInsight
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAnomaliesForInsightResponse (Maybe Text)
listAnomaliesForInsightResponse_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 ListAnomaliesForInsight where
  type
    AWSResponse ListAnomaliesForInsight =
      ListAnomaliesForInsightResponse
  request :: (Service -> Service)
-> ListAnomaliesForInsight -> Request ListAnomaliesForInsight
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListAnomaliesForInsight
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAnomaliesForInsight)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ProactiveAnomalySummary]
-> Maybe [ReactiveAnomalySummary]
-> Int
-> ListAnomaliesForInsightResponse
ListAnomaliesForInsightResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ProactiveAnomalies"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ReactiveAnomalies"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            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 ListAnomaliesForInsight where
  hashWithSalt :: Int -> ListAnomaliesForInsight -> Int
hashWithSalt Int
_salt ListAnomaliesForInsight' {Maybe Natural
Maybe Text
Maybe StartTimeRange
Text
insightId :: Text
startTimeRange :: Maybe StartTimeRange
nextToken :: Maybe Text
maxResults :: Maybe Natural
accountId :: Maybe Text
$sel:insightId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Text
$sel:startTimeRange:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe StartTimeRange
$sel:nextToken:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
$sel:maxResults:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Natural
$sel:accountId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StartTimeRange
startTimeRange
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
insightId

instance Prelude.NFData ListAnomaliesForInsight where
  rnf :: ListAnomaliesForInsight -> ()
rnf ListAnomaliesForInsight' {Maybe Natural
Maybe Text
Maybe StartTimeRange
Text
insightId :: Text
startTimeRange :: Maybe StartTimeRange
nextToken :: Maybe Text
maxResults :: Maybe Natural
accountId :: Maybe Text
$sel:insightId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Text
$sel:startTimeRange:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe StartTimeRange
$sel:nextToken:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
$sel:maxResults:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Natural
$sel:accountId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      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
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StartTimeRange
startTimeRange
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
insightId

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

instance Data.ToJSON ListAnomaliesForInsight where
  toJSON :: ListAnomaliesForInsight -> Value
toJSON ListAnomaliesForInsight' {Maybe Natural
Maybe Text
Maybe StartTimeRange
Text
insightId :: Text
startTimeRange :: Maybe StartTimeRange
nextToken :: Maybe Text
maxResults :: Maybe Natural
accountId :: Maybe Text
$sel:insightId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Text
$sel:startTimeRange:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe StartTimeRange
$sel:nextToken:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
$sel:maxResults:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Natural
$sel:accountId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AccountId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accountId,
            (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"StartTimeRange" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StartTimeRange
startTimeRange
          ]
      )

instance Data.ToPath ListAnomaliesForInsight where
  toPath :: ListAnomaliesForInsight -> ByteString
toPath ListAnomaliesForInsight' {Maybe Natural
Maybe Text
Maybe StartTimeRange
Text
insightId :: Text
startTimeRange :: Maybe StartTimeRange
nextToken :: Maybe Text
maxResults :: Maybe Natural
accountId :: Maybe Text
$sel:insightId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Text
$sel:startTimeRange:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe StartTimeRange
$sel:nextToken:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
$sel:maxResults:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Natural
$sel:accountId:ListAnomaliesForInsight' :: ListAnomaliesForInsight -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/anomalies/insight/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
insightId]

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

-- | /See:/ 'newListAnomaliesForInsightResponse' smart constructor.
data ListAnomaliesForInsightResponse = ListAnomaliesForInsightResponse'
  { -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If there are no more pages, this value is null.
    ListAnomaliesForInsightResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of @ProactiveAnomalySummary@ objects that represent the
    -- requested anomalies
    ListAnomaliesForInsightResponse -> Maybe [ProactiveAnomalySummary]
proactiveAnomalies :: Prelude.Maybe [ProactiveAnomalySummary],
    -- | An array of @ReactiveAnomalySummary@ objects that represent the
    -- requested anomalies
    ListAnomaliesForInsightResponse -> Maybe [ReactiveAnomalySummary]
reactiveAnomalies :: Prelude.Maybe [ReactiveAnomalySummary],
    -- | The response's http status code.
    ListAnomaliesForInsightResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAnomaliesForInsightResponse
-> ListAnomaliesForInsightResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAnomaliesForInsightResponse
-> ListAnomaliesForInsightResponse -> Bool
$c/= :: ListAnomaliesForInsightResponse
-> ListAnomaliesForInsightResponse -> Bool
== :: ListAnomaliesForInsightResponse
-> ListAnomaliesForInsightResponse -> Bool
$c== :: ListAnomaliesForInsightResponse
-> ListAnomaliesForInsightResponse -> Bool
Prelude.Eq, ReadPrec [ListAnomaliesForInsightResponse]
ReadPrec ListAnomaliesForInsightResponse
Int -> ReadS ListAnomaliesForInsightResponse
ReadS [ListAnomaliesForInsightResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAnomaliesForInsightResponse]
$creadListPrec :: ReadPrec [ListAnomaliesForInsightResponse]
readPrec :: ReadPrec ListAnomaliesForInsightResponse
$creadPrec :: ReadPrec ListAnomaliesForInsightResponse
readList :: ReadS [ListAnomaliesForInsightResponse]
$creadList :: ReadS [ListAnomaliesForInsightResponse]
readsPrec :: Int -> ReadS ListAnomaliesForInsightResponse
$creadsPrec :: Int -> ReadS ListAnomaliesForInsightResponse
Prelude.Read, Int -> ListAnomaliesForInsightResponse -> ShowS
[ListAnomaliesForInsightResponse] -> ShowS
ListAnomaliesForInsightResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAnomaliesForInsightResponse] -> ShowS
$cshowList :: [ListAnomaliesForInsightResponse] -> ShowS
show :: ListAnomaliesForInsightResponse -> String
$cshow :: ListAnomaliesForInsightResponse -> String
showsPrec :: Int -> ListAnomaliesForInsightResponse -> ShowS
$cshowsPrec :: Int -> ListAnomaliesForInsightResponse -> ShowS
Prelude.Show, forall x.
Rep ListAnomaliesForInsightResponse x
-> ListAnomaliesForInsightResponse
forall x.
ListAnomaliesForInsightResponse
-> Rep ListAnomaliesForInsightResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAnomaliesForInsightResponse x
-> ListAnomaliesForInsightResponse
$cfrom :: forall x.
ListAnomaliesForInsightResponse
-> Rep ListAnomaliesForInsightResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAnomaliesForInsightResponse' 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', 'listAnomaliesForInsightResponse_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
--
-- 'proactiveAnomalies', 'listAnomaliesForInsightResponse_proactiveAnomalies' - An array of @ProactiveAnomalySummary@ objects that represent the
-- requested anomalies
--
-- 'reactiveAnomalies', 'listAnomaliesForInsightResponse_reactiveAnomalies' - An array of @ReactiveAnomalySummary@ objects that represent the
-- requested anomalies
--
-- 'httpStatus', 'listAnomaliesForInsightResponse_httpStatus' - The response's http status code.
newListAnomaliesForInsightResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAnomaliesForInsightResponse
newListAnomaliesForInsightResponse :: Int -> ListAnomaliesForInsightResponse
newListAnomaliesForInsightResponse Int
pHttpStatus_ =
  ListAnomaliesForInsightResponse'
    { $sel:nextToken:ListAnomaliesForInsightResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:proactiveAnomalies:ListAnomaliesForInsightResponse' :: Maybe [ProactiveAnomalySummary]
proactiveAnomalies = forall a. Maybe a
Prelude.Nothing,
      $sel:reactiveAnomalies:ListAnomaliesForInsightResponse' :: Maybe [ReactiveAnomalySummary]
reactiveAnomalies = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAnomaliesForInsightResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
listAnomaliesForInsightResponse_nextToken :: Lens.Lens' ListAnomaliesForInsightResponse (Prelude.Maybe Prelude.Text)
listAnomaliesForInsightResponse_nextToken :: Lens' ListAnomaliesForInsightResponse (Maybe Text)
listAnomaliesForInsightResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsightResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAnomaliesForInsightResponse
s@ListAnomaliesForInsightResponse' {} Maybe Text
a -> ListAnomaliesForInsightResponse
s {$sel:nextToken:ListAnomaliesForInsightResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAnomaliesForInsightResponse)

-- | An array of @ProactiveAnomalySummary@ objects that represent the
-- requested anomalies
listAnomaliesForInsightResponse_proactiveAnomalies :: Lens.Lens' ListAnomaliesForInsightResponse (Prelude.Maybe [ProactiveAnomalySummary])
listAnomaliesForInsightResponse_proactiveAnomalies :: Lens'
  ListAnomaliesForInsightResponse (Maybe [ProactiveAnomalySummary])
listAnomaliesForInsightResponse_proactiveAnomalies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsightResponse' {Maybe [ProactiveAnomalySummary]
proactiveAnomalies :: Maybe [ProactiveAnomalySummary]
$sel:proactiveAnomalies:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Maybe [ProactiveAnomalySummary]
proactiveAnomalies} -> Maybe [ProactiveAnomalySummary]
proactiveAnomalies) (\s :: ListAnomaliesForInsightResponse
s@ListAnomaliesForInsightResponse' {} Maybe [ProactiveAnomalySummary]
a -> ListAnomaliesForInsightResponse
s {$sel:proactiveAnomalies:ListAnomaliesForInsightResponse' :: Maybe [ProactiveAnomalySummary]
proactiveAnomalies = Maybe [ProactiveAnomalySummary]
a} :: ListAnomaliesForInsightResponse) 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

-- | An array of @ReactiveAnomalySummary@ objects that represent the
-- requested anomalies
listAnomaliesForInsightResponse_reactiveAnomalies :: Lens.Lens' ListAnomaliesForInsightResponse (Prelude.Maybe [ReactiveAnomalySummary])
listAnomaliesForInsightResponse_reactiveAnomalies :: Lens'
  ListAnomaliesForInsightResponse (Maybe [ReactiveAnomalySummary])
listAnomaliesForInsightResponse_reactiveAnomalies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsightResponse' {Maybe [ReactiveAnomalySummary]
reactiveAnomalies :: Maybe [ReactiveAnomalySummary]
$sel:reactiveAnomalies:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Maybe [ReactiveAnomalySummary]
reactiveAnomalies} -> Maybe [ReactiveAnomalySummary]
reactiveAnomalies) (\s :: ListAnomaliesForInsightResponse
s@ListAnomaliesForInsightResponse' {} Maybe [ReactiveAnomalySummary]
a -> ListAnomaliesForInsightResponse
s {$sel:reactiveAnomalies:ListAnomaliesForInsightResponse' :: Maybe [ReactiveAnomalySummary]
reactiveAnomalies = Maybe [ReactiveAnomalySummary]
a} :: ListAnomaliesForInsightResponse) 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 response's http status code.
listAnomaliesForInsightResponse_httpStatus :: Lens.Lens' ListAnomaliesForInsightResponse Prelude.Int
listAnomaliesForInsightResponse_httpStatus :: Lens' ListAnomaliesForInsightResponse Int
listAnomaliesForInsightResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAnomaliesForInsightResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAnomaliesForInsightResponse
s@ListAnomaliesForInsightResponse' {} Int
a -> ListAnomaliesForInsightResponse
s {$sel:httpStatus:ListAnomaliesForInsightResponse' :: Int
httpStatus = Int
a} :: ListAnomaliesForInsightResponse)

instance
  Prelude.NFData
    ListAnomaliesForInsightResponse
  where
  rnf :: ListAnomaliesForInsightResponse -> ()
rnf ListAnomaliesForInsightResponse' {Int
Maybe [ReactiveAnomalySummary]
Maybe [ProactiveAnomalySummary]
Maybe Text
httpStatus :: Int
reactiveAnomalies :: Maybe [ReactiveAnomalySummary]
proactiveAnomalies :: Maybe [ProactiveAnomalySummary]
nextToken :: Maybe Text
$sel:httpStatus:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Int
$sel:reactiveAnomalies:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Maybe [ReactiveAnomalySummary]
$sel:proactiveAnomalies:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Maybe [ProactiveAnomalySummary]
$sel:nextToken:ListAnomaliesForInsightResponse' :: ListAnomaliesForInsightResponse -> Maybe Text
..} =
    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 Maybe [ProactiveAnomalySummary]
proactiveAnomalies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReactiveAnomalySummary]
reactiveAnomalies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus