{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.MachineLearning.CreateEvaluation
(
createEvaluation
, CreateEvaluation
, ceEvaluationName
, ceEvaluationId
, ceMLModelId
, ceEvaluationDataSourceId
, createEvaluationResponse
, CreateEvaluationResponse
, cersEvaluationId
, cersResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.MachineLearning.Types
import Network.AWS.MachineLearning.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateEvaluation = CreateEvaluation'
{ _ceEvaluationName :: !(Maybe Text)
, _ceEvaluationId :: !Text
, _ceMLModelId :: !Text
, _ceEvaluationDataSourceId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createEvaluation
:: Text
-> Text
-> Text
-> CreateEvaluation
createEvaluation pEvaluationId_ pMLModelId_ pEvaluationDataSourceId_ =
CreateEvaluation'
{ _ceEvaluationName = Nothing
, _ceEvaluationId = pEvaluationId_
, _ceMLModelId = pMLModelId_
, _ceEvaluationDataSourceId = pEvaluationDataSourceId_
}
ceEvaluationName :: Lens' CreateEvaluation (Maybe Text)
ceEvaluationName = lens _ceEvaluationName (\ s a -> s{_ceEvaluationName = a});
ceEvaluationId :: Lens' CreateEvaluation Text
ceEvaluationId = lens _ceEvaluationId (\ s a -> s{_ceEvaluationId = a});
ceMLModelId :: Lens' CreateEvaluation Text
ceMLModelId = lens _ceMLModelId (\ s a -> s{_ceMLModelId = a});
ceEvaluationDataSourceId :: Lens' CreateEvaluation Text
ceEvaluationDataSourceId = lens _ceEvaluationDataSourceId (\ s a -> s{_ceEvaluationDataSourceId = a});
instance AWSRequest CreateEvaluation where
type Rs CreateEvaluation = CreateEvaluationResponse
request = postJSON machineLearning
response
= receiveJSON
(\ s h x ->
CreateEvaluationResponse' <$>
(x .?> "EvaluationId") <*> (pure (fromEnum s)))
instance Hashable CreateEvaluation
instance NFData CreateEvaluation
instance ToHeaders CreateEvaluation where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonML_20141212.CreateEvaluation" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateEvaluation where
toJSON CreateEvaluation'{..}
= object
(catMaybes
[("EvaluationName" .=) <$> _ceEvaluationName,
Just ("EvaluationId" .= _ceEvaluationId),
Just ("MLModelId" .= _ceMLModelId),
Just
("EvaluationDataSourceId" .=
_ceEvaluationDataSourceId)])
instance ToPath CreateEvaluation where
toPath = const "/"
instance ToQuery CreateEvaluation where
toQuery = const mempty
data CreateEvaluationResponse = CreateEvaluationResponse'
{ _cersEvaluationId :: !(Maybe Text)
, _cersResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createEvaluationResponse
:: Int
-> CreateEvaluationResponse
createEvaluationResponse pResponseStatus_ =
CreateEvaluationResponse'
{ _cersEvaluationId = Nothing
, _cersResponseStatus = pResponseStatus_
}
cersEvaluationId :: Lens' CreateEvaluationResponse (Maybe Text)
cersEvaluationId = lens _cersEvaluationId (\ s a -> s{_cersEvaluationId = a});
cersResponseStatus :: Lens' CreateEvaluationResponse Int
cersResponseStatus = lens _cersResponseStatus (\ s a -> s{_cersResponseStatus = a});
instance NFData CreateEvaluationResponse