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