{-# 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.AccessAnalyzer.Types.JobDetails where
import Amazonka.AccessAnalyzer.Types.JobError
import Amazonka.AccessAnalyzer.Types.JobStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data JobDetails = JobDetails'
{
JobDetails -> Maybe POSIX
completedOn :: Prelude.Maybe Core.POSIX,
JobDetails -> Maybe JobError
jobError :: Prelude.Maybe JobError,
JobDetails -> Text
jobId :: Prelude.Text,
JobDetails -> POSIX
startedOn :: Core.POSIX,
JobDetails -> JobStatus
status :: JobStatus
}
deriving (JobDetails -> JobDetails -> Bool
(JobDetails -> JobDetails -> Bool)
-> (JobDetails -> JobDetails -> Bool) -> Eq JobDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobDetails -> JobDetails -> Bool
$c/= :: JobDetails -> JobDetails -> Bool
== :: JobDetails -> JobDetails -> Bool
$c== :: JobDetails -> JobDetails -> Bool
Prelude.Eq, ReadPrec [JobDetails]
ReadPrec JobDetails
Int -> ReadS JobDetails
ReadS [JobDetails]
(Int -> ReadS JobDetails)
-> ReadS [JobDetails]
-> ReadPrec JobDetails
-> ReadPrec [JobDetails]
-> Read JobDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobDetails]
$creadListPrec :: ReadPrec [JobDetails]
readPrec :: ReadPrec JobDetails
$creadPrec :: ReadPrec JobDetails
readList :: ReadS [JobDetails]
$creadList :: ReadS [JobDetails]
readsPrec :: Int -> ReadS JobDetails
$creadsPrec :: Int -> ReadS JobDetails
Prelude.Read, Int -> JobDetails -> ShowS
[JobDetails] -> ShowS
JobDetails -> String
(Int -> JobDetails -> ShowS)
-> (JobDetails -> String)
-> ([JobDetails] -> ShowS)
-> Show JobDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobDetails] -> ShowS
$cshowList :: [JobDetails] -> ShowS
show :: JobDetails -> String
$cshow :: JobDetails -> String
showsPrec :: Int -> JobDetails -> ShowS
$cshowsPrec :: Int -> JobDetails -> ShowS
Prelude.Show, (forall x. JobDetails -> Rep JobDetails x)
-> (forall x. Rep JobDetails x -> JobDetails) -> Generic JobDetails
forall x. Rep JobDetails x -> JobDetails
forall x. JobDetails -> Rep JobDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobDetails x -> JobDetails
$cfrom :: forall x. JobDetails -> Rep JobDetails x
Prelude.Generic)
newJobDetails ::
Prelude.Text ->
Prelude.UTCTime ->
JobStatus ->
JobDetails
newJobDetails :: Text -> UTCTime -> JobStatus -> JobDetails
newJobDetails Text
pJobId_ UTCTime
pStartedOn_ JobStatus
pStatus_ =
JobDetails' :: Maybe POSIX
-> Maybe JobError -> Text -> POSIX -> JobStatus -> JobDetails
JobDetails'
{ $sel:completedOn:JobDetails' :: Maybe POSIX
completedOn = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:jobError:JobDetails' :: Maybe JobError
jobError = Maybe JobError
forall a. Maybe a
Prelude.Nothing,
$sel:jobId:JobDetails' :: Text
jobId = Text
pJobId_,
$sel:startedOn:JobDetails' :: POSIX
startedOn = 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
pStartedOn_,
$sel:status:JobDetails' :: JobStatus
status = JobStatus
pStatus_
}
jobDetails_completedOn :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.UTCTime)
jobDetails_completedOn :: (Maybe UTCTime -> f (Maybe UTCTime)) -> JobDetails -> f JobDetails
jobDetails_completedOn = (JobDetails -> Maybe POSIX)
-> (JobDetails -> Maybe POSIX -> JobDetails)
-> Lens JobDetails JobDetails (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe POSIX
completedOn :: Maybe POSIX
$sel:completedOn:JobDetails' :: JobDetails -> Maybe POSIX
completedOn} -> Maybe POSIX
completedOn) (\s :: JobDetails
s@JobDetails' {} Maybe POSIX
a -> JobDetails
s {$sel:completedOn:JobDetails' :: Maybe POSIX
completedOn = Maybe POSIX
a} :: JobDetails) ((Maybe POSIX -> f (Maybe POSIX)) -> JobDetails -> f JobDetails)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JobDetails
-> f JobDetails
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
jobDetails_jobError :: Lens.Lens' JobDetails (Prelude.Maybe JobError)
jobDetails_jobError :: (Maybe JobError -> f (Maybe JobError))
-> JobDetails -> f JobDetails
jobDetails_jobError = (JobDetails -> Maybe JobError)
-> (JobDetails -> Maybe JobError -> JobDetails)
-> Lens JobDetails JobDetails (Maybe JobError) (Maybe JobError)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe JobError
jobError :: Maybe JobError
$sel:jobError:JobDetails' :: JobDetails -> Maybe JobError
jobError} -> Maybe JobError
jobError) (\s :: JobDetails
s@JobDetails' {} Maybe JobError
a -> JobDetails
s {$sel:jobError:JobDetails' :: Maybe JobError
jobError = Maybe JobError
a} :: JobDetails)
jobDetails_jobId :: Lens.Lens' JobDetails Prelude.Text
jobDetails_jobId :: (Text -> f Text) -> JobDetails -> f JobDetails
jobDetails_jobId = (JobDetails -> Text)
-> (JobDetails -> Text -> JobDetails)
-> Lens JobDetails JobDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Text
jobId :: Text
$sel:jobId:JobDetails' :: JobDetails -> Text
jobId} -> Text
jobId) (\s :: JobDetails
s@JobDetails' {} Text
a -> JobDetails
s {$sel:jobId:JobDetails' :: Text
jobId = Text
a} :: JobDetails)
jobDetails_startedOn :: Lens.Lens' JobDetails Prelude.UTCTime
jobDetails_startedOn :: (UTCTime -> f UTCTime) -> JobDetails -> f JobDetails
jobDetails_startedOn = (JobDetails -> POSIX)
-> (JobDetails -> POSIX -> JobDetails)
-> Lens JobDetails JobDetails POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {POSIX
startedOn :: POSIX
$sel:startedOn:JobDetails' :: JobDetails -> POSIX
startedOn} -> POSIX
startedOn) (\s :: JobDetails
s@JobDetails' {} POSIX
a -> JobDetails
s {$sel:startedOn:JobDetails' :: POSIX
startedOn = POSIX
a} :: JobDetails) ((POSIX -> f POSIX) -> JobDetails -> f JobDetails)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> JobDetails
-> f JobDetails
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
jobDetails_status :: Lens.Lens' JobDetails JobStatus
jobDetails_status :: (JobStatus -> f JobStatus) -> JobDetails -> f JobDetails
jobDetails_status = (JobDetails -> JobStatus)
-> (JobDetails -> JobStatus -> JobDetails)
-> Lens JobDetails JobDetails JobStatus JobStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {JobStatus
status :: JobStatus
$sel:status:JobDetails' :: JobDetails -> JobStatus
status} -> JobStatus
status) (\s :: JobDetails
s@JobDetails' {} JobStatus
a -> JobDetails
s {$sel:status:JobDetails' :: JobStatus
status = JobStatus
a} :: JobDetails)
instance Core.FromJSON JobDetails where
parseJSON :: Value -> Parser JobDetails
parseJSON =
String
-> (Object -> Parser JobDetails) -> Value -> Parser JobDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"JobDetails"
( \Object
x ->
Maybe POSIX
-> Maybe JobError -> Text -> POSIX -> JobStatus -> JobDetails
JobDetails'
(Maybe POSIX
-> Maybe JobError -> Text -> POSIX -> JobStatus -> JobDetails)
-> Parser (Maybe POSIX)
-> Parser
(Maybe JobError -> Text -> POSIX -> JobStatus -> JobDetails)
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
"completedOn")
Parser (Maybe JobError -> Text -> POSIX -> JobStatus -> JobDetails)
-> Parser (Maybe JobError)
-> Parser (Text -> POSIX -> JobStatus -> JobDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobError)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"jobError")
Parser (Text -> POSIX -> JobStatus -> JobDetails)
-> Parser Text -> Parser (POSIX -> JobStatus -> JobDetails)
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
"jobId")
Parser (POSIX -> JobStatus -> JobDetails)
-> Parser POSIX -> Parser (JobStatus -> JobDetails)
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
"startedOn")
Parser (JobStatus -> JobDetails)
-> Parser JobStatus -> Parser JobDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser JobStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
)
instance Prelude.Hashable JobDetails
instance Prelude.NFData JobDetails