{-# 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.StartInstances
(
startInstances
, StartInstances
, sAdditionalInfo
, sDryRun
, sInstanceIds
, startInstancesResponse
, StartInstancesResponse
, srsStartingInstances
, srsResponseStatus
) 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 StartInstances = StartInstances'
{ _sAdditionalInfo :: !(Maybe Text)
, _sDryRun :: !(Maybe Bool)
, _sInstanceIds :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
startInstances
:: StartInstances
startInstances =
StartInstances'
{ _sAdditionalInfo = Nothing
, _sDryRun = Nothing
, _sInstanceIds = mempty
}
sAdditionalInfo :: Lens' StartInstances (Maybe Text)
sAdditionalInfo = lens _sAdditionalInfo (\ s a -> s{_sAdditionalInfo = a});
sDryRun :: Lens' StartInstances (Maybe Bool)
sDryRun = lens _sDryRun (\ s a -> s{_sDryRun = a});
sInstanceIds :: Lens' StartInstances [Text]
sInstanceIds = lens _sInstanceIds (\ s a -> s{_sInstanceIds = a}) . _Coerce;
instance AWSRequest StartInstances where
type Rs StartInstances = StartInstancesResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
StartInstancesResponse' <$>
(x .@? "instancesSet" .!@ mempty >>=
may (parseXMLList "item"))
<*> (pure (fromEnum s)))
instance Hashable StartInstances
instance NFData StartInstances
instance ToHeaders StartInstances where
toHeaders = const mempty
instance ToPath StartInstances where
toPath = const "/"
instance ToQuery StartInstances where
toQuery StartInstances'{..}
= mconcat
["Action" =: ("StartInstances" :: ByteString),
"Version" =: ("2016-04-01" :: ByteString),
"AdditionalInfo" =: _sAdditionalInfo,
"DryRun" =: _sDryRun,
toQueryList "InstanceId" _sInstanceIds]
data StartInstancesResponse = StartInstancesResponse'
{ _srsStartingInstances :: !(Maybe [InstanceStateChange])
, _srsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
startInstancesResponse
:: Int
-> StartInstancesResponse
startInstancesResponse pResponseStatus_ =
StartInstancesResponse'
{ _srsStartingInstances = Nothing
, _srsResponseStatus = pResponseStatus_
}
srsStartingInstances :: Lens' StartInstancesResponse [InstanceStateChange]
srsStartingInstances = lens _srsStartingInstances (\ s a -> s{_srsStartingInstances = a}) . _Default . _Coerce;
srsResponseStatus :: Lens' StartInstancesResponse Int
srsResponseStatus = lens _srsResponseStatus (\ s a -> s{_srsResponseStatus = a});
instance NFData StartInstancesResponse