{-# 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.CancelCommand
(
cancelCommand
, CancelCommand
, ccInstanceIds
, ccCommandId
, cancelCommandResponse
, CancelCommandResponse
, ccrsResponseStatus
) 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 CancelCommand = CancelCommand'
{ _ccInstanceIds :: !(Maybe [Text])
, _ccCommandId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelCommand
:: Text
-> CancelCommand
cancelCommand pCommandId_ =
CancelCommand' {_ccInstanceIds = Nothing, _ccCommandId = pCommandId_}
ccInstanceIds :: Lens' CancelCommand [Text]
ccInstanceIds = lens _ccInstanceIds (\ s a -> s{_ccInstanceIds = a}) . _Default . _Coerce
ccCommandId :: Lens' CancelCommand Text
ccCommandId = lens _ccCommandId (\ s a -> s{_ccCommandId = a})
instance AWSRequest CancelCommand where
type Rs CancelCommand = CancelCommandResponse
request = postJSON ssm
response
= receiveEmpty
(\ s h x ->
CancelCommandResponse' <$> (pure (fromEnum s)))
instance Hashable CancelCommand where
instance NFData CancelCommand where
instance ToHeaders CancelCommand where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.CancelCommand" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CancelCommand where
toJSON CancelCommand'{..}
= object
(catMaybes
[("InstanceIds" .=) <$> _ccInstanceIds,
Just ("CommandId" .= _ccCommandId)])
instance ToPath CancelCommand where
toPath = const "/"
instance ToQuery CancelCommand where
toQuery = const mempty
newtype CancelCommandResponse = CancelCommandResponse'
{ _ccrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelCommandResponse
:: Int
-> CancelCommandResponse
cancelCommandResponse pResponseStatus_ =
CancelCommandResponse' {_ccrsResponseStatus = pResponseStatus_}
ccrsResponseStatus :: Lens' CancelCommandResponse Int
ccrsResponseStatus = lens _ccrsResponseStatus (\ s a -> s{_ccrsResponseStatus = a})
instance NFData CancelCommandResponse where