module Network.AWS.MachineLearning.CreateRealtimeEndpoint
(
createRealtimeEndpoint
, CreateRealtimeEndpoint
, creMLModelId
, createRealtimeEndpointResponse
, CreateRealtimeEndpointResponse
, crersRealtimeEndpointInfo
, crersMLModelId
, crersStatus
) where
import Network.AWS.MachineLearning.Types
import Network.AWS.MachineLearning.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype CreateRealtimeEndpoint = CreateRealtimeEndpoint'
{ _creMLModelId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createRealtimeEndpoint
:: Text
-> CreateRealtimeEndpoint
createRealtimeEndpoint pMLModelId_ =
CreateRealtimeEndpoint'
{ _creMLModelId = pMLModelId_
}
creMLModelId :: Lens' CreateRealtimeEndpoint Text
creMLModelId = lens _creMLModelId (\ s a -> s{_creMLModelId = a});
instance AWSRequest CreateRealtimeEndpoint where
type Rs CreateRealtimeEndpoint =
CreateRealtimeEndpointResponse
request = postJSON machineLearning
response
= receiveJSON
(\ s h x ->
CreateRealtimeEndpointResponse' <$>
(x .?> "RealtimeEndpointInfo") <*>
(x .?> "MLModelId")
<*> (pure (fromEnum s)))
instance ToHeaders CreateRealtimeEndpoint where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonML_20141212.CreateRealtimeEndpoint" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateRealtimeEndpoint where
toJSON CreateRealtimeEndpoint'{..}
= object
(catMaybes [Just ("MLModelId" .= _creMLModelId)])
instance ToPath CreateRealtimeEndpoint where
toPath = const "/"
instance ToQuery CreateRealtimeEndpoint where
toQuery = const mempty
data CreateRealtimeEndpointResponse = CreateRealtimeEndpointResponse'
{ _crersRealtimeEndpointInfo :: !(Maybe RealtimeEndpointInfo)
, _crersMLModelId :: !(Maybe Text)
, _crersStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createRealtimeEndpointResponse
:: Int
-> CreateRealtimeEndpointResponse
createRealtimeEndpointResponse pStatus_ =
CreateRealtimeEndpointResponse'
{ _crersRealtimeEndpointInfo = Nothing
, _crersMLModelId = Nothing
, _crersStatus = pStatus_
}
crersRealtimeEndpointInfo :: Lens' CreateRealtimeEndpointResponse (Maybe RealtimeEndpointInfo)
crersRealtimeEndpointInfo = lens _crersRealtimeEndpointInfo (\ s a -> s{_crersRealtimeEndpointInfo = a});
crersMLModelId :: Lens' CreateRealtimeEndpointResponse (Maybe Text)
crersMLModelId = lens _crersMLModelId (\ s a -> s{_crersMLModelId = a});
crersStatus :: Lens' CreateRealtimeEndpointResponse Int
crersStatus = lens _crersStatus (\ s a -> s{_crersStatus = a});