module Network.AWS.AutoScaling.DetachInstances
(
detachInstances
, DetachInstances
, diInstanceIds
, diAutoScalingGroupName
, diShouldDecrementDesiredCapacity
, detachInstancesResponse
, DetachInstancesResponse
, dirsActivities
, dirsResponseStatus
) where
import Network.AWS.AutoScaling.Types
import Network.AWS.AutoScaling.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DetachInstances = DetachInstances'
{ _diInstanceIds :: !(Maybe [Text])
, _diAutoScalingGroupName :: !Text
, _diShouldDecrementDesiredCapacity :: !Bool
} deriving (Eq, Read, Show, Data, Typeable, Generic)
detachInstances
:: Text
-> Bool
-> DetachInstances
detachInstances pAutoScalingGroupName_ pShouldDecrementDesiredCapacity_ =
DetachInstances'
{ _diInstanceIds = Nothing
, _diAutoScalingGroupName = pAutoScalingGroupName_
, _diShouldDecrementDesiredCapacity = pShouldDecrementDesiredCapacity_
}
diInstanceIds :: Lens' DetachInstances [Text]
diInstanceIds = lens _diInstanceIds (\ s a -> s{_diInstanceIds = a}) . _Default . _Coerce;
diAutoScalingGroupName :: Lens' DetachInstances Text
diAutoScalingGroupName = lens _diAutoScalingGroupName (\ s a -> s{_diAutoScalingGroupName = a});
diShouldDecrementDesiredCapacity :: Lens' DetachInstances Bool
diShouldDecrementDesiredCapacity = lens _diShouldDecrementDesiredCapacity (\ s a -> s{_diShouldDecrementDesiredCapacity = a});
instance AWSRequest DetachInstances where
type Rs DetachInstances = DetachInstancesResponse
request = postQuery autoScaling
response
= receiveXMLWrapper "DetachInstancesResult"
(\ s h x ->
DetachInstancesResponse' <$>
(x .@? "Activities" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance Hashable DetachInstances where
instance NFData DetachInstances where
instance ToHeaders DetachInstances where
toHeaders = const mempty
instance ToPath DetachInstances where
toPath = const "/"
instance ToQuery DetachInstances where
toQuery DetachInstances'{..}
= mconcat
["Action" =: ("DetachInstances" :: ByteString),
"Version" =: ("2011-01-01" :: ByteString),
"InstanceIds" =:
toQuery (toQueryList "member" <$> _diInstanceIds),
"AutoScalingGroupName" =: _diAutoScalingGroupName,
"ShouldDecrementDesiredCapacity" =:
_diShouldDecrementDesiredCapacity]
data DetachInstancesResponse = DetachInstancesResponse'
{ _dirsActivities :: !(Maybe [Activity])
, _dirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
detachInstancesResponse
:: Int
-> DetachInstancesResponse
detachInstancesResponse pResponseStatus_ =
DetachInstancesResponse'
{_dirsActivities = Nothing, _dirsResponseStatus = pResponseStatus_}
dirsActivities :: Lens' DetachInstancesResponse [Activity]
dirsActivities = lens _dirsActivities (\ s a -> s{_dirsActivities = a}) . _Default . _Coerce;
dirsResponseStatus :: Lens' DetachInstancesResponse Int
dirsResponseStatus = lens _dirsResponseStatus (\ s a -> s{_dirsResponseStatus = a});
instance NFData DetachInstancesResponse where