{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.MonitoringAlertHistorySummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.MonitoringAlertHistorySummary 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 Amazonka.SageMaker.Types.MonitoringAlertStatus

-- | Provides summary information of an alert\'s history.
--
-- /See:/ 'newMonitoringAlertHistorySummary' smart constructor.
data MonitoringAlertHistorySummary = MonitoringAlertHistorySummary'
  { -- | The name of a monitoring schedule.
    MonitoringAlertHistorySummary -> Text
monitoringScheduleName :: Prelude.Text,
    -- | The name of a monitoring alert.
    MonitoringAlertHistorySummary -> Text
monitoringAlertName :: Prelude.Text,
    -- | A timestamp that indicates when the first alert transition occurred in
    -- an alert history. An alert transition can be from status @InAlert@ to
    -- @OK@, or from @OK@ to @InAlert@.
    MonitoringAlertHistorySummary -> POSIX
creationTime :: Data.POSIX,
    -- | The current alert status of an alert.
    MonitoringAlertHistorySummary -> MonitoringAlertStatus
alertStatus :: MonitoringAlertStatus
  }
  deriving (MonitoringAlertHistorySummary
-> MonitoringAlertHistorySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringAlertHistorySummary
-> MonitoringAlertHistorySummary -> Bool
$c/= :: MonitoringAlertHistorySummary
-> MonitoringAlertHistorySummary -> Bool
== :: MonitoringAlertHistorySummary
-> MonitoringAlertHistorySummary -> Bool
$c== :: MonitoringAlertHistorySummary
-> MonitoringAlertHistorySummary -> Bool
Prelude.Eq, ReadPrec [MonitoringAlertHistorySummary]
ReadPrec MonitoringAlertHistorySummary
Int -> ReadS MonitoringAlertHistorySummary
ReadS [MonitoringAlertHistorySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringAlertHistorySummary]
$creadListPrec :: ReadPrec [MonitoringAlertHistorySummary]
readPrec :: ReadPrec MonitoringAlertHistorySummary
$creadPrec :: ReadPrec MonitoringAlertHistorySummary
readList :: ReadS [MonitoringAlertHistorySummary]
$creadList :: ReadS [MonitoringAlertHistorySummary]
readsPrec :: Int -> ReadS MonitoringAlertHistorySummary
$creadsPrec :: Int -> ReadS MonitoringAlertHistorySummary
Prelude.Read, Int -> MonitoringAlertHistorySummary -> ShowS
[MonitoringAlertHistorySummary] -> ShowS
MonitoringAlertHistorySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringAlertHistorySummary] -> ShowS
$cshowList :: [MonitoringAlertHistorySummary] -> ShowS
show :: MonitoringAlertHistorySummary -> String
$cshow :: MonitoringAlertHistorySummary -> String
showsPrec :: Int -> MonitoringAlertHistorySummary -> ShowS
$cshowsPrec :: Int -> MonitoringAlertHistorySummary -> ShowS
Prelude.Show, forall x.
Rep MonitoringAlertHistorySummary x
-> MonitoringAlertHistorySummary
forall x.
MonitoringAlertHistorySummary
-> Rep MonitoringAlertHistorySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MonitoringAlertHistorySummary x
-> MonitoringAlertHistorySummary
$cfrom :: forall x.
MonitoringAlertHistorySummary
-> Rep MonitoringAlertHistorySummary x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringAlertHistorySummary' 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:
--
-- 'monitoringScheduleName', 'monitoringAlertHistorySummary_monitoringScheduleName' - The name of a monitoring schedule.
--
-- 'monitoringAlertName', 'monitoringAlertHistorySummary_monitoringAlertName' - The name of a monitoring alert.
--
-- 'creationTime', 'monitoringAlertHistorySummary_creationTime' - A timestamp that indicates when the first alert transition occurred in
-- an alert history. An alert transition can be from status @InAlert@ to
-- @OK@, or from @OK@ to @InAlert@.
--
-- 'alertStatus', 'monitoringAlertHistorySummary_alertStatus' - The current alert status of an alert.
newMonitoringAlertHistorySummary ::
  -- | 'monitoringScheduleName'
  Prelude.Text ->
  -- | 'monitoringAlertName'
  Prelude.Text ->
  -- | 'creationTime'
  Prelude.UTCTime ->
  -- | 'alertStatus'
  MonitoringAlertStatus ->
  MonitoringAlertHistorySummary
newMonitoringAlertHistorySummary :: Text
-> Text
-> UTCTime
-> MonitoringAlertStatus
-> MonitoringAlertHistorySummary
newMonitoringAlertHistorySummary
  Text
pMonitoringScheduleName_
  Text
pMonitoringAlertName_
  UTCTime
pCreationTime_
  MonitoringAlertStatus
pAlertStatus_ =
    MonitoringAlertHistorySummary'
      { $sel:monitoringScheduleName:MonitoringAlertHistorySummary' :: Text
monitoringScheduleName =
          Text
pMonitoringScheduleName_,
        $sel:monitoringAlertName:MonitoringAlertHistorySummary' :: Text
monitoringAlertName = Text
pMonitoringAlertName_,
        $sel:creationTime:MonitoringAlertHistorySummary' :: POSIX
creationTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_,
        $sel:alertStatus:MonitoringAlertHistorySummary' :: MonitoringAlertStatus
alertStatus = MonitoringAlertStatus
pAlertStatus_
      }

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

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

-- | A timestamp that indicates when the first alert transition occurred in
-- an alert history. An alert transition can be from status @InAlert@ to
-- @OK@, or from @OK@ to @InAlert@.
monitoringAlertHistorySummary_creationTime :: Lens.Lens' MonitoringAlertHistorySummary Prelude.UTCTime
monitoringAlertHistorySummary_creationTime :: Lens' MonitoringAlertHistorySummary UTCTime
monitoringAlertHistorySummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringAlertHistorySummary' {POSIX
creationTime :: POSIX
$sel:creationTime:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> POSIX
creationTime} -> POSIX
creationTime) (\s :: MonitoringAlertHistorySummary
s@MonitoringAlertHistorySummary' {} POSIX
a -> MonitoringAlertHistorySummary
s {$sel:creationTime:MonitoringAlertHistorySummary' :: POSIX
creationTime = POSIX
a} :: MonitoringAlertHistorySummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The current alert status of an alert.
monitoringAlertHistorySummary_alertStatus :: Lens.Lens' MonitoringAlertHistorySummary MonitoringAlertStatus
monitoringAlertHistorySummary_alertStatus :: Lens' MonitoringAlertHistorySummary MonitoringAlertStatus
monitoringAlertHistorySummary_alertStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringAlertHistorySummary' {MonitoringAlertStatus
alertStatus :: MonitoringAlertStatus
$sel:alertStatus:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> MonitoringAlertStatus
alertStatus} -> MonitoringAlertStatus
alertStatus) (\s :: MonitoringAlertHistorySummary
s@MonitoringAlertHistorySummary' {} MonitoringAlertStatus
a -> MonitoringAlertHistorySummary
s {$sel:alertStatus:MonitoringAlertHistorySummary' :: MonitoringAlertStatus
alertStatus = MonitoringAlertStatus
a} :: MonitoringAlertHistorySummary)

instance Data.FromJSON MonitoringAlertHistorySummary where
  parseJSON :: Value -> Parser MonitoringAlertHistorySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MonitoringAlertHistorySummary"
      ( \Object
x ->
          Text
-> Text
-> POSIX
-> MonitoringAlertStatus
-> MonitoringAlertHistorySummary
MonitoringAlertHistorySummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"MonitoringScheduleName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"MonitoringAlertName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CreationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AlertStatus")
      )

instance
  Prelude.Hashable
    MonitoringAlertHistorySummary
  where
  hashWithSalt :: Int -> MonitoringAlertHistorySummary -> Int
hashWithSalt Int
_salt MonitoringAlertHistorySummary' {Text
POSIX
MonitoringAlertStatus
alertStatus :: MonitoringAlertStatus
creationTime :: POSIX
monitoringAlertName :: Text
monitoringScheduleName :: Text
$sel:alertStatus:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> MonitoringAlertStatus
$sel:creationTime:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> POSIX
$sel:monitoringAlertName:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> Text
$sel:monitoringScheduleName:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
monitoringScheduleName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
monitoringAlertName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MonitoringAlertStatus
alertStatus

instance Prelude.NFData MonitoringAlertHistorySummary where
  rnf :: MonitoringAlertHistorySummary -> ()
rnf MonitoringAlertHistorySummary' {Text
POSIX
MonitoringAlertStatus
alertStatus :: MonitoringAlertStatus
creationTime :: POSIX
monitoringAlertName :: Text
monitoringScheduleName :: Text
$sel:alertStatus:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> MonitoringAlertStatus
$sel:creationTime:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> POSIX
$sel:monitoringAlertName:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> Text
$sel:monitoringScheduleName:MonitoringAlertHistorySummary' :: MonitoringAlertHistorySummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
monitoringScheduleName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
monitoringAlertName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MonitoringAlertStatus
alertStatus