{-# 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.CreateEventTracker
(
CreateEventTracker (..),
newCreateEventTracker,
createEventTracker_name,
createEventTracker_datasetGroupArn,
CreateEventTrackerResponse (..),
newCreateEventTrackerResponse,
createEventTrackerResponse_trackingId,
createEventTrackerResponse_eventTrackerArn,
createEventTrackerResponse_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 CreateEventTracker = CreateEventTracker'
{
CreateEventTracker -> Text
name :: Prelude.Text,
CreateEventTracker -> Text
datasetGroupArn :: Prelude.Text
}
deriving (CreateEventTracker -> CreateEventTracker -> Bool
(CreateEventTracker -> CreateEventTracker -> Bool)
-> (CreateEventTracker -> CreateEventTracker -> Bool)
-> Eq CreateEventTracker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEventTracker -> CreateEventTracker -> Bool
$c/= :: CreateEventTracker -> CreateEventTracker -> Bool
== :: CreateEventTracker -> CreateEventTracker -> Bool
$c== :: CreateEventTracker -> CreateEventTracker -> Bool
Prelude.Eq, ReadPrec [CreateEventTracker]
ReadPrec CreateEventTracker
Int -> ReadS CreateEventTracker
ReadS [CreateEventTracker]
(Int -> ReadS CreateEventTracker)
-> ReadS [CreateEventTracker]
-> ReadPrec CreateEventTracker
-> ReadPrec [CreateEventTracker]
-> Read CreateEventTracker
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEventTracker]
$creadListPrec :: ReadPrec [CreateEventTracker]
readPrec :: ReadPrec CreateEventTracker
$creadPrec :: ReadPrec CreateEventTracker
readList :: ReadS [CreateEventTracker]
$creadList :: ReadS [CreateEventTracker]
readsPrec :: Int -> ReadS CreateEventTracker
$creadsPrec :: Int -> ReadS CreateEventTracker
Prelude.Read, Int -> CreateEventTracker -> ShowS
[CreateEventTracker] -> ShowS
CreateEventTracker -> String
(Int -> CreateEventTracker -> ShowS)
-> (CreateEventTracker -> String)
-> ([CreateEventTracker] -> ShowS)
-> Show CreateEventTracker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEventTracker] -> ShowS
$cshowList :: [CreateEventTracker] -> ShowS
show :: CreateEventTracker -> String
$cshow :: CreateEventTracker -> String
showsPrec :: Int -> CreateEventTracker -> ShowS
$cshowsPrec :: Int -> CreateEventTracker -> ShowS
Prelude.Show, (forall x. CreateEventTracker -> Rep CreateEventTracker x)
-> (forall x. Rep CreateEventTracker x -> CreateEventTracker)
-> Generic CreateEventTracker
forall x. Rep CreateEventTracker x -> CreateEventTracker
forall x. CreateEventTracker -> Rep CreateEventTracker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateEventTracker x -> CreateEventTracker
$cfrom :: forall x. CreateEventTracker -> Rep CreateEventTracker x
Prelude.Generic)
newCreateEventTracker ::
Prelude.Text ->
Prelude.Text ->
CreateEventTracker
newCreateEventTracker :: Text -> Text -> CreateEventTracker
newCreateEventTracker Text
pName_ Text
pDatasetGroupArn_ =
CreateEventTracker' :: Text -> Text -> CreateEventTracker
CreateEventTracker'
{ $sel:name:CreateEventTracker' :: Text
name = Text
pName_,
$sel:datasetGroupArn:CreateEventTracker' :: Text
datasetGroupArn = Text
pDatasetGroupArn_
}
createEventTracker_name :: Lens.Lens' CreateEventTracker Prelude.Text
createEventTracker_name :: (Text -> f Text) -> CreateEventTracker -> f CreateEventTracker
createEventTracker_name = (CreateEventTracker -> Text)
-> (CreateEventTracker -> Text -> CreateEventTracker)
-> Lens CreateEventTracker CreateEventTracker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventTracker' {Text
name :: Text
$sel:name:CreateEventTracker' :: CreateEventTracker -> Text
name} -> Text
name) (\s :: CreateEventTracker
s@CreateEventTracker' {} Text
a -> CreateEventTracker
s {$sel:name:CreateEventTracker' :: Text
name = Text
a} :: CreateEventTracker)
createEventTracker_datasetGroupArn :: Lens.Lens' CreateEventTracker Prelude.Text
createEventTracker_datasetGroupArn :: (Text -> f Text) -> CreateEventTracker -> f CreateEventTracker
createEventTracker_datasetGroupArn = (CreateEventTracker -> Text)
-> (CreateEventTracker -> Text -> CreateEventTracker)
-> Lens CreateEventTracker CreateEventTracker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventTracker' {Text
datasetGroupArn :: Text
$sel:datasetGroupArn:CreateEventTracker' :: CreateEventTracker -> Text
datasetGroupArn} -> Text
datasetGroupArn) (\s :: CreateEventTracker
s@CreateEventTracker' {} Text
a -> CreateEventTracker
s {$sel:datasetGroupArn:CreateEventTracker' :: Text
datasetGroupArn = Text
a} :: CreateEventTracker)
instance Core.AWSRequest CreateEventTracker where
type
AWSResponse CreateEventTracker =
CreateEventTrackerResponse
request :: CreateEventTracker -> Request CreateEventTracker
request = Service -> CreateEventTracker -> Request CreateEventTracker
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateEventTracker
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEventTracker)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateEventTracker))
-> Logger
-> Service
-> Proxy CreateEventTracker
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEventTracker)))
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 Text -> Int -> CreateEventTrackerResponse
CreateEventTrackerResponse'
(Maybe Text -> Maybe Text -> Int -> CreateEventTrackerResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateEventTrackerResponse)
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
"trackingId")
Either String (Maybe Text -> Int -> CreateEventTrackerResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateEventTrackerResponse)
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
"eventTrackerArn")
Either String (Int -> CreateEventTrackerResponse)
-> Either String Int -> Either String CreateEventTrackerResponse
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 CreateEventTracker
instance Prelude.NFData CreateEventTracker
instance Core.ToHeaders CreateEventTracker where
toHeaders :: CreateEventTracker -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateEventTracker -> 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.CreateEventTracker" ::
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 CreateEventTracker where
toJSON :: CreateEventTracker -> Value
toJSON CreateEventTracker' {Text
datasetGroupArn :: Text
name :: Text
$sel:datasetGroupArn:CreateEventTracker' :: CreateEventTracker -> Text
$sel:name:CreateEventTracker' :: CreateEventTracker -> 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"datasetGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetGroupArn)
]
)
instance Core.ToPath CreateEventTracker where
toPath :: CreateEventTracker -> ByteString
toPath = ByteString -> CreateEventTracker -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateEventTracker where
toQuery :: CreateEventTracker -> QueryString
toQuery = QueryString -> CreateEventTracker -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateEventTrackerResponse = CreateEventTrackerResponse'
{
CreateEventTrackerResponse -> Maybe Text
trackingId :: Prelude.Maybe Prelude.Text,
CreateEventTrackerResponse -> Maybe Text
eventTrackerArn :: Prelude.Maybe Prelude.Text,
CreateEventTrackerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateEventTrackerResponse -> CreateEventTrackerResponse -> Bool
(CreateEventTrackerResponse -> CreateEventTrackerResponse -> Bool)
-> (CreateEventTrackerResponse
-> CreateEventTrackerResponse -> Bool)
-> Eq CreateEventTrackerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEventTrackerResponse -> CreateEventTrackerResponse -> Bool
$c/= :: CreateEventTrackerResponse -> CreateEventTrackerResponse -> Bool
== :: CreateEventTrackerResponse -> CreateEventTrackerResponse -> Bool
$c== :: CreateEventTrackerResponse -> CreateEventTrackerResponse -> Bool
Prelude.Eq, ReadPrec [CreateEventTrackerResponse]
ReadPrec CreateEventTrackerResponse
Int -> ReadS CreateEventTrackerResponse
ReadS [CreateEventTrackerResponse]
(Int -> ReadS CreateEventTrackerResponse)
-> ReadS [CreateEventTrackerResponse]
-> ReadPrec CreateEventTrackerResponse
-> ReadPrec [CreateEventTrackerResponse]
-> Read CreateEventTrackerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEventTrackerResponse]
$creadListPrec :: ReadPrec [CreateEventTrackerResponse]
readPrec :: ReadPrec CreateEventTrackerResponse
$creadPrec :: ReadPrec CreateEventTrackerResponse
readList :: ReadS [CreateEventTrackerResponse]
$creadList :: ReadS [CreateEventTrackerResponse]
readsPrec :: Int -> ReadS CreateEventTrackerResponse
$creadsPrec :: Int -> ReadS CreateEventTrackerResponse
Prelude.Read, Int -> CreateEventTrackerResponse -> ShowS
[CreateEventTrackerResponse] -> ShowS
CreateEventTrackerResponse -> String
(Int -> CreateEventTrackerResponse -> ShowS)
-> (CreateEventTrackerResponse -> String)
-> ([CreateEventTrackerResponse] -> ShowS)
-> Show CreateEventTrackerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEventTrackerResponse] -> ShowS
$cshowList :: [CreateEventTrackerResponse] -> ShowS
show :: CreateEventTrackerResponse -> String
$cshow :: CreateEventTrackerResponse -> String
showsPrec :: Int -> CreateEventTrackerResponse -> ShowS
$cshowsPrec :: Int -> CreateEventTrackerResponse -> ShowS
Prelude.Show, (forall x.
CreateEventTrackerResponse -> Rep CreateEventTrackerResponse x)
-> (forall x.
Rep CreateEventTrackerResponse x -> CreateEventTrackerResponse)
-> Generic CreateEventTrackerResponse
forall x.
Rep CreateEventTrackerResponse x -> CreateEventTrackerResponse
forall x.
CreateEventTrackerResponse -> Rep CreateEventTrackerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEventTrackerResponse x -> CreateEventTrackerResponse
$cfrom :: forall x.
CreateEventTrackerResponse -> Rep CreateEventTrackerResponse x
Prelude.Generic)
newCreateEventTrackerResponse ::
Prelude.Int ->
CreateEventTrackerResponse
newCreateEventTrackerResponse :: Int -> CreateEventTrackerResponse
newCreateEventTrackerResponse Int
pHttpStatus_ =
CreateEventTrackerResponse' :: Maybe Text -> Maybe Text -> Int -> CreateEventTrackerResponse
CreateEventTrackerResponse'
{ $sel:trackingId:CreateEventTrackerResponse' :: Maybe Text
trackingId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventTrackerArn:CreateEventTrackerResponse' :: Maybe Text
eventTrackerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateEventTrackerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createEventTrackerResponse_trackingId :: Lens.Lens' CreateEventTrackerResponse (Prelude.Maybe Prelude.Text)
createEventTrackerResponse_trackingId :: (Maybe Text -> f (Maybe Text))
-> CreateEventTrackerResponse -> f CreateEventTrackerResponse
createEventTrackerResponse_trackingId = (CreateEventTrackerResponse -> Maybe Text)
-> (CreateEventTrackerResponse
-> Maybe Text -> CreateEventTrackerResponse)
-> Lens
CreateEventTrackerResponse
CreateEventTrackerResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventTrackerResponse' {Maybe Text
trackingId :: Maybe Text
$sel:trackingId:CreateEventTrackerResponse' :: CreateEventTrackerResponse -> Maybe Text
trackingId} -> Maybe Text
trackingId) (\s :: CreateEventTrackerResponse
s@CreateEventTrackerResponse' {} Maybe Text
a -> CreateEventTrackerResponse
s {$sel:trackingId:CreateEventTrackerResponse' :: Maybe Text
trackingId = Maybe Text
a} :: CreateEventTrackerResponse)
createEventTrackerResponse_eventTrackerArn :: Lens.Lens' CreateEventTrackerResponse (Prelude.Maybe Prelude.Text)
createEventTrackerResponse_eventTrackerArn :: (Maybe Text -> f (Maybe Text))
-> CreateEventTrackerResponse -> f CreateEventTrackerResponse
createEventTrackerResponse_eventTrackerArn = (CreateEventTrackerResponse -> Maybe Text)
-> (CreateEventTrackerResponse
-> Maybe Text -> CreateEventTrackerResponse)
-> Lens
CreateEventTrackerResponse
CreateEventTrackerResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventTrackerResponse' {Maybe Text
eventTrackerArn :: Maybe Text
$sel:eventTrackerArn:CreateEventTrackerResponse' :: CreateEventTrackerResponse -> Maybe Text
eventTrackerArn} -> Maybe Text
eventTrackerArn) (\s :: CreateEventTrackerResponse
s@CreateEventTrackerResponse' {} Maybe Text
a -> CreateEventTrackerResponse
s {$sel:eventTrackerArn:CreateEventTrackerResponse' :: Maybe Text
eventTrackerArn = Maybe Text
a} :: CreateEventTrackerResponse)
createEventTrackerResponse_httpStatus :: Lens.Lens' CreateEventTrackerResponse Prelude.Int
createEventTrackerResponse_httpStatus :: (Int -> f Int)
-> CreateEventTrackerResponse -> f CreateEventTrackerResponse
createEventTrackerResponse_httpStatus = (CreateEventTrackerResponse -> Int)
-> (CreateEventTrackerResponse
-> Int -> CreateEventTrackerResponse)
-> Lens
CreateEventTrackerResponse CreateEventTrackerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventTrackerResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEventTrackerResponse' :: CreateEventTrackerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateEventTrackerResponse
s@CreateEventTrackerResponse' {} Int
a -> CreateEventTrackerResponse
s {$sel:httpStatus:CreateEventTrackerResponse' :: Int
httpStatus = Int
a} :: CreateEventTrackerResponse)
instance Prelude.NFData CreateEventTrackerResponse