{-# 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.CloudTrailDetails where
import Amazonka.AccessAnalyzer.Types.Trail
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CloudTrailDetails = CloudTrailDetails'
{
CloudTrailDetails -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
CloudTrailDetails -> Text
accessRole :: Prelude.Text,
CloudTrailDetails -> POSIX
startTime :: Core.POSIX,
CloudTrailDetails -> [Trail]
trails :: [Trail]
}
deriving (CloudTrailDetails -> CloudTrailDetails -> Bool
(CloudTrailDetails -> CloudTrailDetails -> Bool)
-> (CloudTrailDetails -> CloudTrailDetails -> Bool)
-> Eq CloudTrailDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudTrailDetails -> CloudTrailDetails -> Bool
$c/= :: CloudTrailDetails -> CloudTrailDetails -> Bool
== :: CloudTrailDetails -> CloudTrailDetails -> Bool
$c== :: CloudTrailDetails -> CloudTrailDetails -> Bool
Prelude.Eq, ReadPrec [CloudTrailDetails]
ReadPrec CloudTrailDetails
Int -> ReadS CloudTrailDetails
ReadS [CloudTrailDetails]
(Int -> ReadS CloudTrailDetails)
-> ReadS [CloudTrailDetails]
-> ReadPrec CloudTrailDetails
-> ReadPrec [CloudTrailDetails]
-> Read CloudTrailDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudTrailDetails]
$creadListPrec :: ReadPrec [CloudTrailDetails]
readPrec :: ReadPrec CloudTrailDetails
$creadPrec :: ReadPrec CloudTrailDetails
readList :: ReadS [CloudTrailDetails]
$creadList :: ReadS [CloudTrailDetails]
readsPrec :: Int -> ReadS CloudTrailDetails
$creadsPrec :: Int -> ReadS CloudTrailDetails
Prelude.Read, Int -> CloudTrailDetails -> ShowS
[CloudTrailDetails] -> ShowS
CloudTrailDetails -> String
(Int -> CloudTrailDetails -> ShowS)
-> (CloudTrailDetails -> String)
-> ([CloudTrailDetails] -> ShowS)
-> Show CloudTrailDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudTrailDetails] -> ShowS
$cshowList :: [CloudTrailDetails] -> ShowS
show :: CloudTrailDetails -> String
$cshow :: CloudTrailDetails -> String
showsPrec :: Int -> CloudTrailDetails -> ShowS
$cshowsPrec :: Int -> CloudTrailDetails -> ShowS
Prelude.Show, (forall x. CloudTrailDetails -> Rep CloudTrailDetails x)
-> (forall x. Rep CloudTrailDetails x -> CloudTrailDetails)
-> Generic CloudTrailDetails
forall x. Rep CloudTrailDetails x -> CloudTrailDetails
forall x. CloudTrailDetails -> Rep CloudTrailDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudTrailDetails x -> CloudTrailDetails
$cfrom :: forall x. CloudTrailDetails -> Rep CloudTrailDetails x
Prelude.Generic)
newCloudTrailDetails ::
Prelude.Text ->
Prelude.UTCTime ->
CloudTrailDetails
newCloudTrailDetails :: Text -> UTCTime -> CloudTrailDetails
newCloudTrailDetails Text
pAccessRole_ UTCTime
pStartTime_ =
CloudTrailDetails' :: Maybe POSIX -> Text -> POSIX -> [Trail] -> CloudTrailDetails
CloudTrailDetails'
{ $sel:endTime:CloudTrailDetails' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:accessRole:CloudTrailDetails' :: Text
accessRole = Text
pAccessRole_,
$sel:startTime:CloudTrailDetails' :: POSIX
startTime = 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
pStartTime_,
$sel:trails:CloudTrailDetails' :: [Trail]
trails = [Trail]
forall a. Monoid a => a
Prelude.mempty
}
cloudTrailDetails_endTime :: Lens.Lens' CloudTrailDetails (Prelude.Maybe Prelude.UTCTime)
cloudTrailDetails_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CloudTrailDetails -> f CloudTrailDetails
cloudTrailDetails_endTime = (CloudTrailDetails -> Maybe POSIX)
-> (CloudTrailDetails -> Maybe POSIX -> CloudTrailDetails)
-> Lens
CloudTrailDetails CloudTrailDetails (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudTrailDetails' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:CloudTrailDetails' :: CloudTrailDetails -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: CloudTrailDetails
s@CloudTrailDetails' {} Maybe POSIX
a -> CloudTrailDetails
s {$sel:endTime:CloudTrailDetails' :: Maybe POSIX
endTime = Maybe POSIX
a} :: CloudTrailDetails) ((Maybe POSIX -> f (Maybe POSIX))
-> CloudTrailDetails -> f CloudTrailDetails)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CloudTrailDetails
-> f CloudTrailDetails
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
cloudTrailDetails_accessRole :: Lens.Lens' CloudTrailDetails Prelude.Text
cloudTrailDetails_accessRole :: (Text -> f Text) -> CloudTrailDetails -> f CloudTrailDetails
cloudTrailDetails_accessRole = (CloudTrailDetails -> Text)
-> (CloudTrailDetails -> Text -> CloudTrailDetails)
-> Lens CloudTrailDetails CloudTrailDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudTrailDetails' {Text
accessRole :: Text
$sel:accessRole:CloudTrailDetails' :: CloudTrailDetails -> Text
accessRole} -> Text
accessRole) (\s :: CloudTrailDetails
s@CloudTrailDetails' {} Text
a -> CloudTrailDetails
s {$sel:accessRole:CloudTrailDetails' :: Text
accessRole = Text
a} :: CloudTrailDetails)
cloudTrailDetails_startTime :: Lens.Lens' CloudTrailDetails Prelude.UTCTime
cloudTrailDetails_startTime :: (UTCTime -> f UTCTime) -> CloudTrailDetails -> f CloudTrailDetails
cloudTrailDetails_startTime = (CloudTrailDetails -> POSIX)
-> (CloudTrailDetails -> POSIX -> CloudTrailDetails)
-> Lens CloudTrailDetails CloudTrailDetails POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudTrailDetails' {POSIX
startTime :: POSIX
$sel:startTime:CloudTrailDetails' :: CloudTrailDetails -> POSIX
startTime} -> POSIX
startTime) (\s :: CloudTrailDetails
s@CloudTrailDetails' {} POSIX
a -> CloudTrailDetails
s {$sel:startTime:CloudTrailDetails' :: POSIX
startTime = POSIX
a} :: CloudTrailDetails) ((POSIX -> f POSIX) -> CloudTrailDetails -> f CloudTrailDetails)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> CloudTrailDetails
-> f CloudTrailDetails
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
cloudTrailDetails_trails :: Lens.Lens' CloudTrailDetails [Trail]
cloudTrailDetails_trails :: ([Trail] -> f [Trail]) -> CloudTrailDetails -> f CloudTrailDetails
cloudTrailDetails_trails = (CloudTrailDetails -> [Trail])
-> (CloudTrailDetails -> [Trail] -> CloudTrailDetails)
-> Lens CloudTrailDetails CloudTrailDetails [Trail] [Trail]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudTrailDetails' {[Trail]
trails :: [Trail]
$sel:trails:CloudTrailDetails' :: CloudTrailDetails -> [Trail]
trails} -> [Trail]
trails) (\s :: CloudTrailDetails
s@CloudTrailDetails' {} [Trail]
a -> CloudTrailDetails
s {$sel:trails:CloudTrailDetails' :: [Trail]
trails = [Trail]
a} :: CloudTrailDetails) (([Trail] -> f [Trail])
-> CloudTrailDetails -> f CloudTrailDetails)
-> (([Trail] -> f [Trail]) -> [Trail] -> f [Trail])
-> ([Trail] -> f [Trail])
-> CloudTrailDetails
-> f CloudTrailDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Trail] -> f [Trail]) -> [Trail] -> f [Trail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable CloudTrailDetails
instance Prelude.NFData CloudTrailDetails
instance Core.ToJSON CloudTrailDetails where
toJSON :: CloudTrailDetails -> Value
toJSON CloudTrailDetails' {[Trail]
Maybe POSIX
Text
POSIX
trails :: [Trail]
startTime :: POSIX
accessRole :: Text
endTime :: Maybe POSIX
$sel:trails:CloudTrailDetails' :: CloudTrailDetails -> [Trail]
$sel:startTime:CloudTrailDetails' :: CloudTrailDetails -> POSIX
$sel:accessRole:CloudTrailDetails' :: CloudTrailDetails -> Text
$sel:endTime:CloudTrailDetails' :: CloudTrailDetails -> Maybe POSIX
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"endTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
endTime,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"accessRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
accessRole),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"startTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
startTime),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"trails" Text -> [Trail] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Trail]
trails)
]
)