{-# 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 #-}
module Amazonka.LookoutMetrics.Types.Alert where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutMetrics.Types.Action
import Amazonka.LookoutMetrics.Types.AlertStatus
import Amazonka.LookoutMetrics.Types.AlertType
import qualified Amazonka.Prelude as Prelude
data Alert = Alert'
{
Alert -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
Alert -> Maybe Action
action :: Prelude.Maybe Action,
Alert -> Maybe Text
anomalyDetectorArn :: Prelude.Maybe Prelude.Text,
Alert -> Maybe Text
alertName :: Prelude.Maybe Prelude.Text,
Alert -> Maybe Natural
alertSensitivityThreshold :: Prelude.Maybe Prelude.Natural,
Alert -> Maybe AlertStatus
alertStatus :: Prelude.Maybe AlertStatus,
Alert -> Maybe Text
alertDescription :: Prelude.Maybe Prelude.Text,
Alert -> Maybe Text
alertArn :: Prelude.Maybe Prelude.Text,
Alert -> Maybe AlertType
alertType :: Prelude.Maybe AlertType,
Alert -> Maybe POSIX
lastModificationTime :: Prelude.Maybe Core.POSIX
}
deriving (Alert -> Alert -> Bool
(Alert -> Alert -> Bool) -> (Alert -> Alert -> Bool) -> Eq Alert
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Alert -> Alert -> Bool
$c/= :: Alert -> Alert -> Bool
== :: Alert -> Alert -> Bool
$c== :: Alert -> Alert -> Bool
Prelude.Eq, ReadPrec [Alert]
ReadPrec Alert
Int -> ReadS Alert
ReadS [Alert]
(Int -> ReadS Alert)
-> ReadS [Alert]
-> ReadPrec Alert
-> ReadPrec [Alert]
-> Read Alert
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Alert]
$creadListPrec :: ReadPrec [Alert]
readPrec :: ReadPrec Alert
$creadPrec :: ReadPrec Alert
readList :: ReadS [Alert]
$creadList :: ReadS [Alert]
readsPrec :: Int -> ReadS Alert
$creadsPrec :: Int -> ReadS Alert
Prelude.Read, Int -> Alert -> ShowS
[Alert] -> ShowS
Alert -> String
(Int -> Alert -> ShowS)
-> (Alert -> String) -> ([Alert] -> ShowS) -> Show Alert
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Alert] -> ShowS
$cshowList :: [Alert] -> ShowS
show :: Alert -> String
$cshow :: Alert -> String
showsPrec :: Int -> Alert -> ShowS
$cshowsPrec :: Int -> Alert -> ShowS
Prelude.Show, (forall x. Alert -> Rep Alert x)
-> (forall x. Rep Alert x -> Alert) -> Generic Alert
forall x. Rep Alert x -> Alert
forall x. Alert -> Rep Alert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Alert x -> Alert
$cfrom :: forall x. Alert -> Rep Alert x
Prelude.Generic)
newAlert ::
Alert
newAlert :: Alert
newAlert =
Alert' :: Maybe POSIX
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert
Alert'
{ $sel:creationTime:Alert' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:action:Alert' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
$sel:anomalyDetectorArn:Alert' :: Maybe Text
anomalyDetectorArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alertName:Alert' :: Maybe Text
alertName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alertSensitivityThreshold:Alert' :: Maybe Natural
alertSensitivityThreshold = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:alertStatus:Alert' :: Maybe AlertStatus
alertStatus = Maybe AlertStatus
forall a. Maybe a
Prelude.Nothing,
$sel:alertDescription:Alert' :: Maybe Text
alertDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alertArn:Alert' :: Maybe Text
alertArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alertType:Alert' :: Maybe AlertType
alertType = Maybe AlertType
forall a. Maybe a
Prelude.Nothing,
$sel:lastModificationTime:Alert' :: Maybe POSIX
lastModificationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
alert_creationTime :: Lens.Lens' Alert (Prelude.Maybe Prelude.UTCTime)
alert_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Alert -> f Alert
alert_creationTime = (Alert -> Maybe POSIX)
-> (Alert -> Maybe POSIX -> Alert)
-> Lens Alert Alert (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Alert' :: Alert -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Alert
s@Alert' {} Maybe POSIX
a -> Alert
s {$sel:creationTime:Alert' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Alert) ((Maybe POSIX -> f (Maybe POSIX)) -> Alert -> f Alert)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Alert
-> f Alert
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
alert_action :: Lens.Lens' Alert (Prelude.Maybe Action)
alert_action :: (Maybe Action -> f (Maybe Action)) -> Alert -> f Alert
alert_action = (Alert -> Maybe Action)
-> (Alert -> Maybe Action -> Alert)
-> Lens Alert Alert (Maybe Action) (Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe Action
action :: Maybe Action
$sel:action:Alert' :: Alert -> Maybe Action
action} -> Maybe Action
action) (\s :: Alert
s@Alert' {} Maybe Action
a -> Alert
s {$sel:action:Alert' :: Maybe Action
action = Maybe Action
a} :: Alert)
alert_anomalyDetectorArn :: Lens.Lens' Alert (Prelude.Maybe Prelude.Text)
alert_anomalyDetectorArn :: (Maybe Text -> f (Maybe Text)) -> Alert -> f Alert
alert_anomalyDetectorArn = (Alert -> Maybe Text)
-> (Alert -> Maybe Text -> Alert)
-> Lens Alert Alert (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:anomalyDetectorArn:Alert' :: Alert -> Maybe Text
anomalyDetectorArn} -> Maybe Text
anomalyDetectorArn) (\s :: Alert
s@Alert' {} Maybe Text
a -> Alert
s {$sel:anomalyDetectorArn:Alert' :: Maybe Text
anomalyDetectorArn = Maybe Text
a} :: Alert)
alert_alertName :: Lens.Lens' Alert (Prelude.Maybe Prelude.Text)
alert_alertName :: (Maybe Text -> f (Maybe Text)) -> Alert -> f Alert
alert_alertName = (Alert -> Maybe Text)
-> (Alert -> Maybe Text -> Alert)
-> Lens Alert Alert (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe Text
alertName :: Maybe Text
$sel:alertName:Alert' :: Alert -> Maybe Text
alertName} -> Maybe Text
alertName) (\s :: Alert
s@Alert' {} Maybe Text
a -> Alert
s {$sel:alertName:Alert' :: Maybe Text
alertName = Maybe Text
a} :: Alert)
alert_alertSensitivityThreshold :: Lens.Lens' Alert (Prelude.Maybe Prelude.Natural)
alert_alertSensitivityThreshold :: (Maybe Natural -> f (Maybe Natural)) -> Alert -> f Alert
alert_alertSensitivityThreshold = (Alert -> Maybe Natural)
-> (Alert -> Maybe Natural -> Alert)
-> Lens Alert Alert (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe Natural
alertSensitivityThreshold :: Maybe Natural
$sel:alertSensitivityThreshold:Alert' :: Alert -> Maybe Natural
alertSensitivityThreshold} -> Maybe Natural
alertSensitivityThreshold) (\s :: Alert
s@Alert' {} Maybe Natural
a -> Alert
s {$sel:alertSensitivityThreshold:Alert' :: Maybe Natural
alertSensitivityThreshold = Maybe Natural
a} :: Alert)
alert_alertStatus :: Lens.Lens' Alert (Prelude.Maybe AlertStatus)
alert_alertStatus :: (Maybe AlertStatus -> f (Maybe AlertStatus)) -> Alert -> f Alert
alert_alertStatus = (Alert -> Maybe AlertStatus)
-> (Alert -> Maybe AlertStatus -> Alert)
-> Lens Alert Alert (Maybe AlertStatus) (Maybe AlertStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe AlertStatus
alertStatus :: Maybe AlertStatus
$sel:alertStatus:Alert' :: Alert -> Maybe AlertStatus
alertStatus} -> Maybe AlertStatus
alertStatus) (\s :: Alert
s@Alert' {} Maybe AlertStatus
a -> Alert
s {$sel:alertStatus:Alert' :: Maybe AlertStatus
alertStatus = Maybe AlertStatus
a} :: Alert)
alert_alertDescription :: Lens.Lens' Alert (Prelude.Maybe Prelude.Text)
alert_alertDescription :: (Maybe Text -> f (Maybe Text)) -> Alert -> f Alert
alert_alertDescription = (Alert -> Maybe Text)
-> (Alert -> Maybe Text -> Alert)
-> Lens Alert Alert (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe Text
alertDescription :: Maybe Text
$sel:alertDescription:Alert' :: Alert -> Maybe Text
alertDescription} -> Maybe Text
alertDescription) (\s :: Alert
s@Alert' {} Maybe Text
a -> Alert
s {$sel:alertDescription:Alert' :: Maybe Text
alertDescription = Maybe Text
a} :: Alert)
alert_alertArn :: Lens.Lens' Alert (Prelude.Maybe Prelude.Text)
alert_alertArn :: (Maybe Text -> f (Maybe Text)) -> Alert -> f Alert
alert_alertArn = (Alert -> Maybe Text)
-> (Alert -> Maybe Text -> Alert)
-> Lens Alert Alert (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe Text
alertArn :: Maybe Text
$sel:alertArn:Alert' :: Alert -> Maybe Text
alertArn} -> Maybe Text
alertArn) (\s :: Alert
s@Alert' {} Maybe Text
a -> Alert
s {$sel:alertArn:Alert' :: Maybe Text
alertArn = Maybe Text
a} :: Alert)
alert_alertType :: Lens.Lens' Alert (Prelude.Maybe AlertType)
alert_alertType :: (Maybe AlertType -> f (Maybe AlertType)) -> Alert -> f Alert
alert_alertType = (Alert -> Maybe AlertType)
-> (Alert -> Maybe AlertType -> Alert)
-> Lens Alert Alert (Maybe AlertType) (Maybe AlertType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe AlertType
alertType :: Maybe AlertType
$sel:alertType:Alert' :: Alert -> Maybe AlertType
alertType} -> Maybe AlertType
alertType) (\s :: Alert
s@Alert' {} Maybe AlertType
a -> Alert
s {$sel:alertType:Alert' :: Maybe AlertType
alertType = Maybe AlertType
a} :: Alert)
alert_lastModificationTime :: Lens.Lens' Alert (Prelude.Maybe Prelude.UTCTime)
alert_lastModificationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Alert -> f Alert
alert_lastModificationTime = (Alert -> Maybe POSIX)
-> (Alert -> Maybe POSIX -> Alert)
-> Lens Alert Alert (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Maybe POSIX
lastModificationTime :: Maybe POSIX
$sel:lastModificationTime:Alert' :: Alert -> Maybe POSIX
lastModificationTime} -> Maybe POSIX
lastModificationTime) (\s :: Alert
s@Alert' {} Maybe POSIX
a -> Alert
s {$sel:lastModificationTime:Alert' :: Maybe POSIX
lastModificationTime = Maybe POSIX
a} :: Alert) ((Maybe POSIX -> f (Maybe POSIX)) -> Alert -> f Alert)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Alert
-> f Alert
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON Alert where
parseJSON :: Value -> Parser Alert
parseJSON =
String -> (Object -> Parser Alert) -> Value -> Parser Alert
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Alert"
( \Object
x ->
Maybe POSIX
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert
Alert'
(Maybe POSIX
-> Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
Parser
(Maybe Action
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
-> Parser (Maybe Action)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Action)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Action")
Parser
(Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AnomalyDetectorArn")
Parser
(Maybe Text
-> Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
-> Parser (Maybe Text)
-> Parser
(Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlertName")
Parser
(Maybe Natural
-> Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
-> Parser (Maybe Natural)
-> Parser
(Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlertSensitivityThreshold")
Parser
(Maybe AlertStatus
-> Maybe Text
-> Maybe Text
-> Maybe AlertType
-> Maybe POSIX
-> Alert)
-> Parser (Maybe AlertStatus)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe AlertType -> Maybe POSIX -> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AlertStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlertStatus")
Parser
(Maybe Text
-> Maybe Text -> Maybe AlertType -> Maybe POSIX -> Alert)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe AlertType -> Maybe POSIX -> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlertDescription")
Parser (Maybe Text -> Maybe AlertType -> Maybe POSIX -> Alert)
-> Parser (Maybe Text)
-> Parser (Maybe AlertType -> Maybe POSIX -> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlertArn")
Parser (Maybe AlertType -> Maybe POSIX -> Alert)
-> Parser (Maybe AlertType) -> Parser (Maybe POSIX -> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AlertType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlertType")
Parser (Maybe POSIX -> Alert)
-> Parser (Maybe POSIX) -> Parser Alert
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModificationTime")
)
instance Prelude.Hashable Alert
instance Prelude.NFData Alert