module Network.AWS.AutoScaling.SetInstanceProtection
(
setInstanceProtection
, SetInstanceProtection
, sipInstanceIds
, sipAutoScalingGroupName
, sipProtectedFromScaleIn
, setInstanceProtectionResponse
, SetInstanceProtectionResponse
, siprsResponseStatus
) 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 SetInstanceProtection = SetInstanceProtection'
{ _sipInstanceIds :: ![Text]
, _sipAutoScalingGroupName :: !Text
, _sipProtectedFromScaleIn :: !Bool
} deriving (Eq,Read,Show,Data,Typeable,Generic)
setInstanceProtection
:: Text
-> Bool
-> SetInstanceProtection
setInstanceProtection pAutoScalingGroupName_ pProtectedFromScaleIn_ =
SetInstanceProtection'
{ _sipInstanceIds = mempty
, _sipAutoScalingGroupName = pAutoScalingGroupName_
, _sipProtectedFromScaleIn = pProtectedFromScaleIn_
}
sipInstanceIds :: Lens' SetInstanceProtection [Text]
sipInstanceIds = lens _sipInstanceIds (\ s a -> s{_sipInstanceIds = a}) . _Coerce;
sipAutoScalingGroupName :: Lens' SetInstanceProtection Text
sipAutoScalingGroupName = lens _sipAutoScalingGroupName (\ s a -> s{_sipAutoScalingGroupName = a});
sipProtectedFromScaleIn :: Lens' SetInstanceProtection Bool
sipProtectedFromScaleIn = lens _sipProtectedFromScaleIn (\ s a -> s{_sipProtectedFromScaleIn = a});
instance AWSRequest SetInstanceProtection where
type Rs SetInstanceProtection =
SetInstanceProtectionResponse
request = postQuery autoScaling
response
= receiveXMLWrapper "SetInstanceProtectionResult"
(\ s h x ->
SetInstanceProtectionResponse' <$>
(pure (fromEnum s)))
instance ToHeaders SetInstanceProtection where
toHeaders = const mempty
instance ToPath SetInstanceProtection where
toPath = const "/"
instance ToQuery SetInstanceProtection where
toQuery SetInstanceProtection'{..}
= mconcat
["Action" =: ("SetInstanceProtection" :: ByteString),
"Version" =: ("2011-01-01" :: ByteString),
"InstanceIds" =:
toQueryList "member" _sipInstanceIds,
"AutoScalingGroupName" =: _sipAutoScalingGroupName,
"ProtectedFromScaleIn" =: _sipProtectedFromScaleIn]
newtype SetInstanceProtectionResponse = SetInstanceProtectionResponse'
{ _siprsResponseStatus :: Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
setInstanceProtectionResponse
:: Int
-> SetInstanceProtectionResponse
setInstanceProtectionResponse pResponseStatus_ =
SetInstanceProtectionResponse'
{ _siprsResponseStatus = pResponseStatus_
}
siprsResponseStatus :: Lens' SetInstanceProtectionResponse Int
siprsResponseStatus = lens _siprsResponseStatus (\ s a -> s{_siprsResponseStatus = a});