{-# 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.BundleInstance
(
bundleInstance
, BundleInstance
, biDryRun
, biInstanceId
, biStorage
, bundleInstanceResponse
, BundleInstanceResponse
, birsBundleTask
, birsResponseStatus
) 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 BundleInstance = BundleInstance'
{ _biDryRun :: !(Maybe Bool)
, _biInstanceId :: !Text
, _biStorage :: !Storage
} deriving (Eq,Read,Show,Data,Typeable,Generic)
bundleInstance
:: Text
-> Storage
-> BundleInstance
bundleInstance pInstanceId_ pStorage_ =
BundleInstance'
{ _biDryRun = Nothing
, _biInstanceId = pInstanceId_
, _biStorage = pStorage_
}
biDryRun :: Lens' BundleInstance (Maybe Bool)
biDryRun = lens _biDryRun (\ s a -> s{_biDryRun = a});
biInstanceId :: Lens' BundleInstance Text
biInstanceId = lens _biInstanceId (\ s a -> s{_biInstanceId = a});
biStorage :: Lens' BundleInstance Storage
biStorage = lens _biStorage (\ s a -> s{_biStorage = a});
instance AWSRequest BundleInstance where
type Rs BundleInstance = BundleInstanceResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
BundleInstanceResponse' <$>
(x .@? "bundleInstanceTask") <*> (pure (fromEnum s)))
instance Hashable BundleInstance
instance NFData BundleInstance
instance ToHeaders BundleInstance where
toHeaders = const mempty
instance ToPath BundleInstance where
toPath = const "/"
instance ToQuery BundleInstance where
toQuery BundleInstance'{..}
= mconcat
["Action" =: ("BundleInstance" :: ByteString),
"Version" =: ("2016-04-01" :: ByteString),
"DryRun" =: _biDryRun, "InstanceId" =: _biInstanceId,
"Storage" =: _biStorage]
data BundleInstanceResponse = BundleInstanceResponse'
{ _birsBundleTask :: !(Maybe BundleTask)
, _birsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
bundleInstanceResponse
:: Int
-> BundleInstanceResponse
bundleInstanceResponse pResponseStatus_ =
BundleInstanceResponse'
{ _birsBundleTask = Nothing
, _birsResponseStatus = pResponseStatus_
}
birsBundleTask :: Lens' BundleInstanceResponse (Maybe BundleTask)
birsBundleTask = lens _birsBundleTask (\ s a -> s{_birsBundleTask = a});
birsResponseStatus :: Lens' BundleInstanceResponse Int
birsResponseStatus = lens _birsResponseStatus (\ s a -> s{_birsResponseStatus = a});
instance NFData BundleInstanceResponse