module Network.AWS.SSM.SendCommand
(
sendCommand
, SendCommand
, scOutputS3KeyPrefix
, scParameters
, scTimeoutSeconds
, scComment
, scOutputS3BucketName
, scInstanceIds
, scDocumentName
, sendCommandResponse
, SendCommandResponse
, scrsCommand
, scrsResponseStatus
) 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 SendCommand = SendCommand'
{ _scOutputS3KeyPrefix :: !(Maybe Text)
, _scParameters :: !(Maybe (Map Text [Text]))
, _scTimeoutSeconds :: !(Maybe Nat)
, _scComment :: !(Maybe Text)
, _scOutputS3BucketName :: !(Maybe Text)
, _scInstanceIds :: !(List1 Text)
, _scDocumentName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
sendCommand
:: NonEmpty Text
-> Text
-> SendCommand
sendCommand pInstanceIds_ pDocumentName_ =
SendCommand'
{ _scOutputS3KeyPrefix = Nothing
, _scParameters = Nothing
, _scTimeoutSeconds = Nothing
, _scComment = Nothing
, _scOutputS3BucketName = Nothing
, _scInstanceIds = _List1 # pInstanceIds_
, _scDocumentName = pDocumentName_
}
scOutputS3KeyPrefix :: Lens' SendCommand (Maybe Text)
scOutputS3KeyPrefix = lens _scOutputS3KeyPrefix (\ s a -> s{_scOutputS3KeyPrefix = a});
scParameters :: Lens' SendCommand (HashMap Text [Text])
scParameters = lens _scParameters (\ s a -> s{_scParameters = a}) . _Default . _Map;
scTimeoutSeconds :: Lens' SendCommand (Maybe Natural)
scTimeoutSeconds = lens _scTimeoutSeconds (\ s a -> s{_scTimeoutSeconds = a}) . mapping _Nat;
scComment :: Lens' SendCommand (Maybe Text)
scComment = lens _scComment (\ s a -> s{_scComment = a});
scOutputS3BucketName :: Lens' SendCommand (Maybe Text)
scOutputS3BucketName = lens _scOutputS3BucketName (\ s a -> s{_scOutputS3BucketName = a});
scInstanceIds :: Lens' SendCommand (NonEmpty Text)
scInstanceIds = lens _scInstanceIds (\ s a -> s{_scInstanceIds = a}) . _List1;
scDocumentName :: Lens' SendCommand Text
scDocumentName = lens _scDocumentName (\ s a -> s{_scDocumentName = a});
instance AWSRequest SendCommand where
type Rs SendCommand = SendCommandResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
SendCommandResponse' <$>
(x .?> "Command") <*> (pure (fromEnum s)))
instance Hashable SendCommand
instance NFData SendCommand
instance ToHeaders SendCommand where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.SendCommand" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON SendCommand where
toJSON SendCommand'{..}
= object
(catMaybes
[("OutputS3KeyPrefix" .=) <$> _scOutputS3KeyPrefix,
("Parameters" .=) <$> _scParameters,
("TimeoutSeconds" .=) <$> _scTimeoutSeconds,
("Comment" .=) <$> _scComment,
("OutputS3BucketName" .=) <$> _scOutputS3BucketName,
Just ("InstanceIds" .= _scInstanceIds),
Just ("DocumentName" .= _scDocumentName)])
instance ToPath SendCommand where
toPath = const "/"
instance ToQuery SendCommand where
toQuery = const mempty
data SendCommandResponse = SendCommandResponse'
{ _scrsCommand :: !(Maybe Command)
, _scrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
sendCommandResponse
:: Int
-> SendCommandResponse
sendCommandResponse pResponseStatus_ =
SendCommandResponse'
{ _scrsCommand = Nothing
, _scrsResponseStatus = pResponseStatus_
}
scrsCommand :: Lens' SendCommandResponse (Maybe Command)
scrsCommand = lens _scrsCommand (\ s a -> s{_scrsCommand = a});
scrsResponseStatus :: Lens' SendCommandResponse Int
scrsResponseStatus = lens _scrsResponseStatus (\ s a -> s{_scrsResponseStatus = a});
instance NFData SendCommandResponse