module Network.AWS.AutoScaling.EnterStandby
(
EnterStandby
, enterStandby
, esAutoScalingGroupName
, esInstanceIds
, esShouldDecrementDesiredCapacity
, EnterStandbyResponse
, enterStandbyResponse
, esr1Activities
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.AutoScaling.Types
import qualified GHC.Exts
data EnterStandby = EnterStandby
{ _esAutoScalingGroupName :: Text
, _esInstanceIds :: List "member" Text
, _esShouldDecrementDesiredCapacity :: Bool
} deriving (Eq, Ord, Show)
enterStandby :: Text
-> Bool
-> EnterStandby
enterStandby p1 p2 = EnterStandby
{ _esAutoScalingGroupName = p1
, _esShouldDecrementDesiredCapacity = p2
, _esInstanceIds = mempty
}
esAutoScalingGroupName :: Lens' EnterStandby Text
esAutoScalingGroupName =
lens _esAutoScalingGroupName (\s a -> s { _esAutoScalingGroupName = a })
esInstanceIds :: Lens' EnterStandby [Text]
esInstanceIds = lens _esInstanceIds (\s a -> s { _esInstanceIds = a }) . _List
esShouldDecrementDesiredCapacity :: Lens' EnterStandby Bool
esShouldDecrementDesiredCapacity =
lens _esShouldDecrementDesiredCapacity
(\s a -> s { _esShouldDecrementDesiredCapacity = a })
newtype EnterStandbyResponse = EnterStandbyResponse
{ _esr1Activities :: List "member" Activity
} deriving (Eq, Show, Monoid, Semigroup)
instance GHC.Exts.IsList EnterStandbyResponse where
type Item EnterStandbyResponse = Activity
fromList = EnterStandbyResponse . GHC.Exts.fromList
toList = GHC.Exts.toList . _esr1Activities
enterStandbyResponse :: EnterStandbyResponse
enterStandbyResponse = EnterStandbyResponse
{ _esr1Activities = mempty
}
esr1Activities :: Lens' EnterStandbyResponse [Activity]
esr1Activities = lens _esr1Activities (\s a -> s { _esr1Activities = a }) . _List
instance ToPath EnterStandby where
toPath = const "/"
instance ToQuery EnterStandby where
toQuery EnterStandby{..} = mconcat
[ "AutoScalingGroupName" =? _esAutoScalingGroupName
, "InstanceIds" =? _esInstanceIds
, "ShouldDecrementDesiredCapacity" =? _esShouldDecrementDesiredCapacity
]
instance ToHeaders EnterStandby
instance AWSRequest EnterStandby where
type Sv EnterStandby = AutoScaling
type Rs EnterStandby = EnterStandbyResponse
request = post "EnterStandby"
response = xmlResponse
instance FromXML EnterStandbyResponse where
parseXML = withElement "EnterStandbyResult" $ \x -> EnterStandbyResponse
<$> x .@? "Activities" .!@ mempty