{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudTrail.DescribeTrails
(
DescribeTrails (..),
newDescribeTrails,
describeTrails_includeShadowTrails,
describeTrails_trailNameList,
DescribeTrailsResponse (..),
newDescribeTrailsResponse,
describeTrailsResponse_trailList,
describeTrailsResponse_httpStatus,
)
where
import Amazonka.CloudTrail.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeTrails = DescribeTrails'
{
DescribeTrails -> Maybe Bool
includeShadowTrails :: Prelude.Maybe Prelude.Bool,
DescribeTrails -> Maybe [Text]
trailNameList :: Prelude.Maybe [Prelude.Text]
}
deriving (DescribeTrails -> DescribeTrails -> Bool
(DescribeTrails -> DescribeTrails -> Bool)
-> (DescribeTrails -> DescribeTrails -> Bool) -> Eq DescribeTrails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTrails -> DescribeTrails -> Bool
$c/= :: DescribeTrails -> DescribeTrails -> Bool
== :: DescribeTrails -> DescribeTrails -> Bool
$c== :: DescribeTrails -> DescribeTrails -> Bool
Prelude.Eq, ReadPrec [DescribeTrails]
ReadPrec DescribeTrails
Int -> ReadS DescribeTrails
ReadS [DescribeTrails]
(Int -> ReadS DescribeTrails)
-> ReadS [DescribeTrails]
-> ReadPrec DescribeTrails
-> ReadPrec [DescribeTrails]
-> Read DescribeTrails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTrails]
$creadListPrec :: ReadPrec [DescribeTrails]
readPrec :: ReadPrec DescribeTrails
$creadPrec :: ReadPrec DescribeTrails
readList :: ReadS [DescribeTrails]
$creadList :: ReadS [DescribeTrails]
readsPrec :: Int -> ReadS DescribeTrails
$creadsPrec :: Int -> ReadS DescribeTrails
Prelude.Read, Int -> DescribeTrails -> ShowS
[DescribeTrails] -> ShowS
DescribeTrails -> String
(Int -> DescribeTrails -> ShowS)
-> (DescribeTrails -> String)
-> ([DescribeTrails] -> ShowS)
-> Show DescribeTrails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTrails] -> ShowS
$cshowList :: [DescribeTrails] -> ShowS
show :: DescribeTrails -> String
$cshow :: DescribeTrails -> String
showsPrec :: Int -> DescribeTrails -> ShowS
$cshowsPrec :: Int -> DescribeTrails -> ShowS
Prelude.Show, (forall x. DescribeTrails -> Rep DescribeTrails x)
-> (forall x. Rep DescribeTrails x -> DescribeTrails)
-> Generic DescribeTrails
forall x. Rep DescribeTrails x -> DescribeTrails
forall x. DescribeTrails -> Rep DescribeTrails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTrails x -> DescribeTrails
$cfrom :: forall x. DescribeTrails -> Rep DescribeTrails x
Prelude.Generic)
newDescribeTrails ::
DescribeTrails
newDescribeTrails :: DescribeTrails
newDescribeTrails =
DescribeTrails' :: Maybe Bool -> Maybe [Text] -> DescribeTrails
DescribeTrails'
{ $sel:includeShadowTrails:DescribeTrails' :: Maybe Bool
includeShadowTrails =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:trailNameList:DescribeTrails' :: Maybe [Text]
trailNameList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
describeTrails_includeShadowTrails :: Lens.Lens' DescribeTrails (Prelude.Maybe Prelude.Bool)
describeTrails_includeShadowTrails :: (Maybe Bool -> f (Maybe Bool))
-> DescribeTrails -> f DescribeTrails
describeTrails_includeShadowTrails = (DescribeTrails -> Maybe Bool)
-> (DescribeTrails -> Maybe Bool -> DescribeTrails)
-> Lens DescribeTrails DescribeTrails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrails' {Maybe Bool
includeShadowTrails :: Maybe Bool
$sel:includeShadowTrails:DescribeTrails' :: DescribeTrails -> Maybe Bool
includeShadowTrails} -> Maybe Bool
includeShadowTrails) (\s :: DescribeTrails
s@DescribeTrails' {} Maybe Bool
a -> DescribeTrails
s {$sel:includeShadowTrails:DescribeTrails' :: Maybe Bool
includeShadowTrails = Maybe Bool
a} :: DescribeTrails)
describeTrails_trailNameList :: Lens.Lens' DescribeTrails (Prelude.Maybe [Prelude.Text])
describeTrails_trailNameList :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeTrails -> f DescribeTrails
describeTrails_trailNameList = (DescribeTrails -> Maybe [Text])
-> (DescribeTrails -> Maybe [Text] -> DescribeTrails)
-> Lens DescribeTrails DescribeTrails (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrails' {Maybe [Text]
trailNameList :: Maybe [Text]
$sel:trailNameList:DescribeTrails' :: DescribeTrails -> Maybe [Text]
trailNameList} -> Maybe [Text]
trailNameList) (\s :: DescribeTrails
s@DescribeTrails' {} Maybe [Text]
a -> DescribeTrails
s {$sel:trailNameList:DescribeTrails' :: Maybe [Text]
trailNameList = Maybe [Text]
a} :: DescribeTrails) ((Maybe [Text] -> f (Maybe [Text]))
-> DescribeTrails -> f DescribeTrails)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeTrails
-> f DescribeTrails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeTrails where
type
AWSResponse DescribeTrails =
DescribeTrailsResponse
request :: DescribeTrails -> Request DescribeTrails
request = Service -> DescribeTrails -> Request DescribeTrails
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeTrails
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTrails)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeTrails))
-> Logger
-> Service
-> Proxy DescribeTrails
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTrails)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Trail] -> Int -> DescribeTrailsResponse
DescribeTrailsResponse'
(Maybe [Trail] -> Int -> DescribeTrailsResponse)
-> Either String (Maybe [Trail])
-> Either String (Int -> DescribeTrailsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Trail]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"trailList" Either String (Maybe (Maybe [Trail]))
-> Maybe [Trail] -> Either String (Maybe [Trail])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Trail]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeTrailsResponse)
-> Either String Int -> Either String DescribeTrailsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DescribeTrails
instance Prelude.NFData DescribeTrails
instance Core.ToHeaders DescribeTrails where
toHeaders :: DescribeTrails -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeTrails -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.DescribeTrails" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DescribeTrails where
toJSON :: DescribeTrails -> Value
toJSON DescribeTrails' {Maybe Bool
Maybe [Text]
trailNameList :: Maybe [Text]
includeShadowTrails :: Maybe Bool
$sel:trailNameList:DescribeTrails' :: DescribeTrails -> Maybe [Text]
$sel:includeShadowTrails:DescribeTrails' :: DescribeTrails -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"includeShadowTrails" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeShadowTrails,
(Text
"trailNameList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
trailNameList
]
)
instance Core.ToPath DescribeTrails where
toPath :: DescribeTrails -> ByteString
toPath = ByteString -> DescribeTrails -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeTrails where
toQuery :: DescribeTrails -> QueryString
toQuery = QueryString -> DescribeTrails -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeTrailsResponse = DescribeTrailsResponse'
{
DescribeTrailsResponse -> Maybe [Trail]
trailList :: Prelude.Maybe [Trail],
DescribeTrailsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeTrailsResponse -> DescribeTrailsResponse -> Bool
(DescribeTrailsResponse -> DescribeTrailsResponse -> Bool)
-> (DescribeTrailsResponse -> DescribeTrailsResponse -> Bool)
-> Eq DescribeTrailsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTrailsResponse -> DescribeTrailsResponse -> Bool
$c/= :: DescribeTrailsResponse -> DescribeTrailsResponse -> Bool
== :: DescribeTrailsResponse -> DescribeTrailsResponse -> Bool
$c== :: DescribeTrailsResponse -> DescribeTrailsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTrailsResponse]
ReadPrec DescribeTrailsResponse
Int -> ReadS DescribeTrailsResponse
ReadS [DescribeTrailsResponse]
(Int -> ReadS DescribeTrailsResponse)
-> ReadS [DescribeTrailsResponse]
-> ReadPrec DescribeTrailsResponse
-> ReadPrec [DescribeTrailsResponse]
-> Read DescribeTrailsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTrailsResponse]
$creadListPrec :: ReadPrec [DescribeTrailsResponse]
readPrec :: ReadPrec DescribeTrailsResponse
$creadPrec :: ReadPrec DescribeTrailsResponse
readList :: ReadS [DescribeTrailsResponse]
$creadList :: ReadS [DescribeTrailsResponse]
readsPrec :: Int -> ReadS DescribeTrailsResponse
$creadsPrec :: Int -> ReadS DescribeTrailsResponse
Prelude.Read, Int -> DescribeTrailsResponse -> ShowS
[DescribeTrailsResponse] -> ShowS
DescribeTrailsResponse -> String
(Int -> DescribeTrailsResponse -> ShowS)
-> (DescribeTrailsResponse -> String)
-> ([DescribeTrailsResponse] -> ShowS)
-> Show DescribeTrailsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTrailsResponse] -> ShowS
$cshowList :: [DescribeTrailsResponse] -> ShowS
show :: DescribeTrailsResponse -> String
$cshow :: DescribeTrailsResponse -> String
showsPrec :: Int -> DescribeTrailsResponse -> ShowS
$cshowsPrec :: Int -> DescribeTrailsResponse -> ShowS
Prelude.Show, (forall x. DescribeTrailsResponse -> Rep DescribeTrailsResponse x)
-> (forall x.
Rep DescribeTrailsResponse x -> DescribeTrailsResponse)
-> Generic DescribeTrailsResponse
forall x. Rep DescribeTrailsResponse x -> DescribeTrailsResponse
forall x. DescribeTrailsResponse -> Rep DescribeTrailsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTrailsResponse x -> DescribeTrailsResponse
$cfrom :: forall x. DescribeTrailsResponse -> Rep DescribeTrailsResponse x
Prelude.Generic)
newDescribeTrailsResponse ::
Prelude.Int ->
DescribeTrailsResponse
newDescribeTrailsResponse :: Int -> DescribeTrailsResponse
newDescribeTrailsResponse Int
pHttpStatus_ =
DescribeTrailsResponse' :: Maybe [Trail] -> Int -> DescribeTrailsResponse
DescribeTrailsResponse'
{ $sel:trailList:DescribeTrailsResponse' :: Maybe [Trail]
trailList =
Maybe [Trail]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeTrailsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeTrailsResponse_trailList :: Lens.Lens' DescribeTrailsResponse (Prelude.Maybe [Trail])
describeTrailsResponse_trailList :: (Maybe [Trail] -> f (Maybe [Trail]))
-> DescribeTrailsResponse -> f DescribeTrailsResponse
describeTrailsResponse_trailList = (DescribeTrailsResponse -> Maybe [Trail])
-> (DescribeTrailsResponse
-> Maybe [Trail] -> DescribeTrailsResponse)
-> Lens
DescribeTrailsResponse
DescribeTrailsResponse
(Maybe [Trail])
(Maybe [Trail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrailsResponse' {Maybe [Trail]
trailList :: Maybe [Trail]
$sel:trailList:DescribeTrailsResponse' :: DescribeTrailsResponse -> Maybe [Trail]
trailList} -> Maybe [Trail]
trailList) (\s :: DescribeTrailsResponse
s@DescribeTrailsResponse' {} Maybe [Trail]
a -> DescribeTrailsResponse
s {$sel:trailList:DescribeTrailsResponse' :: Maybe [Trail]
trailList = Maybe [Trail]
a} :: DescribeTrailsResponse) ((Maybe [Trail] -> f (Maybe [Trail]))
-> DescribeTrailsResponse -> f DescribeTrailsResponse)
-> ((Maybe [Trail] -> f (Maybe [Trail]))
-> Maybe [Trail] -> f (Maybe [Trail]))
-> (Maybe [Trail] -> f (Maybe [Trail]))
-> DescribeTrailsResponse
-> f DescribeTrailsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Trail] [Trail] [Trail] [Trail]
-> Iso
(Maybe [Trail]) (Maybe [Trail]) (Maybe [Trail]) (Maybe [Trail])
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 [Trail] [Trail] [Trail] [Trail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeTrailsResponse_httpStatus :: Lens.Lens' DescribeTrailsResponse Prelude.Int
describeTrailsResponse_httpStatus :: (Int -> f Int)
-> DescribeTrailsResponse -> f DescribeTrailsResponse
describeTrailsResponse_httpStatus = (DescribeTrailsResponse -> Int)
-> (DescribeTrailsResponse -> Int -> DescribeTrailsResponse)
-> Lens DescribeTrailsResponse DescribeTrailsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrailsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTrailsResponse' :: DescribeTrailsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTrailsResponse
s@DescribeTrailsResponse' {} Int
a -> DescribeTrailsResponse
s {$sel:httpStatus:DescribeTrailsResponse' :: Int
httpStatus = Int
a} :: DescribeTrailsResponse)
instance Prelude.NFData DescribeTrailsResponse