module Network.AWS.Glue.CreateJob
(
createJob
, CreateJob
, cjConnections
, cjLogURI
, cjMaxRetries
, cjExecutionProperty
, cjAllocatedCapacity
, cjDefaultArguments
, cjDescription
, cjName
, cjRole
, cjCommand
, createJobResponse
, CreateJobResponse
, cjrsName
, cjrsResponseStatus
) where
import Network.AWS.Glue.Types
import Network.AWS.Glue.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateJob = CreateJob'
{ _cjConnections :: !(Maybe ConnectionsList)
, _cjLogURI :: !(Maybe Text)
, _cjMaxRetries :: !(Maybe Int)
, _cjExecutionProperty :: !(Maybe ExecutionProperty)
, _cjAllocatedCapacity :: !(Maybe Int)
, _cjDefaultArguments :: !(Maybe (Map Text Text))
, _cjDescription :: !(Maybe Text)
, _cjName :: !Text
, _cjRole :: !Text
, _cjCommand :: !JobCommand
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createJob
:: Text
-> Text
-> JobCommand
-> CreateJob
createJob pName_ pRole_ pCommand_ =
CreateJob'
{ _cjConnections = Nothing
, _cjLogURI = Nothing
, _cjMaxRetries = Nothing
, _cjExecutionProperty = Nothing
, _cjAllocatedCapacity = Nothing
, _cjDefaultArguments = Nothing
, _cjDescription = Nothing
, _cjName = pName_
, _cjRole = pRole_
, _cjCommand = pCommand_
}
cjConnections :: Lens' CreateJob (Maybe ConnectionsList)
cjConnections = lens _cjConnections (\ s a -> s{_cjConnections = a});
cjLogURI :: Lens' CreateJob (Maybe Text)
cjLogURI = lens _cjLogURI (\ s a -> s{_cjLogURI = a});
cjMaxRetries :: Lens' CreateJob (Maybe Int)
cjMaxRetries = lens _cjMaxRetries (\ s a -> s{_cjMaxRetries = a});
cjExecutionProperty :: Lens' CreateJob (Maybe ExecutionProperty)
cjExecutionProperty = lens _cjExecutionProperty (\ s a -> s{_cjExecutionProperty = a});
cjAllocatedCapacity :: Lens' CreateJob (Maybe Int)
cjAllocatedCapacity = lens _cjAllocatedCapacity (\ s a -> s{_cjAllocatedCapacity = a});
cjDefaultArguments :: Lens' CreateJob (HashMap Text Text)
cjDefaultArguments = lens _cjDefaultArguments (\ s a -> s{_cjDefaultArguments = a}) . _Default . _Map;
cjDescription :: Lens' CreateJob (Maybe Text)
cjDescription = lens _cjDescription (\ s a -> s{_cjDescription = a});
cjName :: Lens' CreateJob Text
cjName = lens _cjName (\ s a -> s{_cjName = a});
cjRole :: Lens' CreateJob Text
cjRole = lens _cjRole (\ s a -> s{_cjRole = a});
cjCommand :: Lens' CreateJob JobCommand
cjCommand = lens _cjCommand (\ s a -> s{_cjCommand = a});
instance AWSRequest CreateJob where
type Rs CreateJob = CreateJobResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
CreateJobResponse' <$>
(x .?> "Name") <*> (pure (fromEnum s)))
instance Hashable CreateJob where
instance NFData CreateJob where
instance ToHeaders CreateJob where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.CreateJob" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateJob where
toJSON CreateJob'{..}
= object
(catMaybes
[("Connections" .=) <$> _cjConnections,
("LogUri" .=) <$> _cjLogURI,
("MaxRetries" .=) <$> _cjMaxRetries,
("ExecutionProperty" .=) <$> _cjExecutionProperty,
("AllocatedCapacity" .=) <$> _cjAllocatedCapacity,
("DefaultArguments" .=) <$> _cjDefaultArguments,
("Description" .=) <$> _cjDescription,
Just ("Name" .= _cjName), Just ("Role" .= _cjRole),
Just ("Command" .= _cjCommand)])
instance ToPath CreateJob where
toPath = const "/"
instance ToQuery CreateJob where
toQuery = const mempty
data CreateJobResponse = CreateJobResponse'
{ _cjrsName :: !(Maybe Text)
, _cjrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createJobResponse
:: Int
-> CreateJobResponse
createJobResponse pResponseStatus_ =
CreateJobResponse'
{_cjrsName = Nothing, _cjrsResponseStatus = pResponseStatus_}
cjrsName :: Lens' CreateJobResponse (Maybe Text)
cjrsName = lens _cjrsName (\ s a -> s{_cjrsName = a});
cjrsResponseStatus :: Lens' CreateJobResponse Int
cjrsResponseStatus = lens _cjrsResponseStatus (\ s a -> s{_cjrsResponseStatus = a});
instance NFData CreateJobResponse where