{-# 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.MediaTailor.Types.Alert where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Alert = Alert'
{
Alert -> Text
resourceArn :: Prelude.Text,
Alert -> Text
alertCode :: Prelude.Text,
Alert -> POSIX
lastModifiedTime :: Core.POSIX,
Alert -> [Text]
relatedResourceArns :: [Prelude.Text],
Alert -> Text
alertMessage :: Prelude.Text
}
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 ::
Prelude.Text ->
Prelude.Text ->
Prelude.UTCTime ->
Prelude.Text ->
Alert
newAlert :: Text -> Text -> UTCTime -> Text -> Alert
newAlert
Text
pResourceArn_
Text
pAlertCode_
UTCTime
pLastModifiedTime_
Text
pAlertMessage_ =
Alert' :: Text -> Text -> POSIX -> [Text] -> Text -> Alert
Alert'
{ $sel:resourceArn:Alert' :: Text
resourceArn = Text
pResourceArn_,
$sel:alertCode:Alert' :: Text
alertCode = Text
pAlertCode_,
$sel:lastModifiedTime:Alert' :: POSIX
lastModifiedTime =
Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_,
$sel:relatedResourceArns:Alert' :: [Text]
relatedResourceArns = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:alertMessage:Alert' :: Text
alertMessage = Text
pAlertMessage_
}
alert_resourceArn :: Lens.Lens' Alert Prelude.Text
alert_resourceArn :: (Text -> f Text) -> Alert -> f Alert
alert_resourceArn = (Alert -> Text)
-> (Alert -> Text -> Alert) -> Lens Alert Alert Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Text
resourceArn :: Text
$sel:resourceArn:Alert' :: Alert -> Text
resourceArn} -> Text
resourceArn) (\s :: Alert
s@Alert' {} Text
a -> Alert
s {$sel:resourceArn:Alert' :: Text
resourceArn = Text
a} :: Alert)
alert_alertCode :: Lens.Lens' Alert Prelude.Text
alert_alertCode :: (Text -> f Text) -> Alert -> f Alert
alert_alertCode = (Alert -> Text)
-> (Alert -> Text -> Alert) -> Lens Alert Alert Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Text
alertCode :: Text
$sel:alertCode:Alert' :: Alert -> Text
alertCode} -> Text
alertCode) (\s :: Alert
s@Alert' {} Text
a -> Alert
s {$sel:alertCode:Alert' :: Text
alertCode = Text
a} :: Alert)
alert_lastModifiedTime :: Lens.Lens' Alert Prelude.UTCTime
alert_lastModifiedTime :: (UTCTime -> f UTCTime) -> Alert -> f Alert
alert_lastModifiedTime = (Alert -> POSIX)
-> (Alert -> POSIX -> Alert) -> Lens Alert Alert POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {POSIX
lastModifiedTime :: POSIX
$sel:lastModifiedTime:Alert' :: Alert -> POSIX
lastModifiedTime} -> POSIX
lastModifiedTime) (\s :: Alert
s@Alert' {} POSIX
a -> Alert
s {$sel:lastModifiedTime:Alert' :: POSIX
lastModifiedTime = POSIX
a} :: Alert) ((POSIX -> f POSIX) -> Alert -> f Alert)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> Alert
-> f Alert
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
alert_relatedResourceArns :: Lens.Lens' Alert [Prelude.Text]
alert_relatedResourceArns :: ([Text] -> f [Text]) -> Alert -> f Alert
alert_relatedResourceArns = (Alert -> [Text])
-> (Alert -> [Text] -> Alert) -> Lens Alert Alert [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {[Text]
relatedResourceArns :: [Text]
$sel:relatedResourceArns:Alert' :: Alert -> [Text]
relatedResourceArns} -> [Text]
relatedResourceArns) (\s :: Alert
s@Alert' {} [Text]
a -> Alert
s {$sel:relatedResourceArns:Alert' :: [Text]
relatedResourceArns = [Text]
a} :: Alert) (([Text] -> f [Text]) -> Alert -> f Alert)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> Alert
-> f Alert
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
alert_alertMessage :: Lens.Lens' Alert Prelude.Text
alert_alertMessage :: (Text -> f Text) -> Alert -> f Alert
alert_alertMessage = (Alert -> Text)
-> (Alert -> Text -> Alert) -> Lens Alert Alert Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alert' {Text
alertMessage :: Text
$sel:alertMessage:Alert' :: Alert -> Text
alertMessage} -> Text
alertMessage) (\s :: Alert
s@Alert' {} Text
a -> Alert
s {$sel:alertMessage:Alert' :: Text
alertMessage = Text
a} :: Alert)
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 ->
Text -> Text -> POSIX -> [Text] -> Text -> Alert
Alert'
(Text -> Text -> POSIX -> [Text] -> Text -> Alert)
-> Parser Text -> Parser (Text -> POSIX -> [Text] -> Text -> Alert)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceArn")
Parser (Text -> POSIX -> [Text] -> Text -> Alert)
-> Parser Text -> Parser (POSIX -> [Text] -> Text -> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AlertCode")
Parser (POSIX -> [Text] -> Text -> Alert)
-> Parser POSIX -> Parser ([Text] -> Text -> Alert)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LastModifiedTime")
Parser ([Text] -> Text -> Alert)
-> Parser [Text] -> Parser (Text -> 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
"RelatedResourceArns"
Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Text -> Alert) -> Parser Text -> Parser Alert
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AlertMessage")
)
instance Prelude.Hashable Alert
instance Prelude.NFData Alert