{-# 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.MwAA.Types.LastUpdate where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MwAA.Types.UpdateError
import Amazonka.MwAA.Types.UpdateStatus
import qualified Amazonka.Prelude as Prelude
data LastUpdate = LastUpdate'
{
LastUpdate -> Maybe UpdateStatus
status :: Prelude.Maybe UpdateStatus,
LastUpdate -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
LastUpdate -> Maybe UpdateError
error :: Prelude.Maybe UpdateError
}
deriving (LastUpdate -> LastUpdate -> Bool
(LastUpdate -> LastUpdate -> Bool)
-> (LastUpdate -> LastUpdate -> Bool) -> Eq LastUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LastUpdate -> LastUpdate -> Bool
$c/= :: LastUpdate -> LastUpdate -> Bool
== :: LastUpdate -> LastUpdate -> Bool
$c== :: LastUpdate -> LastUpdate -> Bool
Prelude.Eq, ReadPrec [LastUpdate]
ReadPrec LastUpdate
Int -> ReadS LastUpdate
ReadS [LastUpdate]
(Int -> ReadS LastUpdate)
-> ReadS [LastUpdate]
-> ReadPrec LastUpdate
-> ReadPrec [LastUpdate]
-> Read LastUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LastUpdate]
$creadListPrec :: ReadPrec [LastUpdate]
readPrec :: ReadPrec LastUpdate
$creadPrec :: ReadPrec LastUpdate
readList :: ReadS [LastUpdate]
$creadList :: ReadS [LastUpdate]
readsPrec :: Int -> ReadS LastUpdate
$creadsPrec :: Int -> ReadS LastUpdate
Prelude.Read, Int -> LastUpdate -> ShowS
[LastUpdate] -> ShowS
LastUpdate -> String
(Int -> LastUpdate -> ShowS)
-> (LastUpdate -> String)
-> ([LastUpdate] -> ShowS)
-> Show LastUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LastUpdate] -> ShowS
$cshowList :: [LastUpdate] -> ShowS
show :: LastUpdate -> String
$cshow :: LastUpdate -> String
showsPrec :: Int -> LastUpdate -> ShowS
$cshowsPrec :: Int -> LastUpdate -> ShowS
Prelude.Show, (forall x. LastUpdate -> Rep LastUpdate x)
-> (forall x. Rep LastUpdate x -> LastUpdate) -> Generic LastUpdate
forall x. Rep LastUpdate x -> LastUpdate
forall x. LastUpdate -> Rep LastUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LastUpdate x -> LastUpdate
$cfrom :: forall x. LastUpdate -> Rep LastUpdate x
Prelude.Generic)
newLastUpdate ::
LastUpdate
newLastUpdate :: LastUpdate
newLastUpdate =
LastUpdate' :: Maybe UpdateStatus
-> Maybe POSIX -> Maybe UpdateError -> LastUpdate
LastUpdate'
{ $sel:status:LastUpdate' :: Maybe UpdateStatus
status = Maybe UpdateStatus
forall a. Maybe a
Prelude.Nothing,
$sel:createdAt:LastUpdate' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:error:LastUpdate' :: Maybe UpdateError
error = Maybe UpdateError
forall a. Maybe a
Prelude.Nothing
}
lastUpdate_status :: Lens.Lens' LastUpdate (Prelude.Maybe UpdateStatus)
lastUpdate_status :: (Maybe UpdateStatus -> f (Maybe UpdateStatus))
-> LastUpdate -> f LastUpdate
lastUpdate_status = (LastUpdate -> Maybe UpdateStatus)
-> (LastUpdate -> Maybe UpdateStatus -> LastUpdate)
-> Lens
LastUpdate LastUpdate (Maybe UpdateStatus) (Maybe UpdateStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastUpdate' {Maybe UpdateStatus
status :: Maybe UpdateStatus
$sel:status:LastUpdate' :: LastUpdate -> Maybe UpdateStatus
status} -> Maybe UpdateStatus
status) (\s :: LastUpdate
s@LastUpdate' {} Maybe UpdateStatus
a -> LastUpdate
s {$sel:status:LastUpdate' :: Maybe UpdateStatus
status = Maybe UpdateStatus
a} :: LastUpdate)
lastUpdate_createdAt :: Lens.Lens' LastUpdate (Prelude.Maybe Prelude.UTCTime)
lastUpdate_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> LastUpdate -> f LastUpdate
lastUpdate_createdAt = (LastUpdate -> Maybe POSIX)
-> (LastUpdate -> Maybe POSIX -> LastUpdate)
-> Lens LastUpdate LastUpdate (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastUpdate' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:LastUpdate' :: LastUpdate -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: LastUpdate
s@LastUpdate' {} Maybe POSIX
a -> LastUpdate
s {$sel:createdAt:LastUpdate' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: LastUpdate) ((Maybe POSIX -> f (Maybe POSIX)) -> LastUpdate -> f LastUpdate)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LastUpdate
-> f LastUpdate
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
lastUpdate_error :: Lens.Lens' LastUpdate (Prelude.Maybe UpdateError)
lastUpdate_error :: (Maybe UpdateError -> f (Maybe UpdateError))
-> LastUpdate -> f LastUpdate
lastUpdate_error = (LastUpdate -> Maybe UpdateError)
-> (LastUpdate -> Maybe UpdateError -> LastUpdate)
-> Lens
LastUpdate LastUpdate (Maybe UpdateError) (Maybe UpdateError)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastUpdate' {Maybe UpdateError
error :: Maybe UpdateError
$sel:error:LastUpdate' :: LastUpdate -> Maybe UpdateError
error} -> Maybe UpdateError
error) (\s :: LastUpdate
s@LastUpdate' {} Maybe UpdateError
a -> LastUpdate
s {$sel:error:LastUpdate' :: Maybe UpdateError
error = Maybe UpdateError
a} :: LastUpdate)
instance Core.FromJSON LastUpdate where
parseJSON :: Value -> Parser LastUpdate
parseJSON =
String
-> (Object -> Parser LastUpdate) -> Value -> Parser LastUpdate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LastUpdate"
( \Object
x ->
Maybe UpdateStatus
-> Maybe POSIX -> Maybe UpdateError -> LastUpdate
LastUpdate'
(Maybe UpdateStatus
-> Maybe POSIX -> Maybe UpdateError -> LastUpdate)
-> Parser (Maybe UpdateStatus)
-> Parser (Maybe POSIX -> Maybe UpdateError -> LastUpdate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe UpdateStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
Parser (Maybe POSIX -> Maybe UpdateError -> LastUpdate)
-> Parser (Maybe POSIX) -> Parser (Maybe UpdateError -> LastUpdate)
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
"CreatedAt")
Parser (Maybe UpdateError -> LastUpdate)
-> Parser (Maybe UpdateError) -> Parser LastUpdate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UpdateError)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Error")
)
instance Prelude.Hashable LastUpdate
instance Prelude.NFData LastUpdate