{-# 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.SSM.StartAutomationExecution
(
startAutomationExecution
, StartAutomationExecution
, saeParameters
, saeDocumentVersion
, saeDocumentName
, startAutomationExecutionResponse
, StartAutomationExecutionResponse
, srsAutomationExecutionId
, srsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SSM.Types
import Network.AWS.SSM.Types.Product
data StartAutomationExecution = StartAutomationExecution'
{ _saeParameters :: !(Maybe (Map Text [Text]))
, _saeDocumentVersion :: !(Maybe Text)
, _saeDocumentName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
startAutomationExecution
:: Text
-> StartAutomationExecution
startAutomationExecution pDocumentName_ =
StartAutomationExecution'
{ _saeParameters = Nothing
, _saeDocumentVersion = Nothing
, _saeDocumentName = pDocumentName_
}
saeParameters :: Lens' StartAutomationExecution (HashMap Text [Text])
saeParameters = lens _saeParameters (\ s a -> s{_saeParameters = a}) . _Default . _Map;
saeDocumentVersion :: Lens' StartAutomationExecution (Maybe Text)
saeDocumentVersion = lens _saeDocumentVersion (\ s a -> s{_saeDocumentVersion = a});
saeDocumentName :: Lens' StartAutomationExecution Text
saeDocumentName = lens _saeDocumentName (\ s a -> s{_saeDocumentName = a});
instance AWSRequest StartAutomationExecution where
type Rs StartAutomationExecution =
StartAutomationExecutionResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
StartAutomationExecutionResponse' <$>
(x .?> "AutomationExecutionId") <*>
(pure (fromEnum s)))
instance Hashable StartAutomationExecution
instance NFData StartAutomationExecution
instance ToHeaders StartAutomationExecution where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.StartAutomationExecution" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StartAutomationExecution where
toJSON StartAutomationExecution'{..}
= object
(catMaybes
[("Parameters" .=) <$> _saeParameters,
("DocumentVersion" .=) <$> _saeDocumentVersion,
Just ("DocumentName" .= _saeDocumentName)])
instance ToPath StartAutomationExecution where
toPath = const "/"
instance ToQuery StartAutomationExecution where
toQuery = const mempty
data StartAutomationExecutionResponse = StartAutomationExecutionResponse'
{ _srsAutomationExecutionId :: !(Maybe Text)
, _srsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
startAutomationExecutionResponse
:: Int
-> StartAutomationExecutionResponse
startAutomationExecutionResponse pResponseStatus_ =
StartAutomationExecutionResponse'
{ _srsAutomationExecutionId = Nothing
, _srsResponseStatus = pResponseStatus_
}
srsAutomationExecutionId :: Lens' StartAutomationExecutionResponse (Maybe Text)
srsAutomationExecutionId = lens _srsAutomationExecutionId (\ s a -> s{_srsAutomationExecutionId = a});
srsResponseStatus :: Lens' StartAutomationExecutionResponse Int
srsResponseStatus = lens _srsResponseStatus (\ s a -> s{_srsResponseStatus = a});
instance NFData StartAutomationExecutionResponse