{-# 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.TerminateInstanceInAutoScalingGroup
(
TerminateInstanceInAutoScalingGroup (..),
newTerminateInstanceInAutoScalingGroup,
terminateInstanceInAutoScalingGroup_instanceId,
terminateInstanceInAutoScalingGroup_shouldDecrementDesiredCapacity,
TerminateInstanceInAutoScalingGroupResponse (..),
newTerminateInstanceInAutoScalingGroupResponse,
terminateInstanceInAutoScalingGroupResponse_activity,
terminateInstanceInAutoScalingGroupResponse_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 TerminateInstanceInAutoScalingGroup = TerminateInstanceInAutoScalingGroup'
{
TerminateInstanceInAutoScalingGroup -> Text
instanceId :: Prelude.Text,
TerminateInstanceInAutoScalingGroup -> Bool
shouldDecrementDesiredCapacity :: Prelude.Bool
}
deriving (TerminateInstanceInAutoScalingGroup
-> TerminateInstanceInAutoScalingGroup -> Bool
(TerminateInstanceInAutoScalingGroup
-> TerminateInstanceInAutoScalingGroup -> Bool)
-> (TerminateInstanceInAutoScalingGroup
-> TerminateInstanceInAutoScalingGroup -> Bool)
-> Eq TerminateInstanceInAutoScalingGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateInstanceInAutoScalingGroup
-> TerminateInstanceInAutoScalingGroup -> Bool
$c/= :: TerminateInstanceInAutoScalingGroup
-> TerminateInstanceInAutoScalingGroup -> Bool
== :: TerminateInstanceInAutoScalingGroup
-> TerminateInstanceInAutoScalingGroup -> Bool
$c== :: TerminateInstanceInAutoScalingGroup
-> TerminateInstanceInAutoScalingGroup -> Bool
Prelude.Eq, ReadPrec [TerminateInstanceInAutoScalingGroup]
ReadPrec TerminateInstanceInAutoScalingGroup
Int -> ReadS TerminateInstanceInAutoScalingGroup
ReadS [TerminateInstanceInAutoScalingGroup]
(Int -> ReadS TerminateInstanceInAutoScalingGroup)
-> ReadS [TerminateInstanceInAutoScalingGroup]
-> ReadPrec TerminateInstanceInAutoScalingGroup
-> ReadPrec [TerminateInstanceInAutoScalingGroup]
-> Read TerminateInstanceInAutoScalingGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateInstanceInAutoScalingGroup]
$creadListPrec :: ReadPrec [TerminateInstanceInAutoScalingGroup]
readPrec :: ReadPrec TerminateInstanceInAutoScalingGroup
$creadPrec :: ReadPrec TerminateInstanceInAutoScalingGroup
readList :: ReadS [TerminateInstanceInAutoScalingGroup]
$creadList :: ReadS [TerminateInstanceInAutoScalingGroup]
readsPrec :: Int -> ReadS TerminateInstanceInAutoScalingGroup
$creadsPrec :: Int -> ReadS TerminateInstanceInAutoScalingGroup
Prelude.Read, Int -> TerminateInstanceInAutoScalingGroup -> ShowS
[TerminateInstanceInAutoScalingGroup] -> ShowS
TerminateInstanceInAutoScalingGroup -> String
(Int -> TerminateInstanceInAutoScalingGroup -> ShowS)
-> (TerminateInstanceInAutoScalingGroup -> String)
-> ([TerminateInstanceInAutoScalingGroup] -> ShowS)
-> Show TerminateInstanceInAutoScalingGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateInstanceInAutoScalingGroup] -> ShowS
$cshowList :: [TerminateInstanceInAutoScalingGroup] -> ShowS
show :: TerminateInstanceInAutoScalingGroup -> String
$cshow :: TerminateInstanceInAutoScalingGroup -> String
showsPrec :: Int -> TerminateInstanceInAutoScalingGroup -> ShowS
$cshowsPrec :: Int -> TerminateInstanceInAutoScalingGroup -> ShowS
Prelude.Show, (forall x.
TerminateInstanceInAutoScalingGroup
-> Rep TerminateInstanceInAutoScalingGroup x)
-> (forall x.
Rep TerminateInstanceInAutoScalingGroup x
-> TerminateInstanceInAutoScalingGroup)
-> Generic TerminateInstanceInAutoScalingGroup
forall x.
Rep TerminateInstanceInAutoScalingGroup x
-> TerminateInstanceInAutoScalingGroup
forall x.
TerminateInstanceInAutoScalingGroup
-> Rep TerminateInstanceInAutoScalingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TerminateInstanceInAutoScalingGroup x
-> TerminateInstanceInAutoScalingGroup
$cfrom :: forall x.
TerminateInstanceInAutoScalingGroup
-> Rep TerminateInstanceInAutoScalingGroup x
Prelude.Generic)
newTerminateInstanceInAutoScalingGroup ::
Prelude.Text ->
Prelude.Bool ->
TerminateInstanceInAutoScalingGroup
newTerminateInstanceInAutoScalingGroup :: Text -> Bool -> TerminateInstanceInAutoScalingGroup
newTerminateInstanceInAutoScalingGroup
Text
pInstanceId_
Bool
pShouldDecrementDesiredCapacity_ =
TerminateInstanceInAutoScalingGroup' :: Text -> Bool -> TerminateInstanceInAutoScalingGroup
TerminateInstanceInAutoScalingGroup'
{ $sel:instanceId:TerminateInstanceInAutoScalingGroup' :: Text
instanceId =
Text
pInstanceId_,
$sel:shouldDecrementDesiredCapacity:TerminateInstanceInAutoScalingGroup' :: Bool
shouldDecrementDesiredCapacity =
Bool
pShouldDecrementDesiredCapacity_
}
terminateInstanceInAutoScalingGroup_instanceId :: Lens.Lens' TerminateInstanceInAutoScalingGroup Prelude.Text
terminateInstanceInAutoScalingGroup_instanceId :: (Text -> f Text)
-> TerminateInstanceInAutoScalingGroup
-> f TerminateInstanceInAutoScalingGroup
terminateInstanceInAutoScalingGroup_instanceId = (TerminateInstanceInAutoScalingGroup -> Text)
-> (TerminateInstanceInAutoScalingGroup
-> Text -> TerminateInstanceInAutoScalingGroup)
-> Lens
TerminateInstanceInAutoScalingGroup
TerminateInstanceInAutoScalingGroup
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateInstanceInAutoScalingGroup' {Text
instanceId :: Text
$sel:instanceId:TerminateInstanceInAutoScalingGroup' :: TerminateInstanceInAutoScalingGroup -> Text
instanceId} -> Text
instanceId) (\s :: TerminateInstanceInAutoScalingGroup
s@TerminateInstanceInAutoScalingGroup' {} Text
a -> TerminateInstanceInAutoScalingGroup
s {$sel:instanceId:TerminateInstanceInAutoScalingGroup' :: Text
instanceId = Text
a} :: TerminateInstanceInAutoScalingGroup)
terminateInstanceInAutoScalingGroup_shouldDecrementDesiredCapacity :: Lens.Lens' TerminateInstanceInAutoScalingGroup Prelude.Bool
terminateInstanceInAutoScalingGroup_shouldDecrementDesiredCapacity :: (Bool -> f Bool)
-> TerminateInstanceInAutoScalingGroup
-> f TerminateInstanceInAutoScalingGroup
terminateInstanceInAutoScalingGroup_shouldDecrementDesiredCapacity = (TerminateInstanceInAutoScalingGroup -> Bool)
-> (TerminateInstanceInAutoScalingGroup
-> Bool -> TerminateInstanceInAutoScalingGroup)
-> Lens
TerminateInstanceInAutoScalingGroup
TerminateInstanceInAutoScalingGroup
Bool
Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateInstanceInAutoScalingGroup' {Bool
shouldDecrementDesiredCapacity :: Bool
$sel:shouldDecrementDesiredCapacity:TerminateInstanceInAutoScalingGroup' :: TerminateInstanceInAutoScalingGroup -> Bool
shouldDecrementDesiredCapacity} -> Bool
shouldDecrementDesiredCapacity) (\s :: TerminateInstanceInAutoScalingGroup
s@TerminateInstanceInAutoScalingGroup' {} Bool
a -> TerminateInstanceInAutoScalingGroup
s {$sel:shouldDecrementDesiredCapacity:TerminateInstanceInAutoScalingGroup' :: Bool
shouldDecrementDesiredCapacity = Bool
a} :: TerminateInstanceInAutoScalingGroup)
instance
Core.AWSRequest
TerminateInstanceInAutoScalingGroup
where
type
AWSResponse TerminateInstanceInAutoScalingGroup =
TerminateInstanceInAutoScalingGroupResponse
request :: TerminateInstanceInAutoScalingGroup
-> Request TerminateInstanceInAutoScalingGroup
request = Service
-> TerminateInstanceInAutoScalingGroup
-> Request TerminateInstanceInAutoScalingGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy TerminateInstanceInAutoScalingGroup
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse TerminateInstanceInAutoScalingGroup)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse TerminateInstanceInAutoScalingGroup))
-> Logger
-> Service
-> Proxy TerminateInstanceInAutoScalingGroup
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse TerminateInstanceInAutoScalingGroup)))
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
"TerminateInstanceInAutoScalingGroupResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Activity
-> Int -> TerminateInstanceInAutoScalingGroupResponse
TerminateInstanceInAutoScalingGroupResponse'
(Maybe Activity
-> Int -> TerminateInstanceInAutoScalingGroupResponse)
-> Either String (Maybe Activity)
-> Either
String (Int -> TerminateInstanceInAutoScalingGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Activity)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Activity")
Either String (Int -> TerminateInstanceInAutoScalingGroupResponse)
-> Either String Int
-> Either String TerminateInstanceInAutoScalingGroupResponse
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
TerminateInstanceInAutoScalingGroup
instance
Prelude.NFData
TerminateInstanceInAutoScalingGroup
instance
Core.ToHeaders
TerminateInstanceInAutoScalingGroup
where
toHeaders :: TerminateInstanceInAutoScalingGroup -> ResponseHeaders
toHeaders = ResponseHeaders
-> TerminateInstanceInAutoScalingGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance
Core.ToPath
TerminateInstanceInAutoScalingGroup
where
toPath :: TerminateInstanceInAutoScalingGroup -> ByteString
toPath = ByteString -> TerminateInstanceInAutoScalingGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance
Core.ToQuery
TerminateInstanceInAutoScalingGroup
where
toQuery :: TerminateInstanceInAutoScalingGroup -> QueryString
toQuery TerminateInstanceInAutoScalingGroup' {Bool
Text
shouldDecrementDesiredCapacity :: Bool
instanceId :: Text
$sel:shouldDecrementDesiredCapacity:TerminateInstanceInAutoScalingGroup' :: TerminateInstanceInAutoScalingGroup -> Bool
$sel:instanceId:TerminateInstanceInAutoScalingGroup' :: TerminateInstanceInAutoScalingGroup -> 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
"TerminateInstanceInAutoScalingGroup" ::
Prelude.ByteString
),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
ByteString
"InstanceId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
instanceId,
ByteString
"ShouldDecrementDesiredCapacity"
ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
shouldDecrementDesiredCapacity
]
data TerminateInstanceInAutoScalingGroupResponse = TerminateInstanceInAutoScalingGroupResponse'
{
TerminateInstanceInAutoScalingGroupResponse -> Maybe Activity
activity :: Prelude.Maybe Activity,
TerminateInstanceInAutoScalingGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TerminateInstanceInAutoScalingGroupResponse
-> TerminateInstanceInAutoScalingGroupResponse -> Bool
(TerminateInstanceInAutoScalingGroupResponse
-> TerminateInstanceInAutoScalingGroupResponse -> Bool)
-> (TerminateInstanceInAutoScalingGroupResponse
-> TerminateInstanceInAutoScalingGroupResponse -> Bool)
-> Eq TerminateInstanceInAutoScalingGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateInstanceInAutoScalingGroupResponse
-> TerminateInstanceInAutoScalingGroupResponse -> Bool
$c/= :: TerminateInstanceInAutoScalingGroupResponse
-> TerminateInstanceInAutoScalingGroupResponse -> Bool
== :: TerminateInstanceInAutoScalingGroupResponse
-> TerminateInstanceInAutoScalingGroupResponse -> Bool
$c== :: TerminateInstanceInAutoScalingGroupResponse
-> TerminateInstanceInAutoScalingGroupResponse -> Bool
Prelude.Eq, ReadPrec [TerminateInstanceInAutoScalingGroupResponse]
ReadPrec TerminateInstanceInAutoScalingGroupResponse
Int -> ReadS TerminateInstanceInAutoScalingGroupResponse
ReadS [TerminateInstanceInAutoScalingGroupResponse]
(Int -> ReadS TerminateInstanceInAutoScalingGroupResponse)
-> ReadS [TerminateInstanceInAutoScalingGroupResponse]
-> ReadPrec TerminateInstanceInAutoScalingGroupResponse
-> ReadPrec [TerminateInstanceInAutoScalingGroupResponse]
-> Read TerminateInstanceInAutoScalingGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateInstanceInAutoScalingGroupResponse]
$creadListPrec :: ReadPrec [TerminateInstanceInAutoScalingGroupResponse]
readPrec :: ReadPrec TerminateInstanceInAutoScalingGroupResponse
$creadPrec :: ReadPrec TerminateInstanceInAutoScalingGroupResponse
readList :: ReadS [TerminateInstanceInAutoScalingGroupResponse]
$creadList :: ReadS [TerminateInstanceInAutoScalingGroupResponse]
readsPrec :: Int -> ReadS TerminateInstanceInAutoScalingGroupResponse
$creadsPrec :: Int -> ReadS TerminateInstanceInAutoScalingGroupResponse
Prelude.Read, Int -> TerminateInstanceInAutoScalingGroupResponse -> ShowS
[TerminateInstanceInAutoScalingGroupResponse] -> ShowS
TerminateInstanceInAutoScalingGroupResponse -> String
(Int -> TerminateInstanceInAutoScalingGroupResponse -> ShowS)
-> (TerminateInstanceInAutoScalingGroupResponse -> String)
-> ([TerminateInstanceInAutoScalingGroupResponse] -> ShowS)
-> Show TerminateInstanceInAutoScalingGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateInstanceInAutoScalingGroupResponse] -> ShowS
$cshowList :: [TerminateInstanceInAutoScalingGroupResponse] -> ShowS
show :: TerminateInstanceInAutoScalingGroupResponse -> String
$cshow :: TerminateInstanceInAutoScalingGroupResponse -> String
showsPrec :: Int -> TerminateInstanceInAutoScalingGroupResponse -> ShowS
$cshowsPrec :: Int -> TerminateInstanceInAutoScalingGroupResponse -> ShowS
Prelude.Show, (forall x.
TerminateInstanceInAutoScalingGroupResponse
-> Rep TerminateInstanceInAutoScalingGroupResponse x)
-> (forall x.
Rep TerminateInstanceInAutoScalingGroupResponse x
-> TerminateInstanceInAutoScalingGroupResponse)
-> Generic TerminateInstanceInAutoScalingGroupResponse
forall x.
Rep TerminateInstanceInAutoScalingGroupResponse x
-> TerminateInstanceInAutoScalingGroupResponse
forall x.
TerminateInstanceInAutoScalingGroupResponse
-> Rep TerminateInstanceInAutoScalingGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TerminateInstanceInAutoScalingGroupResponse x
-> TerminateInstanceInAutoScalingGroupResponse
$cfrom :: forall x.
TerminateInstanceInAutoScalingGroupResponse
-> Rep TerminateInstanceInAutoScalingGroupResponse x
Prelude.Generic)
newTerminateInstanceInAutoScalingGroupResponse ::
Prelude.Int ->
TerminateInstanceInAutoScalingGroupResponse
newTerminateInstanceInAutoScalingGroupResponse :: Int -> TerminateInstanceInAutoScalingGroupResponse
newTerminateInstanceInAutoScalingGroupResponse
Int
pHttpStatus_ =
TerminateInstanceInAutoScalingGroupResponse' :: Maybe Activity
-> Int -> TerminateInstanceInAutoScalingGroupResponse
TerminateInstanceInAutoScalingGroupResponse'
{ $sel:activity:TerminateInstanceInAutoScalingGroupResponse' :: Maybe Activity
activity =
Maybe Activity
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TerminateInstanceInAutoScalingGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
terminateInstanceInAutoScalingGroupResponse_activity :: Lens.Lens' TerminateInstanceInAutoScalingGroupResponse (Prelude.Maybe Activity)
terminateInstanceInAutoScalingGroupResponse_activity :: (Maybe Activity -> f (Maybe Activity))
-> TerminateInstanceInAutoScalingGroupResponse
-> f TerminateInstanceInAutoScalingGroupResponse
terminateInstanceInAutoScalingGroupResponse_activity = (TerminateInstanceInAutoScalingGroupResponse -> Maybe Activity)
-> (TerminateInstanceInAutoScalingGroupResponse
-> Maybe Activity -> TerminateInstanceInAutoScalingGroupResponse)
-> Lens
TerminateInstanceInAutoScalingGroupResponse
TerminateInstanceInAutoScalingGroupResponse
(Maybe Activity)
(Maybe Activity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateInstanceInAutoScalingGroupResponse' {Maybe Activity
activity :: Maybe Activity
$sel:activity:TerminateInstanceInAutoScalingGroupResponse' :: TerminateInstanceInAutoScalingGroupResponse -> Maybe Activity
activity} -> Maybe Activity
activity) (\s :: TerminateInstanceInAutoScalingGroupResponse
s@TerminateInstanceInAutoScalingGroupResponse' {} Maybe Activity
a -> TerminateInstanceInAutoScalingGroupResponse
s {$sel:activity:TerminateInstanceInAutoScalingGroupResponse' :: Maybe Activity
activity = Maybe Activity
a} :: TerminateInstanceInAutoScalingGroupResponse)
terminateInstanceInAutoScalingGroupResponse_httpStatus :: Lens.Lens' TerminateInstanceInAutoScalingGroupResponse Prelude.Int
terminateInstanceInAutoScalingGroupResponse_httpStatus :: (Int -> f Int)
-> TerminateInstanceInAutoScalingGroupResponse
-> f TerminateInstanceInAutoScalingGroupResponse
terminateInstanceInAutoScalingGroupResponse_httpStatus = (TerminateInstanceInAutoScalingGroupResponse -> Int)
-> (TerminateInstanceInAutoScalingGroupResponse
-> Int -> TerminateInstanceInAutoScalingGroupResponse)
-> Lens
TerminateInstanceInAutoScalingGroupResponse
TerminateInstanceInAutoScalingGroupResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateInstanceInAutoScalingGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:TerminateInstanceInAutoScalingGroupResponse' :: TerminateInstanceInAutoScalingGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TerminateInstanceInAutoScalingGroupResponse
s@TerminateInstanceInAutoScalingGroupResponse' {} Int
a -> TerminateInstanceInAutoScalingGroupResponse
s {$sel:httpStatus:TerminateInstanceInAutoScalingGroupResponse' :: Int
httpStatus = Int
a} :: TerminateInstanceInAutoScalingGroupResponse)
instance
Prelude.NFData
TerminateInstanceInAutoScalingGroupResponse