{-# 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.EC2.CancelImportTask
(
cancelImportTask
, CancelImportTask
, citCancelReason
, citImportTaskId
, citDryRun
, cancelImportTaskResponse
, CancelImportTaskResponse
, citrsState
, citrsImportTaskId
, citrsPreviousState
, citrsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CancelImportTask = CancelImportTask'
{ _citCancelReason :: !(Maybe Text)
, _citImportTaskId :: !(Maybe Text)
, _citDryRun :: !(Maybe Bool)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelImportTask
:: CancelImportTask
cancelImportTask =
CancelImportTask'
{ _citCancelReason = Nothing
, _citImportTaskId = Nothing
, _citDryRun = Nothing
}
citCancelReason :: Lens' CancelImportTask (Maybe Text)
citCancelReason = lens _citCancelReason (\ s a -> s{_citCancelReason = a})
citImportTaskId :: Lens' CancelImportTask (Maybe Text)
citImportTaskId = lens _citImportTaskId (\ s a -> s{_citImportTaskId = a})
citDryRun :: Lens' CancelImportTask (Maybe Bool)
citDryRun = lens _citDryRun (\ s a -> s{_citDryRun = a})
instance AWSRequest CancelImportTask where
type Rs CancelImportTask = CancelImportTaskResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CancelImportTaskResponse' <$>
(x .@? "state") <*> (x .@? "importTaskId") <*>
(x .@? "previousState")
<*> (pure (fromEnum s)))
instance Hashable CancelImportTask where
instance NFData CancelImportTask where
instance ToHeaders CancelImportTask where
toHeaders = const mempty
instance ToPath CancelImportTask where
toPath = const "/"
instance ToQuery CancelImportTask where
toQuery CancelImportTask'{..}
= mconcat
["Action" =: ("CancelImportTask" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"CancelReason" =: _citCancelReason,
"ImportTaskId" =: _citImportTaskId,
"DryRun" =: _citDryRun]
data CancelImportTaskResponse = CancelImportTaskResponse'
{ _citrsState :: !(Maybe Text)
, _citrsImportTaskId :: !(Maybe Text)
, _citrsPreviousState :: !(Maybe Text)
, _citrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
cancelImportTaskResponse
:: Int
-> CancelImportTaskResponse
cancelImportTaskResponse pResponseStatus_ =
CancelImportTaskResponse'
{ _citrsState = Nothing
, _citrsImportTaskId = Nothing
, _citrsPreviousState = Nothing
, _citrsResponseStatus = pResponseStatus_
}
citrsState :: Lens' CancelImportTaskResponse (Maybe Text)
citrsState = lens _citrsState (\ s a -> s{_citrsState = a})
citrsImportTaskId :: Lens' CancelImportTaskResponse (Maybe Text)
citrsImportTaskId = lens _citrsImportTaskId (\ s a -> s{_citrsImportTaskId = a})
citrsPreviousState :: Lens' CancelImportTaskResponse (Maybe Text)
citrsPreviousState = lens _citrsPreviousState (\ s a -> s{_citrsPreviousState = a})
citrsResponseStatus :: Lens' CancelImportTaskResponse Int
citrsResponseStatus = lens _citrsResponseStatus (\ s a -> s{_citrsResponseStatus = a})
instance NFData CancelImportTaskResponse where