{-# 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.SageMaker.ListMonitoringAlertHistory
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets a list of past alerts in a model monitoring schedule.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListMonitoringAlertHistory
  ( -- * Creating a Request
    ListMonitoringAlertHistory (..),
    newListMonitoringAlertHistory,

    -- * Request Lenses
    listMonitoringAlertHistory_creationTimeAfter,
    listMonitoringAlertHistory_creationTimeBefore,
    listMonitoringAlertHistory_maxResults,
    listMonitoringAlertHistory_monitoringAlertName,
    listMonitoringAlertHistory_monitoringScheduleName,
    listMonitoringAlertHistory_nextToken,
    listMonitoringAlertHistory_sortBy,
    listMonitoringAlertHistory_sortOrder,
    listMonitoringAlertHistory_statusEquals,

    -- * Destructuring the Response
    ListMonitoringAlertHistoryResponse (..),
    newListMonitoringAlertHistoryResponse,

    -- * Response Lenses
    listMonitoringAlertHistoryResponse_monitoringAlertHistory,
    listMonitoringAlertHistoryResponse_nextToken,
    listMonitoringAlertHistoryResponse_httpStatus,
  )
where

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
import Amazonka.SageMaker.Types

-- | /See:/ 'newListMonitoringAlertHistory' smart constructor.
data ListMonitoringAlertHistory = ListMonitoringAlertHistory'
  { -- | A filter that returns only alerts created on or after the specified
    -- time.
    ListMonitoringAlertHistory -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns only alerts created on or before the specified
    -- time.
    ListMonitoringAlertHistory -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Data.POSIX,
    -- | The maximum number of results to display. The default is 100.
    ListMonitoringAlertHistory -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of a monitoring alert.
    ListMonitoringAlertHistory -> Maybe Text
monitoringAlertName :: Prelude.Maybe Prelude.Text,
    -- | The name of a monitoring schedule.
    ListMonitoringAlertHistory -> Maybe Text
monitoringScheduleName :: Prelude.Maybe Prelude.Text,
    -- | If the result of the previous @ListMonitoringAlertHistory@ request was
    -- truncated, the response includes a @NextToken@. To retrieve the next set
    -- of alerts in the history, use the token in the next request.
    ListMonitoringAlertHistory -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The field used to sort results. The default is @CreationTime@.
    ListMonitoringAlertHistory -> Maybe MonitoringAlertHistorySortKey
sortBy :: Prelude.Maybe MonitoringAlertHistorySortKey,
    -- | The sort order, whether @Ascending@ or @Descending@, of the alert
    -- history. The default is @Descending@.
    ListMonitoringAlertHistory -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | A filter that retrieves only alerts with a specific status.
    ListMonitoringAlertHistory -> Maybe MonitoringAlertStatus
statusEquals :: Prelude.Maybe MonitoringAlertStatus
  }
  deriving (ListMonitoringAlertHistory -> ListMonitoringAlertHistory -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMonitoringAlertHistory -> ListMonitoringAlertHistory -> Bool
$c/= :: ListMonitoringAlertHistory -> ListMonitoringAlertHistory -> Bool
== :: ListMonitoringAlertHistory -> ListMonitoringAlertHistory -> Bool
$c== :: ListMonitoringAlertHistory -> ListMonitoringAlertHistory -> Bool
Prelude.Eq, ReadPrec [ListMonitoringAlertHistory]
ReadPrec ListMonitoringAlertHistory
Int -> ReadS ListMonitoringAlertHistory
ReadS [ListMonitoringAlertHistory]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMonitoringAlertHistory]
$creadListPrec :: ReadPrec [ListMonitoringAlertHistory]
readPrec :: ReadPrec ListMonitoringAlertHistory
$creadPrec :: ReadPrec ListMonitoringAlertHistory
readList :: ReadS [ListMonitoringAlertHistory]
$creadList :: ReadS [ListMonitoringAlertHistory]
readsPrec :: Int -> ReadS ListMonitoringAlertHistory
$creadsPrec :: Int -> ReadS ListMonitoringAlertHistory
Prelude.Read, Int -> ListMonitoringAlertHistory -> ShowS
[ListMonitoringAlertHistory] -> ShowS
ListMonitoringAlertHistory -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMonitoringAlertHistory] -> ShowS
$cshowList :: [ListMonitoringAlertHistory] -> ShowS
show :: ListMonitoringAlertHistory -> String
$cshow :: ListMonitoringAlertHistory -> String
showsPrec :: Int -> ListMonitoringAlertHistory -> ShowS
$cshowsPrec :: Int -> ListMonitoringAlertHistory -> ShowS
Prelude.Show, forall x.
Rep ListMonitoringAlertHistory x -> ListMonitoringAlertHistory
forall x.
ListMonitoringAlertHistory -> Rep ListMonitoringAlertHistory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListMonitoringAlertHistory x -> ListMonitoringAlertHistory
$cfrom :: forall x.
ListMonitoringAlertHistory -> Rep ListMonitoringAlertHistory x
Prelude.Generic)

-- |
-- Create a value of 'ListMonitoringAlertHistory' 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:
--
-- 'creationTimeAfter', 'listMonitoringAlertHistory_creationTimeAfter' - A filter that returns only alerts created on or after the specified
-- time.
--
-- 'creationTimeBefore', 'listMonitoringAlertHistory_creationTimeBefore' - A filter that returns only alerts created on or before the specified
-- time.
--
-- 'maxResults', 'listMonitoringAlertHistory_maxResults' - The maximum number of results to display. The default is 100.
--
-- 'monitoringAlertName', 'listMonitoringAlertHistory_monitoringAlertName' - The name of a monitoring alert.
--
-- 'monitoringScheduleName', 'listMonitoringAlertHistory_monitoringScheduleName' - The name of a monitoring schedule.
--
-- 'nextToken', 'listMonitoringAlertHistory_nextToken' - If the result of the previous @ListMonitoringAlertHistory@ request was
-- truncated, the response includes a @NextToken@. To retrieve the next set
-- of alerts in the history, use the token in the next request.
--
-- 'sortBy', 'listMonitoringAlertHistory_sortBy' - The field used to sort results. The default is @CreationTime@.
--
-- 'sortOrder', 'listMonitoringAlertHistory_sortOrder' - The sort order, whether @Ascending@ or @Descending@, of the alert
-- history. The default is @Descending@.
--
-- 'statusEquals', 'listMonitoringAlertHistory_statusEquals' - A filter that retrieves only alerts with a specific status.
newListMonitoringAlertHistory ::
  ListMonitoringAlertHistory
newListMonitoringAlertHistory :: ListMonitoringAlertHistory
newListMonitoringAlertHistory =
  ListMonitoringAlertHistory'
    { $sel:creationTimeAfter:ListMonitoringAlertHistory' :: Maybe POSIX
creationTimeAfter =
        forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListMonitoringAlertHistory' :: Maybe POSIX
creationTimeBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListMonitoringAlertHistory' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:monitoringAlertName:ListMonitoringAlertHistory' :: Maybe Text
monitoringAlertName = forall a. Maybe a
Prelude.Nothing,
      $sel:monitoringScheduleName:ListMonitoringAlertHistory' :: Maybe Text
monitoringScheduleName = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListMonitoringAlertHistory' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListMonitoringAlertHistory' :: Maybe MonitoringAlertHistorySortKey
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListMonitoringAlertHistory' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:statusEquals:ListMonitoringAlertHistory' :: Maybe MonitoringAlertStatus
statusEquals = forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns only alerts created on or after the specified
-- time.
listMonitoringAlertHistory_creationTimeAfter :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe Prelude.UTCTime)
listMonitoringAlertHistory_creationTimeAfter :: Lens' ListMonitoringAlertHistory (Maybe UTCTime)
listMonitoringAlertHistory_creationTimeAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe POSIX
a -> ListMonitoringAlertHistory
s {$sel:creationTimeAfter:ListMonitoringAlertHistory' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListMonitoringAlertHistory) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A filter that returns only alerts created on or before the specified
-- time.
listMonitoringAlertHistory_creationTimeBefore :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe Prelude.UTCTime)
listMonitoringAlertHistory_creationTimeBefore :: Lens' ListMonitoringAlertHistory (Maybe UTCTime)
listMonitoringAlertHistory_creationTimeBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe POSIX
a -> ListMonitoringAlertHistory
s {$sel:creationTimeBefore:ListMonitoringAlertHistory' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListMonitoringAlertHistory) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The maximum number of results to display. The default is 100.
listMonitoringAlertHistory_maxResults :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe Prelude.Natural)
listMonitoringAlertHistory_maxResults :: Lens' ListMonitoringAlertHistory (Maybe Natural)
listMonitoringAlertHistory_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe Natural
a -> ListMonitoringAlertHistory
s {$sel:maxResults:ListMonitoringAlertHistory' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMonitoringAlertHistory)

-- | The name of a monitoring alert.
listMonitoringAlertHistory_monitoringAlertName :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe Prelude.Text)
listMonitoringAlertHistory_monitoringAlertName :: Lens' ListMonitoringAlertHistory (Maybe Text)
listMonitoringAlertHistory_monitoringAlertName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe Text
monitoringAlertName :: Maybe Text
$sel:monitoringAlertName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
monitoringAlertName} -> Maybe Text
monitoringAlertName) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe Text
a -> ListMonitoringAlertHistory
s {$sel:monitoringAlertName:ListMonitoringAlertHistory' :: Maybe Text
monitoringAlertName = Maybe Text
a} :: ListMonitoringAlertHistory)

-- | The name of a monitoring schedule.
listMonitoringAlertHistory_monitoringScheduleName :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe Prelude.Text)
listMonitoringAlertHistory_monitoringScheduleName :: Lens' ListMonitoringAlertHistory (Maybe Text)
listMonitoringAlertHistory_monitoringScheduleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe Text
monitoringScheduleName :: Maybe Text
$sel:monitoringScheduleName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
monitoringScheduleName} -> Maybe Text
monitoringScheduleName) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe Text
a -> ListMonitoringAlertHistory
s {$sel:monitoringScheduleName:ListMonitoringAlertHistory' :: Maybe Text
monitoringScheduleName = Maybe Text
a} :: ListMonitoringAlertHistory)

-- | If the result of the previous @ListMonitoringAlertHistory@ request was
-- truncated, the response includes a @NextToken@. To retrieve the next set
-- of alerts in the history, use the token in the next request.
listMonitoringAlertHistory_nextToken :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe Prelude.Text)
listMonitoringAlertHistory_nextToken :: Lens' ListMonitoringAlertHistory (Maybe Text)
listMonitoringAlertHistory_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe Text
a -> ListMonitoringAlertHistory
s {$sel:nextToken:ListMonitoringAlertHistory' :: Maybe Text
nextToken = Maybe Text
a} :: ListMonitoringAlertHistory)

-- | The field used to sort results. The default is @CreationTime@.
listMonitoringAlertHistory_sortBy :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe MonitoringAlertHistorySortKey)
listMonitoringAlertHistory_sortBy :: Lens'
  ListMonitoringAlertHistory (Maybe MonitoringAlertHistorySortKey)
listMonitoringAlertHistory_sortBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe MonitoringAlertHistorySortKey
sortBy :: Maybe MonitoringAlertHistorySortKey
$sel:sortBy:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertHistorySortKey
sortBy} -> Maybe MonitoringAlertHistorySortKey
sortBy) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe MonitoringAlertHistorySortKey
a -> ListMonitoringAlertHistory
s {$sel:sortBy:ListMonitoringAlertHistory' :: Maybe MonitoringAlertHistorySortKey
sortBy = Maybe MonitoringAlertHistorySortKey
a} :: ListMonitoringAlertHistory)

-- | The sort order, whether @Ascending@ or @Descending@, of the alert
-- history. The default is @Descending@.
listMonitoringAlertHistory_sortOrder :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe SortOrder)
listMonitoringAlertHistory_sortOrder :: Lens' ListMonitoringAlertHistory (Maybe SortOrder)
listMonitoringAlertHistory_sortOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe SortOrder
a -> ListMonitoringAlertHistory
s {$sel:sortOrder:ListMonitoringAlertHistory' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListMonitoringAlertHistory)

-- | A filter that retrieves only alerts with a specific status.
listMonitoringAlertHistory_statusEquals :: Lens.Lens' ListMonitoringAlertHistory (Prelude.Maybe MonitoringAlertStatus)
listMonitoringAlertHistory_statusEquals :: Lens' ListMonitoringAlertHistory (Maybe MonitoringAlertStatus)
listMonitoringAlertHistory_statusEquals = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistory' {Maybe MonitoringAlertStatus
statusEquals :: Maybe MonitoringAlertStatus
$sel:statusEquals:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertStatus
statusEquals} -> Maybe MonitoringAlertStatus
statusEquals) (\s :: ListMonitoringAlertHistory
s@ListMonitoringAlertHistory' {} Maybe MonitoringAlertStatus
a -> ListMonitoringAlertHistory
s {$sel:statusEquals:ListMonitoringAlertHistory' :: Maybe MonitoringAlertStatus
statusEquals = Maybe MonitoringAlertStatus
a} :: ListMonitoringAlertHistory)

instance Core.AWSPager ListMonitoringAlertHistory where
  page :: ListMonitoringAlertHistory
-> AWSResponse ListMonitoringAlertHistory
-> Maybe ListMonitoringAlertHistory
page ListMonitoringAlertHistory
rq AWSResponse ListMonitoringAlertHistory
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListMonitoringAlertHistory
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMonitoringAlertHistoryResponse (Maybe Text)
listMonitoringAlertHistoryResponse_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 ListMonitoringAlertHistory
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  ListMonitoringAlertHistoryResponse
  (Maybe [MonitoringAlertHistorySummary])
listMonitoringAlertHistoryResponse_monitoringAlertHistory
            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.$ ListMonitoringAlertHistory
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListMonitoringAlertHistory (Maybe Text)
listMonitoringAlertHistory_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListMonitoringAlertHistory
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListMonitoringAlertHistoryResponse (Maybe Text)
listMonitoringAlertHistoryResponse_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 ListMonitoringAlertHistory where
  type
    AWSResponse ListMonitoringAlertHistory =
      ListMonitoringAlertHistoryResponse
  request :: (Service -> Service)
-> ListMonitoringAlertHistory -> Request ListMonitoringAlertHistory
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 ListMonitoringAlertHistory
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListMonitoringAlertHistory)))
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 [MonitoringAlertHistorySummary]
-> Maybe Text -> Int -> ListMonitoringAlertHistoryResponse
ListMonitoringAlertHistoryResponse'
            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
"MonitoringAlertHistory"
                            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
"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 ListMonitoringAlertHistory where
  hashWithSalt :: Int -> ListMonitoringAlertHistory -> Int
hashWithSalt Int
_salt ListMonitoringAlertHistory' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe MonitoringAlertHistorySortKey
Maybe MonitoringAlertStatus
Maybe SortOrder
statusEquals :: Maybe MonitoringAlertStatus
sortOrder :: Maybe SortOrder
sortBy :: Maybe MonitoringAlertHistorySortKey
nextToken :: Maybe Text
monitoringScheduleName :: Maybe Text
monitoringAlertName :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:statusEquals:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertStatus
$sel:sortOrder:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe SortOrder
$sel:sortBy:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertHistorySortKey
$sel:nextToken:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:monitoringScheduleName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:monitoringAlertName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:maxResults:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Natural
$sel:creationTimeBefore:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
$sel:creationTimeAfter:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimeAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimeBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
monitoringAlertName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
monitoringScheduleName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MonitoringAlertHistorySortKey
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MonitoringAlertStatus
statusEquals

instance Prelude.NFData ListMonitoringAlertHistory where
  rnf :: ListMonitoringAlertHistory -> ()
rnf ListMonitoringAlertHistory' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe MonitoringAlertHistorySortKey
Maybe MonitoringAlertStatus
Maybe SortOrder
statusEquals :: Maybe MonitoringAlertStatus
sortOrder :: Maybe SortOrder
sortBy :: Maybe MonitoringAlertHistorySortKey
nextToken :: Maybe Text
monitoringScheduleName :: Maybe Text
monitoringAlertName :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:statusEquals:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertStatus
$sel:sortOrder:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe SortOrder
$sel:sortBy:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertHistorySortKey
$sel:nextToken:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:monitoringScheduleName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:monitoringAlertName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:maxResults:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Natural
$sel:creationTimeBefore:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
$sel:creationTimeAfter:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimeAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimeBefore
      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
monitoringAlertName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
monitoringScheduleName
      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 MonitoringAlertHistorySortKey
sortBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sortOrder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MonitoringAlertStatus
statusEquals

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

instance Data.ToJSON ListMonitoringAlertHistory where
  toJSON :: ListMonitoringAlertHistory -> Value
toJSON ListMonitoringAlertHistory' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe MonitoringAlertHistorySortKey
Maybe MonitoringAlertStatus
Maybe SortOrder
statusEquals :: Maybe MonitoringAlertStatus
sortOrder :: Maybe SortOrder
sortBy :: Maybe MonitoringAlertHistorySortKey
nextToken :: Maybe Text
monitoringScheduleName :: Maybe Text
monitoringAlertName :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:statusEquals:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertStatus
$sel:sortOrder:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe SortOrder
$sel:sortBy:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe MonitoringAlertHistorySortKey
$sel:nextToken:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:monitoringScheduleName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:monitoringAlertName:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Text
$sel:maxResults:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe Natural
$sel:creationTimeBefore:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
$sel:creationTimeAfter:ListMonitoringAlertHistory' :: ListMonitoringAlertHistory -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CreationTimeAfter" 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 POSIX
creationTimeAfter,
            (Key
"CreationTimeBefore" 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 POSIX
creationTimeBefore,
            (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
"MonitoringAlertName" 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
monitoringAlertName,
            (Key
"MonitoringScheduleName" 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
monitoringScheduleName,
            (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
"SortBy" 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 MonitoringAlertHistorySortKey
sortBy,
            (Key
"SortOrder" 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 SortOrder
sortOrder,
            (Key
"StatusEquals" 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 MonitoringAlertStatus
statusEquals
          ]
      )

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

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

-- | /See:/ 'newListMonitoringAlertHistoryResponse' smart constructor.
data ListMonitoringAlertHistoryResponse = ListMonitoringAlertHistoryResponse'
  { -- | An alert history for a model monitoring schedule.
    ListMonitoringAlertHistoryResponse
-> Maybe [MonitoringAlertHistorySummary]
monitoringAlertHistory :: Prelude.Maybe [MonitoringAlertHistorySummary],
    -- | If the response is truncated, SageMaker returns this token. To retrieve
    -- the next set of alerts, use it in the subsequent request.
    ListMonitoringAlertHistoryResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListMonitoringAlertHistoryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListMonitoringAlertHistoryResponse
-> ListMonitoringAlertHistoryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMonitoringAlertHistoryResponse
-> ListMonitoringAlertHistoryResponse -> Bool
$c/= :: ListMonitoringAlertHistoryResponse
-> ListMonitoringAlertHistoryResponse -> Bool
== :: ListMonitoringAlertHistoryResponse
-> ListMonitoringAlertHistoryResponse -> Bool
$c== :: ListMonitoringAlertHistoryResponse
-> ListMonitoringAlertHistoryResponse -> Bool
Prelude.Eq, ReadPrec [ListMonitoringAlertHistoryResponse]
ReadPrec ListMonitoringAlertHistoryResponse
Int -> ReadS ListMonitoringAlertHistoryResponse
ReadS [ListMonitoringAlertHistoryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMonitoringAlertHistoryResponse]
$creadListPrec :: ReadPrec [ListMonitoringAlertHistoryResponse]
readPrec :: ReadPrec ListMonitoringAlertHistoryResponse
$creadPrec :: ReadPrec ListMonitoringAlertHistoryResponse
readList :: ReadS [ListMonitoringAlertHistoryResponse]
$creadList :: ReadS [ListMonitoringAlertHistoryResponse]
readsPrec :: Int -> ReadS ListMonitoringAlertHistoryResponse
$creadsPrec :: Int -> ReadS ListMonitoringAlertHistoryResponse
Prelude.Read, Int -> ListMonitoringAlertHistoryResponse -> ShowS
[ListMonitoringAlertHistoryResponse] -> ShowS
ListMonitoringAlertHistoryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMonitoringAlertHistoryResponse] -> ShowS
$cshowList :: [ListMonitoringAlertHistoryResponse] -> ShowS
show :: ListMonitoringAlertHistoryResponse -> String
$cshow :: ListMonitoringAlertHistoryResponse -> String
showsPrec :: Int -> ListMonitoringAlertHistoryResponse -> ShowS
$cshowsPrec :: Int -> ListMonitoringAlertHistoryResponse -> ShowS
Prelude.Show, forall x.
Rep ListMonitoringAlertHistoryResponse x
-> ListMonitoringAlertHistoryResponse
forall x.
ListMonitoringAlertHistoryResponse
-> Rep ListMonitoringAlertHistoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListMonitoringAlertHistoryResponse x
-> ListMonitoringAlertHistoryResponse
$cfrom :: forall x.
ListMonitoringAlertHistoryResponse
-> Rep ListMonitoringAlertHistoryResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListMonitoringAlertHistoryResponse' 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:
--
-- 'monitoringAlertHistory', 'listMonitoringAlertHistoryResponse_monitoringAlertHistory' - An alert history for a model monitoring schedule.
--
-- 'nextToken', 'listMonitoringAlertHistoryResponse_nextToken' - If the response is truncated, SageMaker returns this token. To retrieve
-- the next set of alerts, use it in the subsequent request.
--
-- 'httpStatus', 'listMonitoringAlertHistoryResponse_httpStatus' - The response's http status code.
newListMonitoringAlertHistoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListMonitoringAlertHistoryResponse
newListMonitoringAlertHistoryResponse :: Int -> ListMonitoringAlertHistoryResponse
newListMonitoringAlertHistoryResponse Int
pHttpStatus_ =
  ListMonitoringAlertHistoryResponse'
    { $sel:monitoringAlertHistory:ListMonitoringAlertHistoryResponse' :: Maybe [MonitoringAlertHistorySummary]
monitoringAlertHistory =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListMonitoringAlertHistoryResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListMonitoringAlertHistoryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An alert history for a model monitoring schedule.
listMonitoringAlertHistoryResponse_monitoringAlertHistory :: Lens.Lens' ListMonitoringAlertHistoryResponse (Prelude.Maybe [MonitoringAlertHistorySummary])
listMonitoringAlertHistoryResponse_monitoringAlertHistory :: Lens'
  ListMonitoringAlertHistoryResponse
  (Maybe [MonitoringAlertHistorySummary])
listMonitoringAlertHistoryResponse_monitoringAlertHistory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistoryResponse' {Maybe [MonitoringAlertHistorySummary]
monitoringAlertHistory :: Maybe [MonitoringAlertHistorySummary]
$sel:monitoringAlertHistory:ListMonitoringAlertHistoryResponse' :: ListMonitoringAlertHistoryResponse
-> Maybe [MonitoringAlertHistorySummary]
monitoringAlertHistory} -> Maybe [MonitoringAlertHistorySummary]
monitoringAlertHistory) (\s :: ListMonitoringAlertHistoryResponse
s@ListMonitoringAlertHistoryResponse' {} Maybe [MonitoringAlertHistorySummary]
a -> ListMonitoringAlertHistoryResponse
s {$sel:monitoringAlertHistory:ListMonitoringAlertHistoryResponse' :: Maybe [MonitoringAlertHistorySummary]
monitoringAlertHistory = Maybe [MonitoringAlertHistorySummary]
a} :: ListMonitoringAlertHistoryResponse) 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

-- | If the response is truncated, SageMaker returns this token. To retrieve
-- the next set of alerts, use it in the subsequent request.
listMonitoringAlertHistoryResponse_nextToken :: Lens.Lens' ListMonitoringAlertHistoryResponse (Prelude.Maybe Prelude.Text)
listMonitoringAlertHistoryResponse_nextToken :: Lens' ListMonitoringAlertHistoryResponse (Maybe Text)
listMonitoringAlertHistoryResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMonitoringAlertHistoryResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMonitoringAlertHistoryResponse' :: ListMonitoringAlertHistoryResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMonitoringAlertHistoryResponse
s@ListMonitoringAlertHistoryResponse' {} Maybe Text
a -> ListMonitoringAlertHistoryResponse
s {$sel:nextToken:ListMonitoringAlertHistoryResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMonitoringAlertHistoryResponse)

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

instance
  Prelude.NFData
    ListMonitoringAlertHistoryResponse
  where
  rnf :: ListMonitoringAlertHistoryResponse -> ()
rnf ListMonitoringAlertHistoryResponse' {Int
Maybe [MonitoringAlertHistorySummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
monitoringAlertHistory :: Maybe [MonitoringAlertHistorySummary]
$sel:httpStatus:ListMonitoringAlertHistoryResponse' :: ListMonitoringAlertHistoryResponse -> Int
$sel:nextToken:ListMonitoringAlertHistoryResponse' :: ListMonitoringAlertHistoryResponse -> Maybe Text
$sel:monitoringAlertHistory:ListMonitoringAlertHistoryResponse' :: ListMonitoringAlertHistoryResponse
-> Maybe [MonitoringAlertHistorySummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [MonitoringAlertHistorySummary]
monitoringAlertHistory
      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