{-# 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_mLModelId,
createRealtimeEndpointResponse_realtimeEndpointInfo,
createRealtimeEndpointResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:mLModelId:CreateRealtimeEndpoint' :: Text
mLModelId = Text
pMLModelId_}
createRealtimeEndpoint_mLModelId :: Lens.Lens' CreateRealtimeEndpoint Prelude.Text
createRealtimeEndpoint_mLModelId :: Lens' CreateRealtimeEndpoint Text
createRealtimeEndpoint_mLModelId = 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 :: (Service -> Service)
-> CreateRealtimeEndpoint -> Request CreateRealtimeEndpoint
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateRealtimeEndpoint
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRealtimeEndpoint)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe RealtimeEndpointInfo
-> Int
-> CreateRealtimeEndpointResponse
CreateRealtimeEndpointResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"MLModelId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RealtimeEndpointInfo")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateRealtimeEndpoint where
hashWithSalt :: Int -> CreateRealtimeEndpoint -> Int
hashWithSalt Int
_salt CreateRealtimeEndpoint' {Text
mLModelId :: Text
$sel:mLModelId:CreateRealtimeEndpoint' :: CreateRealtimeEndpoint -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
mLModelId
instance Prelude.NFData CreateRealtimeEndpoint where
rnf :: CreateRealtimeEndpoint -> ()
rnf CreateRealtimeEndpoint' {Text
mLModelId :: Text
$sel:mLModelId:CreateRealtimeEndpoint' :: CreateRealtimeEndpoint -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
mLModelId
instance Data.ToHeaders CreateRealtimeEndpoint where
toHeaders :: CreateRealtimeEndpoint -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonML_20141212.CreateRealtimeEndpoint" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateRealtimeEndpoint where
toJSON :: CreateRealtimeEndpoint -> Value
toJSON CreateRealtimeEndpoint' {Text
mLModelId :: Text
$sel:mLModelId:CreateRealtimeEndpoint' :: CreateRealtimeEndpoint -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"MLModelId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
mLModelId)]
)
instance Data.ToPath CreateRealtimeEndpoint where
toPath :: CreateRealtimeEndpoint -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateRealtimeEndpoint where
toQuery :: CreateRealtimeEndpoint -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateRealtimeEndpointResponse = CreateRealtimeEndpointResponse'
{
CreateRealtimeEndpointResponse -> Maybe Text
mLModelId :: Prelude.Maybe Prelude.Text,
CreateRealtimeEndpointResponse -> Maybe RealtimeEndpointInfo
realtimeEndpointInfo :: Prelude.Maybe RealtimeEndpointInfo,
CreateRealtimeEndpointResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRealtimeEndpointResponse
-> CreateRealtimeEndpointResponse -> Bool
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]
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
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.
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'
{ $sel:mLModelId:CreateRealtimeEndpointResponse' :: Maybe Text
mLModelId =
forall a. Maybe a
Prelude.Nothing,
$sel:realtimeEndpointInfo:CreateRealtimeEndpointResponse' :: Maybe RealtimeEndpointInfo
realtimeEndpointInfo = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRealtimeEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRealtimeEndpointResponse_mLModelId :: Lens.Lens' CreateRealtimeEndpointResponse (Prelude.Maybe Prelude.Text)
createRealtimeEndpointResponse_mLModelId :: Lens' CreateRealtimeEndpointResponse (Maybe Text)
createRealtimeEndpointResponse_mLModelId = 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_realtimeEndpointInfo :: Lens.Lens' CreateRealtimeEndpointResponse (Prelude.Maybe RealtimeEndpointInfo)
createRealtimeEndpointResponse_realtimeEndpointInfo :: Lens' CreateRealtimeEndpointResponse (Maybe RealtimeEndpointInfo)
createRealtimeEndpointResponse_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_httpStatus :: Lens.Lens' CreateRealtimeEndpointResponse Prelude.Int
createRealtimeEndpointResponse_httpStatus :: Lens' CreateRealtimeEndpointResponse Int
createRealtimeEndpointResponse_httpStatus = 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
where
rnf :: CreateRealtimeEndpointResponse -> ()
rnf CreateRealtimeEndpointResponse' {Int
Maybe Text
Maybe RealtimeEndpointInfo
httpStatus :: Int
realtimeEndpointInfo :: Maybe RealtimeEndpointInfo
mLModelId :: Maybe Text
$sel:httpStatus:CreateRealtimeEndpointResponse' :: CreateRealtimeEndpointResponse -> Int
$sel:realtimeEndpointInfo:CreateRealtimeEndpointResponse' :: CreateRealtimeEndpointResponse -> Maybe RealtimeEndpointInfo
$sel:mLModelId:CreateRealtimeEndpointResponse' :: CreateRealtimeEndpointResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mLModelId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RealtimeEndpointInfo
realtimeEndpointInfo
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus