{-# 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.Personalize.DescribeEventTracker
(
DescribeEventTracker (..),
newDescribeEventTracker,
describeEventTracker_eventTrackerArn,
DescribeEventTrackerResponse (..),
newDescribeEventTrackerResponse,
describeEventTrackerResponse_eventTracker,
describeEventTrackerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeEventTracker = DescribeEventTracker'
{
DescribeEventTracker -> Text
eventTrackerArn :: Prelude.Text
}
deriving (DescribeEventTracker -> DescribeEventTracker -> Bool
(DescribeEventTracker -> DescribeEventTracker -> Bool)
-> (DescribeEventTracker -> DescribeEventTracker -> Bool)
-> Eq DescribeEventTracker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventTracker -> DescribeEventTracker -> Bool
$c/= :: DescribeEventTracker -> DescribeEventTracker -> Bool
== :: DescribeEventTracker -> DescribeEventTracker -> Bool
$c== :: DescribeEventTracker -> DescribeEventTracker -> Bool
Prelude.Eq, ReadPrec [DescribeEventTracker]
ReadPrec DescribeEventTracker
Int -> ReadS DescribeEventTracker
ReadS [DescribeEventTracker]
(Int -> ReadS DescribeEventTracker)
-> ReadS [DescribeEventTracker]
-> ReadPrec DescribeEventTracker
-> ReadPrec [DescribeEventTracker]
-> Read DescribeEventTracker
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventTracker]
$creadListPrec :: ReadPrec [DescribeEventTracker]
readPrec :: ReadPrec DescribeEventTracker
$creadPrec :: ReadPrec DescribeEventTracker
readList :: ReadS [DescribeEventTracker]
$creadList :: ReadS [DescribeEventTracker]
readsPrec :: Int -> ReadS DescribeEventTracker
$creadsPrec :: Int -> ReadS DescribeEventTracker
Prelude.Read, Int -> DescribeEventTracker -> ShowS
[DescribeEventTracker] -> ShowS
DescribeEventTracker -> String
(Int -> DescribeEventTracker -> ShowS)
-> (DescribeEventTracker -> String)
-> ([DescribeEventTracker] -> ShowS)
-> Show DescribeEventTracker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventTracker] -> ShowS
$cshowList :: [DescribeEventTracker] -> ShowS
show :: DescribeEventTracker -> String
$cshow :: DescribeEventTracker -> String
showsPrec :: Int -> DescribeEventTracker -> ShowS
$cshowsPrec :: Int -> DescribeEventTracker -> ShowS
Prelude.Show, (forall x. DescribeEventTracker -> Rep DescribeEventTracker x)
-> (forall x. Rep DescribeEventTracker x -> DescribeEventTracker)
-> Generic DescribeEventTracker
forall x. Rep DescribeEventTracker x -> DescribeEventTracker
forall x. DescribeEventTracker -> Rep DescribeEventTracker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEventTracker x -> DescribeEventTracker
$cfrom :: forall x. DescribeEventTracker -> Rep DescribeEventTracker x
Prelude.Generic)
newDescribeEventTracker ::
Prelude.Text ->
DescribeEventTracker
newDescribeEventTracker :: Text -> DescribeEventTracker
newDescribeEventTracker Text
pEventTrackerArn_ =
DescribeEventTracker' :: Text -> DescribeEventTracker
DescribeEventTracker'
{ $sel:eventTrackerArn:DescribeEventTracker' :: Text
eventTrackerArn =
Text
pEventTrackerArn_
}
describeEventTracker_eventTrackerArn :: Lens.Lens' DescribeEventTracker Prelude.Text
describeEventTracker_eventTrackerArn :: (Text -> f Text) -> DescribeEventTracker -> f DescribeEventTracker
describeEventTracker_eventTrackerArn = (DescribeEventTracker -> Text)
-> (DescribeEventTracker -> Text -> DescribeEventTracker)
-> Lens DescribeEventTracker DescribeEventTracker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTracker' {Text
eventTrackerArn :: Text
$sel:eventTrackerArn:DescribeEventTracker' :: DescribeEventTracker -> Text
eventTrackerArn} -> Text
eventTrackerArn) (\s :: DescribeEventTracker
s@DescribeEventTracker' {} Text
a -> DescribeEventTracker
s {$sel:eventTrackerArn:DescribeEventTracker' :: Text
eventTrackerArn = Text
a} :: DescribeEventTracker)
instance Core.AWSRequest DescribeEventTracker where
type
AWSResponse DescribeEventTracker =
DescribeEventTrackerResponse
request :: DescribeEventTracker -> Request DescribeEventTracker
request = Service -> DescribeEventTracker -> Request DescribeEventTracker
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeEventTracker
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeEventTracker)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeEventTracker))
-> Logger
-> Service
-> Proxy DescribeEventTracker
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeEventTracker)))
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 EventTracker -> Int -> DescribeEventTrackerResponse
DescribeEventTrackerResponse'
(Maybe EventTracker -> Int -> DescribeEventTrackerResponse)
-> Either String (Maybe EventTracker)
-> Either String (Int -> DescribeEventTrackerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe EventTracker)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"eventTracker")
Either String (Int -> DescribeEventTrackerResponse)
-> Either String Int -> Either String DescribeEventTrackerResponse
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 DescribeEventTracker
instance Prelude.NFData DescribeEventTracker
instance Core.ToHeaders DescribeEventTracker where
toHeaders :: DescribeEventTracker -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeEventTracker -> 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
"AmazonPersonalize.DescribeEventTracker" ::
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 DescribeEventTracker where
toJSON :: DescribeEventTracker -> Value
toJSON DescribeEventTracker' {Text
eventTrackerArn :: Text
$sel:eventTrackerArn:DescribeEventTracker' :: DescribeEventTracker -> 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
"eventTrackerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventTrackerArn)
]
)
instance Core.ToPath DescribeEventTracker where
toPath :: DescribeEventTracker -> ByteString
toPath = ByteString -> DescribeEventTracker -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeEventTracker where
toQuery :: DescribeEventTracker -> QueryString
toQuery = QueryString -> DescribeEventTracker -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeEventTrackerResponse = DescribeEventTrackerResponse'
{
DescribeEventTrackerResponse -> Maybe EventTracker
eventTracker :: Prelude.Maybe EventTracker,
DescribeEventTrackerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeEventTrackerResponse
-> DescribeEventTrackerResponse -> Bool
(DescribeEventTrackerResponse
-> DescribeEventTrackerResponse -> Bool)
-> (DescribeEventTrackerResponse
-> DescribeEventTrackerResponse -> Bool)
-> Eq DescribeEventTrackerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventTrackerResponse
-> DescribeEventTrackerResponse -> Bool
$c/= :: DescribeEventTrackerResponse
-> DescribeEventTrackerResponse -> Bool
== :: DescribeEventTrackerResponse
-> DescribeEventTrackerResponse -> Bool
$c== :: DescribeEventTrackerResponse
-> DescribeEventTrackerResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEventTrackerResponse]
ReadPrec DescribeEventTrackerResponse
Int -> ReadS DescribeEventTrackerResponse
ReadS [DescribeEventTrackerResponse]
(Int -> ReadS DescribeEventTrackerResponse)
-> ReadS [DescribeEventTrackerResponse]
-> ReadPrec DescribeEventTrackerResponse
-> ReadPrec [DescribeEventTrackerResponse]
-> Read DescribeEventTrackerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventTrackerResponse]
$creadListPrec :: ReadPrec [DescribeEventTrackerResponse]
readPrec :: ReadPrec DescribeEventTrackerResponse
$creadPrec :: ReadPrec DescribeEventTrackerResponse
readList :: ReadS [DescribeEventTrackerResponse]
$creadList :: ReadS [DescribeEventTrackerResponse]
readsPrec :: Int -> ReadS DescribeEventTrackerResponse
$creadsPrec :: Int -> ReadS DescribeEventTrackerResponse
Prelude.Read, Int -> DescribeEventTrackerResponse -> ShowS
[DescribeEventTrackerResponse] -> ShowS
DescribeEventTrackerResponse -> String
(Int -> DescribeEventTrackerResponse -> ShowS)
-> (DescribeEventTrackerResponse -> String)
-> ([DescribeEventTrackerResponse] -> ShowS)
-> Show DescribeEventTrackerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventTrackerResponse] -> ShowS
$cshowList :: [DescribeEventTrackerResponse] -> ShowS
show :: DescribeEventTrackerResponse -> String
$cshow :: DescribeEventTrackerResponse -> String
showsPrec :: Int -> DescribeEventTrackerResponse -> ShowS
$cshowsPrec :: Int -> DescribeEventTrackerResponse -> ShowS
Prelude.Show, (forall x.
DescribeEventTrackerResponse -> Rep DescribeEventTrackerResponse x)
-> (forall x.
Rep DescribeEventTrackerResponse x -> DescribeEventTrackerResponse)
-> Generic DescribeEventTrackerResponse
forall x.
Rep DescribeEventTrackerResponse x -> DescribeEventTrackerResponse
forall x.
DescribeEventTrackerResponse -> Rep DescribeEventTrackerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventTrackerResponse x -> DescribeEventTrackerResponse
$cfrom :: forall x.
DescribeEventTrackerResponse -> Rep DescribeEventTrackerResponse x
Prelude.Generic)
newDescribeEventTrackerResponse ::
Prelude.Int ->
DescribeEventTrackerResponse
newDescribeEventTrackerResponse :: Int -> DescribeEventTrackerResponse
newDescribeEventTrackerResponse Int
pHttpStatus_ =
DescribeEventTrackerResponse' :: Maybe EventTracker -> Int -> DescribeEventTrackerResponse
DescribeEventTrackerResponse'
{ $sel:eventTracker:DescribeEventTrackerResponse' :: Maybe EventTracker
eventTracker =
Maybe EventTracker
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeEventTrackerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeEventTrackerResponse_eventTracker :: Lens.Lens' DescribeEventTrackerResponse (Prelude.Maybe EventTracker)
describeEventTrackerResponse_eventTracker :: (Maybe EventTracker -> f (Maybe EventTracker))
-> DescribeEventTrackerResponse -> f DescribeEventTrackerResponse
describeEventTrackerResponse_eventTracker = (DescribeEventTrackerResponse -> Maybe EventTracker)
-> (DescribeEventTrackerResponse
-> Maybe EventTracker -> DescribeEventTrackerResponse)
-> Lens
DescribeEventTrackerResponse
DescribeEventTrackerResponse
(Maybe EventTracker)
(Maybe EventTracker)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTrackerResponse' {Maybe EventTracker
eventTracker :: Maybe EventTracker
$sel:eventTracker:DescribeEventTrackerResponse' :: DescribeEventTrackerResponse -> Maybe EventTracker
eventTracker} -> Maybe EventTracker
eventTracker) (\s :: DescribeEventTrackerResponse
s@DescribeEventTrackerResponse' {} Maybe EventTracker
a -> DescribeEventTrackerResponse
s {$sel:eventTracker:DescribeEventTrackerResponse' :: Maybe EventTracker
eventTracker = Maybe EventTracker
a} :: DescribeEventTrackerResponse)
describeEventTrackerResponse_httpStatus :: Lens.Lens' DescribeEventTrackerResponse Prelude.Int
describeEventTrackerResponse_httpStatus :: (Int -> f Int)
-> DescribeEventTrackerResponse -> f DescribeEventTrackerResponse
describeEventTrackerResponse_httpStatus = (DescribeEventTrackerResponse -> Int)
-> (DescribeEventTrackerResponse
-> Int -> DescribeEventTrackerResponse)
-> Lens
DescribeEventTrackerResponse DescribeEventTrackerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTrackerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeEventTrackerResponse' :: DescribeEventTrackerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeEventTrackerResponse
s@DescribeEventTrackerResponse' {} Int
a -> DescribeEventTrackerResponse
s {$sel:httpStatus:DescribeEventTrackerResponse' :: Int
httpStatus = Int
a} :: DescribeEventTrackerResponse)
instance Prelude.NFData DescribeEventTrackerResponse