{-# 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.XRay.GetInsightEvents
(
GetInsightEvents (..),
newGetInsightEvents,
getInsightEvents_nextToken,
getInsightEvents_maxResults,
getInsightEvents_insightId,
GetInsightEventsResponse (..),
newGetInsightEventsResponse,
getInsightEventsResponse_insightEvents,
getInsightEventsResponse_nextToken,
getInsightEventsResponse_httpStatus,
)
where
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
import Amazonka.XRay.Types
data GetInsightEvents = GetInsightEvents'
{
GetInsightEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetInsightEvents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetInsightEvents -> Text
insightId :: Prelude.Text
}
deriving (GetInsightEvents -> GetInsightEvents -> Bool
(GetInsightEvents -> GetInsightEvents -> Bool)
-> (GetInsightEvents -> GetInsightEvents -> Bool)
-> Eq GetInsightEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightEvents -> GetInsightEvents -> Bool
$c/= :: GetInsightEvents -> GetInsightEvents -> Bool
== :: GetInsightEvents -> GetInsightEvents -> Bool
$c== :: GetInsightEvents -> GetInsightEvents -> Bool
Prelude.Eq, ReadPrec [GetInsightEvents]
ReadPrec GetInsightEvents
Int -> ReadS GetInsightEvents
ReadS [GetInsightEvents]
(Int -> ReadS GetInsightEvents)
-> ReadS [GetInsightEvents]
-> ReadPrec GetInsightEvents
-> ReadPrec [GetInsightEvents]
-> Read GetInsightEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightEvents]
$creadListPrec :: ReadPrec [GetInsightEvents]
readPrec :: ReadPrec GetInsightEvents
$creadPrec :: ReadPrec GetInsightEvents
readList :: ReadS [GetInsightEvents]
$creadList :: ReadS [GetInsightEvents]
readsPrec :: Int -> ReadS GetInsightEvents
$creadsPrec :: Int -> ReadS GetInsightEvents
Prelude.Read, Int -> GetInsightEvents -> ShowS
[GetInsightEvents] -> ShowS
GetInsightEvents -> String
(Int -> GetInsightEvents -> ShowS)
-> (GetInsightEvents -> String)
-> ([GetInsightEvents] -> ShowS)
-> Show GetInsightEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightEvents] -> ShowS
$cshowList :: [GetInsightEvents] -> ShowS
show :: GetInsightEvents -> String
$cshow :: GetInsightEvents -> String
showsPrec :: Int -> GetInsightEvents -> ShowS
$cshowsPrec :: Int -> GetInsightEvents -> ShowS
Prelude.Show, (forall x. GetInsightEvents -> Rep GetInsightEvents x)
-> (forall x. Rep GetInsightEvents x -> GetInsightEvents)
-> Generic GetInsightEvents
forall x. Rep GetInsightEvents x -> GetInsightEvents
forall x. GetInsightEvents -> Rep GetInsightEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInsightEvents x -> GetInsightEvents
$cfrom :: forall x. GetInsightEvents -> Rep GetInsightEvents x
Prelude.Generic)
newGetInsightEvents ::
Prelude.Text ->
GetInsightEvents
newGetInsightEvents :: Text -> GetInsightEvents
newGetInsightEvents Text
pInsightId_ =
GetInsightEvents' :: Maybe Text -> Maybe Natural -> Text -> GetInsightEvents
GetInsightEvents'
{ $sel:nextToken:GetInsightEvents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetInsightEvents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:insightId:GetInsightEvents' :: Text
insightId = Text
pInsightId_
}
getInsightEvents_nextToken :: Lens.Lens' GetInsightEvents (Prelude.Maybe Prelude.Text)
getInsightEvents_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetInsightEvents -> f GetInsightEvents
getInsightEvents_nextToken = (GetInsightEvents -> Maybe Text)
-> (GetInsightEvents -> Maybe Text -> GetInsightEvents)
-> Lens GetInsightEvents GetInsightEvents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightEvents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetInsightEvents' :: GetInsightEvents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetInsightEvents
s@GetInsightEvents' {} Maybe Text
a -> GetInsightEvents
s {$sel:nextToken:GetInsightEvents' :: Maybe Text
nextToken = Maybe Text
a} :: GetInsightEvents)
getInsightEvents_maxResults :: Lens.Lens' GetInsightEvents (Prelude.Maybe Prelude.Natural)
getInsightEvents_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetInsightEvents -> f GetInsightEvents
getInsightEvents_maxResults = (GetInsightEvents -> Maybe Natural)
-> (GetInsightEvents -> Maybe Natural -> GetInsightEvents)
-> Lens
GetInsightEvents GetInsightEvents (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightEvents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetInsightEvents' :: GetInsightEvents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetInsightEvents
s@GetInsightEvents' {} Maybe Natural
a -> GetInsightEvents
s {$sel:maxResults:GetInsightEvents' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetInsightEvents)
getInsightEvents_insightId :: Lens.Lens' GetInsightEvents Prelude.Text
getInsightEvents_insightId :: (Text -> f Text) -> GetInsightEvents -> f GetInsightEvents
getInsightEvents_insightId = (GetInsightEvents -> Text)
-> (GetInsightEvents -> Text -> GetInsightEvents)
-> Lens GetInsightEvents GetInsightEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightEvents' {Text
insightId :: Text
$sel:insightId:GetInsightEvents' :: GetInsightEvents -> Text
insightId} -> Text
insightId) (\s :: GetInsightEvents
s@GetInsightEvents' {} Text
a -> GetInsightEvents
s {$sel:insightId:GetInsightEvents' :: Text
insightId = Text
a} :: GetInsightEvents)
instance Core.AWSRequest GetInsightEvents where
type
AWSResponse GetInsightEvents =
GetInsightEventsResponse
request :: GetInsightEvents -> Request GetInsightEvents
request = Service -> GetInsightEvents -> Request GetInsightEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetInsightEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInsightEvents)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInsightEvents))
-> Logger
-> Service
-> Proxy GetInsightEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInsightEvents)))
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 [InsightEvent]
-> Maybe Text -> Int -> GetInsightEventsResponse
GetInsightEventsResponse'
(Maybe [InsightEvent]
-> Maybe Text -> Int -> GetInsightEventsResponse)
-> Either String (Maybe [InsightEvent])
-> Either String (Maybe Text -> Int -> GetInsightEventsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [InsightEvent]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InsightEvents" Either String (Maybe (Maybe [InsightEvent]))
-> Maybe [InsightEvent] -> Either String (Maybe [InsightEvent])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [InsightEvent]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> GetInsightEventsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetInsightEventsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"NextToken")
Either String (Int -> GetInsightEventsResponse)
-> Either String Int -> Either String GetInsightEventsResponse
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 GetInsightEvents
instance Prelude.NFData GetInsightEvents
instance Core.ToHeaders GetInsightEvents where
toHeaders :: GetInsightEvents -> ResponseHeaders
toHeaders = ResponseHeaders -> GetInsightEvents -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON GetInsightEvents where
toJSON :: GetInsightEvents -> Value
toJSON GetInsightEvents' {Maybe Natural
Maybe Text
Text
insightId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:insightId:GetInsightEvents' :: GetInsightEvents -> Text
$sel:maxResults:GetInsightEvents' :: GetInsightEvents -> Maybe Natural
$sel:nextToken:GetInsightEvents' :: GetInsightEvents -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" 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
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InsightId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
insightId)
]
)
instance Core.ToPath GetInsightEvents where
toPath :: GetInsightEvents -> ByteString
toPath = ByteString -> GetInsightEvents -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/InsightEvents"
instance Core.ToQuery GetInsightEvents where
toQuery :: GetInsightEvents -> QueryString
toQuery = QueryString -> GetInsightEvents -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetInsightEventsResponse = GetInsightEventsResponse'
{
GetInsightEventsResponse -> Maybe [InsightEvent]
insightEvents :: Prelude.Maybe [InsightEvent],
GetInsightEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetInsightEventsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetInsightEventsResponse -> GetInsightEventsResponse -> Bool
(GetInsightEventsResponse -> GetInsightEventsResponse -> Bool)
-> (GetInsightEventsResponse -> GetInsightEventsResponse -> Bool)
-> Eq GetInsightEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightEventsResponse -> GetInsightEventsResponse -> Bool
$c/= :: GetInsightEventsResponse -> GetInsightEventsResponse -> Bool
== :: GetInsightEventsResponse -> GetInsightEventsResponse -> Bool
$c== :: GetInsightEventsResponse -> GetInsightEventsResponse -> Bool
Prelude.Eq, ReadPrec [GetInsightEventsResponse]
ReadPrec GetInsightEventsResponse
Int -> ReadS GetInsightEventsResponse
ReadS [GetInsightEventsResponse]
(Int -> ReadS GetInsightEventsResponse)
-> ReadS [GetInsightEventsResponse]
-> ReadPrec GetInsightEventsResponse
-> ReadPrec [GetInsightEventsResponse]
-> Read GetInsightEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightEventsResponse]
$creadListPrec :: ReadPrec [GetInsightEventsResponse]
readPrec :: ReadPrec GetInsightEventsResponse
$creadPrec :: ReadPrec GetInsightEventsResponse
readList :: ReadS [GetInsightEventsResponse]
$creadList :: ReadS [GetInsightEventsResponse]
readsPrec :: Int -> ReadS GetInsightEventsResponse
$creadsPrec :: Int -> ReadS GetInsightEventsResponse
Prelude.Read, Int -> GetInsightEventsResponse -> ShowS
[GetInsightEventsResponse] -> ShowS
GetInsightEventsResponse -> String
(Int -> GetInsightEventsResponse -> ShowS)
-> (GetInsightEventsResponse -> String)
-> ([GetInsightEventsResponse] -> ShowS)
-> Show GetInsightEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightEventsResponse] -> ShowS
$cshowList :: [GetInsightEventsResponse] -> ShowS
show :: GetInsightEventsResponse -> String
$cshow :: GetInsightEventsResponse -> String
showsPrec :: Int -> GetInsightEventsResponse -> ShowS
$cshowsPrec :: Int -> GetInsightEventsResponse -> ShowS
Prelude.Show, (forall x.
GetInsightEventsResponse -> Rep GetInsightEventsResponse x)
-> (forall x.
Rep GetInsightEventsResponse x -> GetInsightEventsResponse)
-> Generic GetInsightEventsResponse
forall x.
Rep GetInsightEventsResponse x -> GetInsightEventsResponse
forall x.
GetInsightEventsResponse -> Rep GetInsightEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInsightEventsResponse x -> GetInsightEventsResponse
$cfrom :: forall x.
GetInsightEventsResponse -> Rep GetInsightEventsResponse x
Prelude.Generic)
newGetInsightEventsResponse ::
Prelude.Int ->
GetInsightEventsResponse
newGetInsightEventsResponse :: Int -> GetInsightEventsResponse
newGetInsightEventsResponse Int
pHttpStatus_ =
GetInsightEventsResponse' :: Maybe [InsightEvent]
-> Maybe Text -> Int -> GetInsightEventsResponse
GetInsightEventsResponse'
{ $sel:insightEvents:GetInsightEventsResponse' :: Maybe [InsightEvent]
insightEvents =
Maybe [InsightEvent]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetInsightEventsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetInsightEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getInsightEventsResponse_insightEvents :: Lens.Lens' GetInsightEventsResponse (Prelude.Maybe [InsightEvent])
getInsightEventsResponse_insightEvents :: (Maybe [InsightEvent] -> f (Maybe [InsightEvent]))
-> GetInsightEventsResponse -> f GetInsightEventsResponse
getInsightEventsResponse_insightEvents = (GetInsightEventsResponse -> Maybe [InsightEvent])
-> (GetInsightEventsResponse
-> Maybe [InsightEvent] -> GetInsightEventsResponse)
-> Lens
GetInsightEventsResponse
GetInsightEventsResponse
(Maybe [InsightEvent])
(Maybe [InsightEvent])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightEventsResponse' {Maybe [InsightEvent]
insightEvents :: Maybe [InsightEvent]
$sel:insightEvents:GetInsightEventsResponse' :: GetInsightEventsResponse -> Maybe [InsightEvent]
insightEvents} -> Maybe [InsightEvent]
insightEvents) (\s :: GetInsightEventsResponse
s@GetInsightEventsResponse' {} Maybe [InsightEvent]
a -> GetInsightEventsResponse
s {$sel:insightEvents:GetInsightEventsResponse' :: Maybe [InsightEvent]
insightEvents = Maybe [InsightEvent]
a} :: GetInsightEventsResponse) ((Maybe [InsightEvent] -> f (Maybe [InsightEvent]))
-> GetInsightEventsResponse -> f GetInsightEventsResponse)
-> ((Maybe [InsightEvent] -> f (Maybe [InsightEvent]))
-> Maybe [InsightEvent] -> f (Maybe [InsightEvent]))
-> (Maybe [InsightEvent] -> f (Maybe [InsightEvent]))
-> GetInsightEventsResponse
-> f GetInsightEventsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [InsightEvent] [InsightEvent] [InsightEvent] [InsightEvent]
-> Iso
(Maybe [InsightEvent])
(Maybe [InsightEvent])
(Maybe [InsightEvent])
(Maybe [InsightEvent])
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 [InsightEvent] [InsightEvent] [InsightEvent] [InsightEvent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getInsightEventsResponse_nextToken :: Lens.Lens' GetInsightEventsResponse (Prelude.Maybe Prelude.Text)
getInsightEventsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetInsightEventsResponse -> f GetInsightEventsResponse
getInsightEventsResponse_nextToken = (GetInsightEventsResponse -> Maybe Text)
-> (GetInsightEventsResponse
-> Maybe Text -> GetInsightEventsResponse)
-> Lens
GetInsightEventsResponse
GetInsightEventsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetInsightEventsResponse' :: GetInsightEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetInsightEventsResponse
s@GetInsightEventsResponse' {} Maybe Text
a -> GetInsightEventsResponse
s {$sel:nextToken:GetInsightEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetInsightEventsResponse)
getInsightEventsResponse_httpStatus :: Lens.Lens' GetInsightEventsResponse Prelude.Int
getInsightEventsResponse_httpStatus :: (Int -> f Int)
-> GetInsightEventsResponse -> f GetInsightEventsResponse
getInsightEventsResponse_httpStatus = (GetInsightEventsResponse -> Int)
-> (GetInsightEventsResponse -> Int -> GetInsightEventsResponse)
-> Lens GetInsightEventsResponse GetInsightEventsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightEventsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInsightEventsResponse' :: GetInsightEventsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInsightEventsResponse
s@GetInsightEventsResponse' {} Int
a -> GetInsightEventsResponse
s {$sel:httpStatus:GetInsightEventsResponse' :: Int
httpStatus = Int
a} :: GetInsightEventsResponse)
instance Prelude.NFData GetInsightEventsResponse