{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.AutoScaling.EnterStandby
(
EnterStandby (..),
newEnterStandby,
enterStandby_instanceIds,
enterStandby_autoScalingGroupName,
enterStandby_shouldDecrementDesiredCapacity,
EnterStandbyResponse (..),
newEnterStandbyResponse,
enterStandbyResponse_activities,
enterStandbyResponse_httpStatus,
)
where
import Amazonka.AutoScaling.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data EnterStandby = EnterStandby'
{
EnterStandby -> Maybe [Text]
instanceIds :: Prelude.Maybe [Prelude.Text],
EnterStandby -> Text
autoScalingGroupName :: Prelude.Text,
EnterStandby -> Bool
shouldDecrementDesiredCapacity :: Prelude.Bool
}
deriving (EnterStandby -> EnterStandby -> Bool
(EnterStandby -> EnterStandby -> Bool)
-> (EnterStandby -> EnterStandby -> Bool) -> Eq EnterStandby
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnterStandby -> EnterStandby -> Bool
$c/= :: EnterStandby -> EnterStandby -> Bool
== :: EnterStandby -> EnterStandby -> Bool
$c== :: EnterStandby -> EnterStandby -> Bool
Prelude.Eq, ReadPrec [EnterStandby]
ReadPrec EnterStandby
Int -> ReadS EnterStandby
ReadS [EnterStandby]
(Int -> ReadS EnterStandby)
-> ReadS [EnterStandby]
-> ReadPrec EnterStandby
-> ReadPrec [EnterStandby]
-> Read EnterStandby
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnterStandby]
$creadListPrec :: ReadPrec [EnterStandby]
readPrec :: ReadPrec EnterStandby
$creadPrec :: ReadPrec EnterStandby
readList :: ReadS [EnterStandby]
$creadList :: ReadS [EnterStandby]
readsPrec :: Int -> ReadS EnterStandby
$creadsPrec :: Int -> ReadS EnterStandby
Prelude.Read, Int -> EnterStandby -> ShowS
[EnterStandby] -> ShowS
EnterStandby -> String
(Int -> EnterStandby -> ShowS)
-> (EnterStandby -> String)
-> ([EnterStandby] -> ShowS)
-> Show EnterStandby
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnterStandby] -> ShowS
$cshowList :: [EnterStandby] -> ShowS
show :: EnterStandby -> String
$cshow :: EnterStandby -> String
showsPrec :: Int -> EnterStandby -> ShowS
$cshowsPrec :: Int -> EnterStandby -> ShowS
Prelude.Show, (forall x. EnterStandby -> Rep EnterStandby x)
-> (forall x. Rep EnterStandby x -> EnterStandby)
-> Generic EnterStandby
forall x. Rep EnterStandby x -> EnterStandby
forall x. EnterStandby -> Rep EnterStandby x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnterStandby x -> EnterStandby
$cfrom :: forall x. EnterStandby -> Rep EnterStandby x
Prelude.Generic)
newEnterStandby ::
Prelude.Text ->
Prelude.Bool ->
EnterStandby
newEnterStandby :: Text -> Bool -> EnterStandby
newEnterStandby
Text
pAutoScalingGroupName_
Bool
pShouldDecrementDesiredCapacity_ =
EnterStandby' :: Maybe [Text] -> Text -> Bool -> EnterStandby
EnterStandby'
{ $sel:instanceIds:EnterStandby' :: Maybe [Text]
instanceIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:autoScalingGroupName:EnterStandby' :: Text
autoScalingGroupName = Text
pAutoScalingGroupName_,
$sel:shouldDecrementDesiredCapacity:EnterStandby' :: Bool
shouldDecrementDesiredCapacity =
Bool
pShouldDecrementDesiredCapacity_
}
enterStandby_instanceIds :: Lens.Lens' EnterStandby (Prelude.Maybe [Prelude.Text])
enterStandby_instanceIds :: (Maybe [Text] -> f (Maybe [Text]))
-> EnterStandby -> f EnterStandby
enterStandby_instanceIds = (EnterStandby -> Maybe [Text])
-> (EnterStandby -> Maybe [Text] -> EnterStandby)
-> Lens EnterStandby EnterStandby (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnterStandby' {Maybe [Text]
instanceIds :: Maybe [Text]
$sel:instanceIds:EnterStandby' :: EnterStandby -> Maybe [Text]
instanceIds} -> Maybe [Text]
instanceIds) (\s :: EnterStandby
s@EnterStandby' {} Maybe [Text]
a -> EnterStandby
s {$sel:instanceIds:EnterStandby' :: Maybe [Text]
instanceIds = Maybe [Text]
a} :: EnterStandby) ((Maybe [Text] -> f (Maybe [Text]))
-> EnterStandby -> f EnterStandby)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> EnterStandby
-> f EnterStandby
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
enterStandby_autoScalingGroupName :: Lens.Lens' EnterStandby Prelude.Text
enterStandby_autoScalingGroupName :: (Text -> f Text) -> EnterStandby -> f EnterStandby
enterStandby_autoScalingGroupName = (EnterStandby -> Text)
-> (EnterStandby -> Text -> EnterStandby)
-> Lens EnterStandby EnterStandby Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnterStandby' {Text
autoScalingGroupName :: Text
$sel:autoScalingGroupName:EnterStandby' :: EnterStandby -> Text
autoScalingGroupName} -> Text
autoScalingGroupName) (\s :: EnterStandby
s@EnterStandby' {} Text
a -> EnterStandby
s {$sel:autoScalingGroupName:EnterStandby' :: Text
autoScalingGroupName = Text
a} :: EnterStandby)
enterStandby_shouldDecrementDesiredCapacity :: Lens.Lens' EnterStandby Prelude.Bool
enterStandby_shouldDecrementDesiredCapacity :: (Bool -> f Bool) -> EnterStandby -> f EnterStandby
enterStandby_shouldDecrementDesiredCapacity = (EnterStandby -> Bool)
-> (EnterStandby -> Bool -> EnterStandby)
-> Lens EnterStandby EnterStandby Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnterStandby' {Bool
shouldDecrementDesiredCapacity :: Bool
$sel:shouldDecrementDesiredCapacity:EnterStandby' :: EnterStandby -> Bool
shouldDecrementDesiredCapacity} -> Bool
shouldDecrementDesiredCapacity) (\s :: EnterStandby
s@EnterStandby' {} Bool
a -> EnterStandby
s {$sel:shouldDecrementDesiredCapacity:EnterStandby' :: Bool
shouldDecrementDesiredCapacity = Bool
a} :: EnterStandby)
instance Core.AWSRequest EnterStandby where
type AWSResponse EnterStandby = EnterStandbyResponse
request :: EnterStandby -> Request EnterStandby
request = Service -> EnterStandby -> Request EnterStandby
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy EnterStandby
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnterStandby)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse EnterStandby))
-> Logger
-> Service
-> Proxy EnterStandby
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnterStandby)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"EnterStandbyResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [Activity] -> Int -> EnterStandbyResponse
EnterStandbyResponse'
(Maybe [Activity] -> Int -> EnterStandbyResponse)
-> Either String (Maybe [Activity])
-> Either String (Int -> EnterStandbyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Activities" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Activity]))
-> Either String (Maybe [Activity])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Activity])
-> [Node] -> Either String (Maybe [Activity])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Activity]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> EnterStandbyResponse)
-> Either String Int -> Either String EnterStandbyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable EnterStandby
instance Prelude.NFData EnterStandby
instance Core.ToHeaders EnterStandby where
toHeaders :: EnterStandby -> ResponseHeaders
toHeaders = ResponseHeaders -> EnterStandby -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath EnterStandby where
toPath :: EnterStandby -> ByteString
toPath = ByteString -> EnterStandby -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery EnterStandby where
toQuery :: EnterStandby -> QueryString
toQuery EnterStandby' {Bool
Maybe [Text]
Text
shouldDecrementDesiredCapacity :: Bool
autoScalingGroupName :: Text
instanceIds :: Maybe [Text]
$sel:shouldDecrementDesiredCapacity:EnterStandby' :: EnterStandby -> Bool
$sel:autoScalingGroupName:EnterStandby' :: EnterStandby -> Text
$sel:instanceIds:EnterStandby' :: EnterStandby -> Maybe [Text]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"EnterStandby" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
ByteString
"InstanceIds"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
instanceIds),
ByteString
"AutoScalingGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
autoScalingGroupName,
ByteString
"ShouldDecrementDesiredCapacity"
ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
shouldDecrementDesiredCapacity
]
data EnterStandbyResponse = EnterStandbyResponse'
{
EnterStandbyResponse -> Maybe [Activity]
activities :: Prelude.Maybe [Activity],
EnterStandbyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (EnterStandbyResponse -> EnterStandbyResponse -> Bool
(EnterStandbyResponse -> EnterStandbyResponse -> Bool)
-> (EnterStandbyResponse -> EnterStandbyResponse -> Bool)
-> Eq EnterStandbyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnterStandbyResponse -> EnterStandbyResponse -> Bool
$c/= :: EnterStandbyResponse -> EnterStandbyResponse -> Bool
== :: EnterStandbyResponse -> EnterStandbyResponse -> Bool
$c== :: EnterStandbyResponse -> EnterStandbyResponse -> Bool
Prelude.Eq, ReadPrec [EnterStandbyResponse]
ReadPrec EnterStandbyResponse
Int -> ReadS EnterStandbyResponse
ReadS [EnterStandbyResponse]
(Int -> ReadS EnterStandbyResponse)
-> ReadS [EnterStandbyResponse]
-> ReadPrec EnterStandbyResponse
-> ReadPrec [EnterStandbyResponse]
-> Read EnterStandbyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnterStandbyResponse]
$creadListPrec :: ReadPrec [EnterStandbyResponse]
readPrec :: ReadPrec EnterStandbyResponse
$creadPrec :: ReadPrec EnterStandbyResponse
readList :: ReadS [EnterStandbyResponse]
$creadList :: ReadS [EnterStandbyResponse]
readsPrec :: Int -> ReadS EnterStandbyResponse
$creadsPrec :: Int -> ReadS EnterStandbyResponse
Prelude.Read, Int -> EnterStandbyResponse -> ShowS
[EnterStandbyResponse] -> ShowS
EnterStandbyResponse -> String
(Int -> EnterStandbyResponse -> ShowS)
-> (EnterStandbyResponse -> String)
-> ([EnterStandbyResponse] -> ShowS)
-> Show EnterStandbyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnterStandbyResponse] -> ShowS
$cshowList :: [EnterStandbyResponse] -> ShowS
show :: EnterStandbyResponse -> String
$cshow :: EnterStandbyResponse -> String
showsPrec :: Int -> EnterStandbyResponse -> ShowS
$cshowsPrec :: Int -> EnterStandbyResponse -> ShowS
Prelude.Show, (forall x. EnterStandbyResponse -> Rep EnterStandbyResponse x)
-> (forall x. Rep EnterStandbyResponse x -> EnterStandbyResponse)
-> Generic EnterStandbyResponse
forall x. Rep EnterStandbyResponse x -> EnterStandbyResponse
forall x. EnterStandbyResponse -> Rep EnterStandbyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnterStandbyResponse x -> EnterStandbyResponse
$cfrom :: forall x. EnterStandbyResponse -> Rep EnterStandbyResponse x
Prelude.Generic)
newEnterStandbyResponse ::
Prelude.Int ->
EnterStandbyResponse
newEnterStandbyResponse :: Int -> EnterStandbyResponse
newEnterStandbyResponse Int
pHttpStatus_ =
EnterStandbyResponse' :: Maybe [Activity] -> Int -> EnterStandbyResponse
EnterStandbyResponse'
{ $sel:activities:EnterStandbyResponse' :: Maybe [Activity]
activities = Maybe [Activity]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:EnterStandbyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
enterStandbyResponse_activities :: Lens.Lens' EnterStandbyResponse (Prelude.Maybe [Activity])
enterStandbyResponse_activities :: (Maybe [Activity] -> f (Maybe [Activity]))
-> EnterStandbyResponse -> f EnterStandbyResponse
enterStandbyResponse_activities = (EnterStandbyResponse -> Maybe [Activity])
-> (EnterStandbyResponse
-> Maybe [Activity] -> EnterStandbyResponse)
-> Lens
EnterStandbyResponse
EnterStandbyResponse
(Maybe [Activity])
(Maybe [Activity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnterStandbyResponse' {Maybe [Activity]
activities :: Maybe [Activity]
$sel:activities:EnterStandbyResponse' :: EnterStandbyResponse -> Maybe [Activity]
activities} -> Maybe [Activity]
activities) (\s :: EnterStandbyResponse
s@EnterStandbyResponse' {} Maybe [Activity]
a -> EnterStandbyResponse
s {$sel:activities:EnterStandbyResponse' :: Maybe [Activity]
activities = Maybe [Activity]
a} :: EnterStandbyResponse) ((Maybe [Activity] -> f (Maybe [Activity]))
-> EnterStandbyResponse -> f EnterStandbyResponse)
-> ((Maybe [Activity] -> f (Maybe [Activity]))
-> Maybe [Activity] -> f (Maybe [Activity]))
-> (Maybe [Activity] -> f (Maybe [Activity]))
-> EnterStandbyResponse
-> f EnterStandbyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Activity] [Activity] [Activity] [Activity]
-> Iso
(Maybe [Activity])
(Maybe [Activity])
(Maybe [Activity])
(Maybe [Activity])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Activity] [Activity] [Activity] [Activity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
enterStandbyResponse_httpStatus :: Lens.Lens' EnterStandbyResponse Prelude.Int
enterStandbyResponse_httpStatus :: (Int -> f Int) -> EnterStandbyResponse -> f EnterStandbyResponse
enterStandbyResponse_httpStatus = (EnterStandbyResponse -> Int)
-> (EnterStandbyResponse -> Int -> EnterStandbyResponse)
-> Lens EnterStandbyResponse EnterStandbyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnterStandbyResponse' {Int
httpStatus :: Int
$sel:httpStatus:EnterStandbyResponse' :: EnterStandbyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: EnterStandbyResponse
s@EnterStandbyResponse' {} Int
a -> EnterStandbyResponse
s {$sel:httpStatus:EnterStandbyResponse' :: Int
httpStatus = Int
a} :: EnterStandbyResponse)
instance Prelude.NFData EnterStandbyResponse