{-# 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.SetInstanceProtection
(
SetInstanceProtection (..),
newSetInstanceProtection,
setInstanceProtection_instanceIds,
setInstanceProtection_autoScalingGroupName,
setInstanceProtection_protectedFromScaleIn,
SetInstanceProtectionResponse (..),
newSetInstanceProtectionResponse,
setInstanceProtectionResponse_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 SetInstanceProtection = SetInstanceProtection'
{
SetInstanceProtection -> [Text]
instanceIds :: [Prelude.Text],
SetInstanceProtection -> Text
autoScalingGroupName :: Prelude.Text,
SetInstanceProtection -> Bool
protectedFromScaleIn :: Prelude.Bool
}
deriving (SetInstanceProtection -> SetInstanceProtection -> Bool
(SetInstanceProtection -> SetInstanceProtection -> Bool)
-> (SetInstanceProtection -> SetInstanceProtection -> Bool)
-> Eq SetInstanceProtection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetInstanceProtection -> SetInstanceProtection -> Bool
$c/= :: SetInstanceProtection -> SetInstanceProtection -> Bool
== :: SetInstanceProtection -> SetInstanceProtection -> Bool
$c== :: SetInstanceProtection -> SetInstanceProtection -> Bool
Prelude.Eq, ReadPrec [SetInstanceProtection]
ReadPrec SetInstanceProtection
Int -> ReadS SetInstanceProtection
ReadS [SetInstanceProtection]
(Int -> ReadS SetInstanceProtection)
-> ReadS [SetInstanceProtection]
-> ReadPrec SetInstanceProtection
-> ReadPrec [SetInstanceProtection]
-> Read SetInstanceProtection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetInstanceProtection]
$creadListPrec :: ReadPrec [SetInstanceProtection]
readPrec :: ReadPrec SetInstanceProtection
$creadPrec :: ReadPrec SetInstanceProtection
readList :: ReadS [SetInstanceProtection]
$creadList :: ReadS [SetInstanceProtection]
readsPrec :: Int -> ReadS SetInstanceProtection
$creadsPrec :: Int -> ReadS SetInstanceProtection
Prelude.Read, Int -> SetInstanceProtection -> ShowS
[SetInstanceProtection] -> ShowS
SetInstanceProtection -> String
(Int -> SetInstanceProtection -> ShowS)
-> (SetInstanceProtection -> String)
-> ([SetInstanceProtection] -> ShowS)
-> Show SetInstanceProtection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetInstanceProtection] -> ShowS
$cshowList :: [SetInstanceProtection] -> ShowS
show :: SetInstanceProtection -> String
$cshow :: SetInstanceProtection -> String
showsPrec :: Int -> SetInstanceProtection -> ShowS
$cshowsPrec :: Int -> SetInstanceProtection -> ShowS
Prelude.Show, (forall x. SetInstanceProtection -> Rep SetInstanceProtection x)
-> (forall x. Rep SetInstanceProtection x -> SetInstanceProtection)
-> Generic SetInstanceProtection
forall x. Rep SetInstanceProtection x -> SetInstanceProtection
forall x. SetInstanceProtection -> Rep SetInstanceProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetInstanceProtection x -> SetInstanceProtection
$cfrom :: forall x. SetInstanceProtection -> Rep SetInstanceProtection x
Prelude.Generic)
newSetInstanceProtection ::
Prelude.Text ->
Prelude.Bool ->
SetInstanceProtection
newSetInstanceProtection :: Text -> Bool -> SetInstanceProtection
newSetInstanceProtection
Text
pAutoScalingGroupName_
Bool
pProtectedFromScaleIn_ =
SetInstanceProtection' :: [Text] -> Text -> Bool -> SetInstanceProtection
SetInstanceProtection'
{ $sel:instanceIds:SetInstanceProtection' :: [Text]
instanceIds =
[Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:autoScalingGroupName:SetInstanceProtection' :: Text
autoScalingGroupName = Text
pAutoScalingGroupName_,
$sel:protectedFromScaleIn:SetInstanceProtection' :: Bool
protectedFromScaleIn = Bool
pProtectedFromScaleIn_
}
setInstanceProtection_instanceIds :: Lens.Lens' SetInstanceProtection [Prelude.Text]
setInstanceProtection_instanceIds :: ([Text] -> f [Text])
-> SetInstanceProtection -> f SetInstanceProtection
setInstanceProtection_instanceIds = (SetInstanceProtection -> [Text])
-> (SetInstanceProtection -> [Text] -> SetInstanceProtection)
-> Lens SetInstanceProtection SetInstanceProtection [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetInstanceProtection' {[Text]
instanceIds :: [Text]
$sel:instanceIds:SetInstanceProtection' :: SetInstanceProtection -> [Text]
instanceIds} -> [Text]
instanceIds) (\s :: SetInstanceProtection
s@SetInstanceProtection' {} [Text]
a -> SetInstanceProtection
s {$sel:instanceIds:SetInstanceProtection' :: [Text]
instanceIds = [Text]
a} :: SetInstanceProtection) (([Text] -> f [Text])
-> SetInstanceProtection -> f SetInstanceProtection)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> SetInstanceProtection
-> f SetInstanceProtection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
setInstanceProtection_autoScalingGroupName :: Lens.Lens' SetInstanceProtection Prelude.Text
setInstanceProtection_autoScalingGroupName :: (Text -> f Text)
-> SetInstanceProtection -> f SetInstanceProtection
setInstanceProtection_autoScalingGroupName = (SetInstanceProtection -> Text)
-> (SetInstanceProtection -> Text -> SetInstanceProtection)
-> Lens SetInstanceProtection SetInstanceProtection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetInstanceProtection' {Text
autoScalingGroupName :: Text
$sel:autoScalingGroupName:SetInstanceProtection' :: SetInstanceProtection -> Text
autoScalingGroupName} -> Text
autoScalingGroupName) (\s :: SetInstanceProtection
s@SetInstanceProtection' {} Text
a -> SetInstanceProtection
s {$sel:autoScalingGroupName:SetInstanceProtection' :: Text
autoScalingGroupName = Text
a} :: SetInstanceProtection)
setInstanceProtection_protectedFromScaleIn :: Lens.Lens' SetInstanceProtection Prelude.Bool
setInstanceProtection_protectedFromScaleIn :: (Bool -> f Bool)
-> SetInstanceProtection -> f SetInstanceProtection
setInstanceProtection_protectedFromScaleIn = (SetInstanceProtection -> Bool)
-> (SetInstanceProtection -> Bool -> SetInstanceProtection)
-> Lens SetInstanceProtection SetInstanceProtection Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetInstanceProtection' {Bool
protectedFromScaleIn :: Bool
$sel:protectedFromScaleIn:SetInstanceProtection' :: SetInstanceProtection -> Bool
protectedFromScaleIn} -> Bool
protectedFromScaleIn) (\s :: SetInstanceProtection
s@SetInstanceProtection' {} Bool
a -> SetInstanceProtection
s {$sel:protectedFromScaleIn:SetInstanceProtection' :: Bool
protectedFromScaleIn = Bool
a} :: SetInstanceProtection)
instance Core.AWSRequest SetInstanceProtection where
type
AWSResponse SetInstanceProtection =
SetInstanceProtectionResponse
request :: SetInstanceProtection -> Request SetInstanceProtection
request = Service -> SetInstanceProtection -> Request SetInstanceProtection
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy SetInstanceProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetInstanceProtection)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse SetInstanceProtection))
-> Logger
-> Service
-> Proxy SetInstanceProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetInstanceProtection)))
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
"SetInstanceProtectionResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> SetInstanceProtectionResponse
SetInstanceProtectionResponse'
(Int -> SetInstanceProtectionResponse)
-> Either String Int -> Either String SetInstanceProtectionResponse
forall (f :: * -> *) a b. Functor 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 SetInstanceProtection
instance Prelude.NFData SetInstanceProtection
instance Core.ToHeaders SetInstanceProtection where
toHeaders :: SetInstanceProtection -> ResponseHeaders
toHeaders = ResponseHeaders -> SetInstanceProtection -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath SetInstanceProtection where
toPath :: SetInstanceProtection -> ByteString
toPath = ByteString -> SetInstanceProtection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SetInstanceProtection where
toQuery :: SetInstanceProtection -> QueryString
toQuery SetInstanceProtection' {Bool
[Text]
Text
protectedFromScaleIn :: Bool
autoScalingGroupName :: Text
instanceIds :: [Text]
$sel:protectedFromScaleIn:SetInstanceProtection' :: SetInstanceProtection -> Bool
$sel:autoScalingGroupName:SetInstanceProtection' :: SetInstanceProtection -> Text
$sel:instanceIds:SetInstanceProtection' :: SetInstanceProtection -> [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
"SetInstanceProtection" :: 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.=: ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Text]
instanceIds,
ByteString
"AutoScalingGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
autoScalingGroupName,
ByteString
"ProtectedFromScaleIn" ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
protectedFromScaleIn
]
data SetInstanceProtectionResponse = SetInstanceProtectionResponse'
{
SetInstanceProtectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SetInstanceProtectionResponse
-> SetInstanceProtectionResponse -> Bool
(SetInstanceProtectionResponse
-> SetInstanceProtectionResponse -> Bool)
-> (SetInstanceProtectionResponse
-> SetInstanceProtectionResponse -> Bool)
-> Eq SetInstanceProtectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetInstanceProtectionResponse
-> SetInstanceProtectionResponse -> Bool
$c/= :: SetInstanceProtectionResponse
-> SetInstanceProtectionResponse -> Bool
== :: SetInstanceProtectionResponse
-> SetInstanceProtectionResponse -> Bool
$c== :: SetInstanceProtectionResponse
-> SetInstanceProtectionResponse -> Bool
Prelude.Eq, ReadPrec [SetInstanceProtectionResponse]
ReadPrec SetInstanceProtectionResponse
Int -> ReadS SetInstanceProtectionResponse
ReadS [SetInstanceProtectionResponse]
(Int -> ReadS SetInstanceProtectionResponse)
-> ReadS [SetInstanceProtectionResponse]
-> ReadPrec SetInstanceProtectionResponse
-> ReadPrec [SetInstanceProtectionResponse]
-> Read SetInstanceProtectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetInstanceProtectionResponse]
$creadListPrec :: ReadPrec [SetInstanceProtectionResponse]
readPrec :: ReadPrec SetInstanceProtectionResponse
$creadPrec :: ReadPrec SetInstanceProtectionResponse
readList :: ReadS [SetInstanceProtectionResponse]
$creadList :: ReadS [SetInstanceProtectionResponse]
readsPrec :: Int -> ReadS SetInstanceProtectionResponse
$creadsPrec :: Int -> ReadS SetInstanceProtectionResponse
Prelude.Read, Int -> SetInstanceProtectionResponse -> ShowS
[SetInstanceProtectionResponse] -> ShowS
SetInstanceProtectionResponse -> String
(Int -> SetInstanceProtectionResponse -> ShowS)
-> (SetInstanceProtectionResponse -> String)
-> ([SetInstanceProtectionResponse] -> ShowS)
-> Show SetInstanceProtectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetInstanceProtectionResponse] -> ShowS
$cshowList :: [SetInstanceProtectionResponse] -> ShowS
show :: SetInstanceProtectionResponse -> String
$cshow :: SetInstanceProtectionResponse -> String
showsPrec :: Int -> SetInstanceProtectionResponse -> ShowS
$cshowsPrec :: Int -> SetInstanceProtectionResponse -> ShowS
Prelude.Show, (forall x.
SetInstanceProtectionResponse
-> Rep SetInstanceProtectionResponse x)
-> (forall x.
Rep SetInstanceProtectionResponse x
-> SetInstanceProtectionResponse)
-> Generic SetInstanceProtectionResponse
forall x.
Rep SetInstanceProtectionResponse x
-> SetInstanceProtectionResponse
forall x.
SetInstanceProtectionResponse
-> Rep SetInstanceProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetInstanceProtectionResponse x
-> SetInstanceProtectionResponse
$cfrom :: forall x.
SetInstanceProtectionResponse
-> Rep SetInstanceProtectionResponse x
Prelude.Generic)
newSetInstanceProtectionResponse ::
Prelude.Int ->
SetInstanceProtectionResponse
newSetInstanceProtectionResponse :: Int -> SetInstanceProtectionResponse
newSetInstanceProtectionResponse Int
pHttpStatus_ =
SetInstanceProtectionResponse' :: Int -> SetInstanceProtectionResponse
SetInstanceProtectionResponse'
{ $sel:httpStatus:SetInstanceProtectionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
setInstanceProtectionResponse_httpStatus :: Lens.Lens' SetInstanceProtectionResponse Prelude.Int
setInstanceProtectionResponse_httpStatus :: (Int -> f Int)
-> SetInstanceProtectionResponse -> f SetInstanceProtectionResponse
setInstanceProtectionResponse_httpStatus = (SetInstanceProtectionResponse -> Int)
-> (SetInstanceProtectionResponse
-> Int -> SetInstanceProtectionResponse)
-> Lens
SetInstanceProtectionResponse SetInstanceProtectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetInstanceProtectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetInstanceProtectionResponse' :: SetInstanceProtectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetInstanceProtectionResponse
s@SetInstanceProtectionResponse' {} Int
a -> SetInstanceProtectionResponse
s {$sel:httpStatus:SetInstanceProtectionResponse' :: Int
httpStatus = Int
a} :: SetInstanceProtectionResponse)
instance Prelude.NFData SetInstanceProtectionResponse