{-# 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.GetInsightSelectors
(
GetInsightSelectors (..),
newGetInsightSelectors,
getInsightSelectors_trailName,
GetInsightSelectorsResponse (..),
newGetInsightSelectorsResponse,
getInsightSelectorsResponse_trailARN,
getInsightSelectorsResponse_insightSelectors,
getInsightSelectorsResponse_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 GetInsightSelectors = GetInsightSelectors'
{
GetInsightSelectors -> Text
trailName :: Prelude.Text
}
deriving (GetInsightSelectors -> GetInsightSelectors -> Bool
(GetInsightSelectors -> GetInsightSelectors -> Bool)
-> (GetInsightSelectors -> GetInsightSelectors -> Bool)
-> Eq GetInsightSelectors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightSelectors -> GetInsightSelectors -> Bool
$c/= :: GetInsightSelectors -> GetInsightSelectors -> Bool
== :: GetInsightSelectors -> GetInsightSelectors -> Bool
$c== :: GetInsightSelectors -> GetInsightSelectors -> Bool
Prelude.Eq, ReadPrec [GetInsightSelectors]
ReadPrec GetInsightSelectors
Int -> ReadS GetInsightSelectors
ReadS [GetInsightSelectors]
(Int -> ReadS GetInsightSelectors)
-> ReadS [GetInsightSelectors]
-> ReadPrec GetInsightSelectors
-> ReadPrec [GetInsightSelectors]
-> Read GetInsightSelectors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightSelectors]
$creadListPrec :: ReadPrec [GetInsightSelectors]
readPrec :: ReadPrec GetInsightSelectors
$creadPrec :: ReadPrec GetInsightSelectors
readList :: ReadS [GetInsightSelectors]
$creadList :: ReadS [GetInsightSelectors]
readsPrec :: Int -> ReadS GetInsightSelectors
$creadsPrec :: Int -> ReadS GetInsightSelectors
Prelude.Read, Int -> GetInsightSelectors -> ShowS
[GetInsightSelectors] -> ShowS
GetInsightSelectors -> String
(Int -> GetInsightSelectors -> ShowS)
-> (GetInsightSelectors -> String)
-> ([GetInsightSelectors] -> ShowS)
-> Show GetInsightSelectors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightSelectors] -> ShowS
$cshowList :: [GetInsightSelectors] -> ShowS
show :: GetInsightSelectors -> String
$cshow :: GetInsightSelectors -> String
showsPrec :: Int -> GetInsightSelectors -> ShowS
$cshowsPrec :: Int -> GetInsightSelectors -> ShowS
Prelude.Show, (forall x. GetInsightSelectors -> Rep GetInsightSelectors x)
-> (forall x. Rep GetInsightSelectors x -> GetInsightSelectors)
-> Generic GetInsightSelectors
forall x. Rep GetInsightSelectors x -> GetInsightSelectors
forall x. GetInsightSelectors -> Rep GetInsightSelectors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInsightSelectors x -> GetInsightSelectors
$cfrom :: forall x. GetInsightSelectors -> Rep GetInsightSelectors x
Prelude.Generic)
newGetInsightSelectors ::
Prelude.Text ->
GetInsightSelectors
newGetInsightSelectors :: Text -> GetInsightSelectors
newGetInsightSelectors Text
pTrailName_ =
GetInsightSelectors' :: Text -> GetInsightSelectors
GetInsightSelectors' {$sel:trailName:GetInsightSelectors' :: Text
trailName = Text
pTrailName_}
getInsightSelectors_trailName :: Lens.Lens' GetInsightSelectors Prelude.Text
getInsightSelectors_trailName :: (Text -> f Text) -> GetInsightSelectors -> f GetInsightSelectors
getInsightSelectors_trailName = (GetInsightSelectors -> Text)
-> (GetInsightSelectors -> Text -> GetInsightSelectors)
-> Lens GetInsightSelectors GetInsightSelectors Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSelectors' {Text
trailName :: Text
$sel:trailName:GetInsightSelectors' :: GetInsightSelectors -> Text
trailName} -> Text
trailName) (\s :: GetInsightSelectors
s@GetInsightSelectors' {} Text
a -> GetInsightSelectors
s {$sel:trailName:GetInsightSelectors' :: Text
trailName = Text
a} :: GetInsightSelectors)
instance Core.AWSRequest GetInsightSelectors where
type
AWSResponse GetInsightSelectors =
GetInsightSelectorsResponse
request :: GetInsightSelectors -> Request GetInsightSelectors
request = Service -> GetInsightSelectors -> Request GetInsightSelectors
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetInsightSelectors
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInsightSelectors)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInsightSelectors))
-> Logger
-> Service
-> Proxy GetInsightSelectors
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInsightSelectors)))
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 Text
-> Maybe [InsightSelector] -> Int -> GetInsightSelectorsResponse
GetInsightSelectorsResponse'
(Maybe Text
-> Maybe [InsightSelector] -> Int -> GetInsightSelectorsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [InsightSelector] -> Int -> GetInsightSelectorsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TrailARN")
Either
String
(Maybe [InsightSelector] -> Int -> GetInsightSelectorsResponse)
-> Either String (Maybe [InsightSelector])
-> Either String (Int -> GetInsightSelectorsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [InsightSelector]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InsightSelectors"
Either String (Maybe (Maybe [InsightSelector]))
-> Maybe [InsightSelector]
-> Either String (Maybe [InsightSelector])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [InsightSelector]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> GetInsightSelectorsResponse)
-> Either String Int -> Either String GetInsightSelectorsResponse
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 GetInsightSelectors
instance Prelude.NFData GetInsightSelectors
instance Core.ToHeaders GetInsightSelectors where
toHeaders :: GetInsightSelectors -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetInsightSelectors -> 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.GetInsightSelectors" ::
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 GetInsightSelectors where
toJSON :: GetInsightSelectors -> Value
toJSON GetInsightSelectors' {Text
trailName :: Text
$sel:trailName:GetInsightSelectors' :: GetInsightSelectors -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TrailName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
trailName)]
)
instance Core.ToPath GetInsightSelectors where
toPath :: GetInsightSelectors -> ByteString
toPath = ByteString -> GetInsightSelectors -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetInsightSelectors where
toQuery :: GetInsightSelectors -> QueryString
toQuery = QueryString -> GetInsightSelectors -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetInsightSelectorsResponse = GetInsightSelectorsResponse'
{
GetInsightSelectorsResponse -> Maybe Text
trailARN :: Prelude.Maybe Prelude.Text,
GetInsightSelectorsResponse -> Maybe [InsightSelector]
insightSelectors :: Prelude.Maybe [InsightSelector],
GetInsightSelectorsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetInsightSelectorsResponse -> GetInsightSelectorsResponse -> Bool
(GetInsightSelectorsResponse
-> GetInsightSelectorsResponse -> Bool)
-> (GetInsightSelectorsResponse
-> GetInsightSelectorsResponse -> Bool)
-> Eq GetInsightSelectorsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightSelectorsResponse -> GetInsightSelectorsResponse -> Bool
$c/= :: GetInsightSelectorsResponse -> GetInsightSelectorsResponse -> Bool
== :: GetInsightSelectorsResponse -> GetInsightSelectorsResponse -> Bool
$c== :: GetInsightSelectorsResponse -> GetInsightSelectorsResponse -> Bool
Prelude.Eq, ReadPrec [GetInsightSelectorsResponse]
ReadPrec GetInsightSelectorsResponse
Int -> ReadS GetInsightSelectorsResponse
ReadS [GetInsightSelectorsResponse]
(Int -> ReadS GetInsightSelectorsResponse)
-> ReadS [GetInsightSelectorsResponse]
-> ReadPrec GetInsightSelectorsResponse
-> ReadPrec [GetInsightSelectorsResponse]
-> Read GetInsightSelectorsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightSelectorsResponse]
$creadListPrec :: ReadPrec [GetInsightSelectorsResponse]
readPrec :: ReadPrec GetInsightSelectorsResponse
$creadPrec :: ReadPrec GetInsightSelectorsResponse
readList :: ReadS [GetInsightSelectorsResponse]
$creadList :: ReadS [GetInsightSelectorsResponse]
readsPrec :: Int -> ReadS GetInsightSelectorsResponse
$creadsPrec :: Int -> ReadS GetInsightSelectorsResponse
Prelude.Read, Int -> GetInsightSelectorsResponse -> ShowS
[GetInsightSelectorsResponse] -> ShowS
GetInsightSelectorsResponse -> String
(Int -> GetInsightSelectorsResponse -> ShowS)
-> (GetInsightSelectorsResponse -> String)
-> ([GetInsightSelectorsResponse] -> ShowS)
-> Show GetInsightSelectorsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightSelectorsResponse] -> ShowS
$cshowList :: [GetInsightSelectorsResponse] -> ShowS
show :: GetInsightSelectorsResponse -> String
$cshow :: GetInsightSelectorsResponse -> String
showsPrec :: Int -> GetInsightSelectorsResponse -> ShowS
$cshowsPrec :: Int -> GetInsightSelectorsResponse -> ShowS
Prelude.Show, (forall x.
GetInsightSelectorsResponse -> Rep GetInsightSelectorsResponse x)
-> (forall x.
Rep GetInsightSelectorsResponse x -> GetInsightSelectorsResponse)
-> Generic GetInsightSelectorsResponse
forall x.
Rep GetInsightSelectorsResponse x -> GetInsightSelectorsResponse
forall x.
GetInsightSelectorsResponse -> Rep GetInsightSelectorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInsightSelectorsResponse x -> GetInsightSelectorsResponse
$cfrom :: forall x.
GetInsightSelectorsResponse -> Rep GetInsightSelectorsResponse x
Prelude.Generic)
newGetInsightSelectorsResponse ::
Prelude.Int ->
GetInsightSelectorsResponse
newGetInsightSelectorsResponse :: Int -> GetInsightSelectorsResponse
newGetInsightSelectorsResponse Int
pHttpStatus_ =
GetInsightSelectorsResponse' :: Maybe Text
-> Maybe [InsightSelector] -> Int -> GetInsightSelectorsResponse
GetInsightSelectorsResponse'
{ $sel:trailARN:GetInsightSelectorsResponse' :: Maybe Text
trailARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:insightSelectors:GetInsightSelectorsResponse' :: Maybe [InsightSelector]
insightSelectors = Maybe [InsightSelector]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetInsightSelectorsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getInsightSelectorsResponse_trailARN :: Lens.Lens' GetInsightSelectorsResponse (Prelude.Maybe Prelude.Text)
getInsightSelectorsResponse_trailARN :: (Maybe Text -> f (Maybe Text))
-> GetInsightSelectorsResponse -> f GetInsightSelectorsResponse
getInsightSelectorsResponse_trailARN = (GetInsightSelectorsResponse -> Maybe Text)
-> (GetInsightSelectorsResponse
-> Maybe Text -> GetInsightSelectorsResponse)
-> Lens
GetInsightSelectorsResponse
GetInsightSelectorsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSelectorsResponse' {Maybe Text
trailARN :: Maybe Text
$sel:trailARN:GetInsightSelectorsResponse' :: GetInsightSelectorsResponse -> Maybe Text
trailARN} -> Maybe Text
trailARN) (\s :: GetInsightSelectorsResponse
s@GetInsightSelectorsResponse' {} Maybe Text
a -> GetInsightSelectorsResponse
s {$sel:trailARN:GetInsightSelectorsResponse' :: Maybe Text
trailARN = Maybe Text
a} :: GetInsightSelectorsResponse)
getInsightSelectorsResponse_insightSelectors :: Lens.Lens' GetInsightSelectorsResponse (Prelude.Maybe [InsightSelector])
getInsightSelectorsResponse_insightSelectors :: (Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> GetInsightSelectorsResponse -> f GetInsightSelectorsResponse
getInsightSelectorsResponse_insightSelectors = (GetInsightSelectorsResponse -> Maybe [InsightSelector])
-> (GetInsightSelectorsResponse
-> Maybe [InsightSelector] -> GetInsightSelectorsResponse)
-> Lens
GetInsightSelectorsResponse
GetInsightSelectorsResponse
(Maybe [InsightSelector])
(Maybe [InsightSelector])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSelectorsResponse' {Maybe [InsightSelector]
insightSelectors :: Maybe [InsightSelector]
$sel:insightSelectors:GetInsightSelectorsResponse' :: GetInsightSelectorsResponse -> Maybe [InsightSelector]
insightSelectors} -> Maybe [InsightSelector]
insightSelectors) (\s :: GetInsightSelectorsResponse
s@GetInsightSelectorsResponse' {} Maybe [InsightSelector]
a -> GetInsightSelectorsResponse
s {$sel:insightSelectors:GetInsightSelectorsResponse' :: Maybe [InsightSelector]
insightSelectors = Maybe [InsightSelector]
a} :: GetInsightSelectorsResponse) ((Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> GetInsightSelectorsResponse -> f GetInsightSelectorsResponse)
-> ((Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> (Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> GetInsightSelectorsResponse
-> f GetInsightSelectorsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[InsightSelector]
[InsightSelector]
[InsightSelector]
[InsightSelector]
-> Iso
(Maybe [InsightSelector])
(Maybe [InsightSelector])
(Maybe [InsightSelector])
(Maybe [InsightSelector])
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
[InsightSelector]
[InsightSelector]
[InsightSelector]
[InsightSelector]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getInsightSelectorsResponse_httpStatus :: Lens.Lens' GetInsightSelectorsResponse Prelude.Int
getInsightSelectorsResponse_httpStatus :: (Int -> f Int)
-> GetInsightSelectorsResponse -> f GetInsightSelectorsResponse
getInsightSelectorsResponse_httpStatus = (GetInsightSelectorsResponse -> Int)
-> (GetInsightSelectorsResponse
-> Int -> GetInsightSelectorsResponse)
-> Lens
GetInsightSelectorsResponse GetInsightSelectorsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSelectorsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInsightSelectorsResponse' :: GetInsightSelectorsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInsightSelectorsResponse
s@GetInsightSelectorsResponse' {} Int
a -> GetInsightSelectorsResponse
s {$sel:httpStatus:GetInsightSelectorsResponse' :: Int
httpStatus = Int
a} :: GetInsightSelectorsResponse)
instance Prelude.NFData GetInsightSelectorsResponse