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