{-# 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.CloudFormation.UpdateTerminationProtection
(
UpdateTerminationProtection (..),
newUpdateTerminationProtection,
updateTerminationProtection_enableTerminationProtection,
updateTerminationProtection_stackName,
UpdateTerminationProtectionResponse (..),
newUpdateTerminationProtectionResponse,
updateTerminationProtectionResponse_stackId,
updateTerminationProtectionResponse_httpStatus,
)
where
import Amazonka.CloudFormation.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateTerminationProtection = UpdateTerminationProtection'
{
UpdateTerminationProtection -> Bool
enableTerminationProtection :: Prelude.Bool,
UpdateTerminationProtection -> Text
stackName :: Prelude.Text
}
deriving (UpdateTerminationProtection -> UpdateTerminationProtection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTerminationProtection -> UpdateTerminationProtection -> Bool
$c/= :: UpdateTerminationProtection -> UpdateTerminationProtection -> Bool
== :: UpdateTerminationProtection -> UpdateTerminationProtection -> Bool
$c== :: UpdateTerminationProtection -> UpdateTerminationProtection -> Bool
Prelude.Eq, ReadPrec [UpdateTerminationProtection]
ReadPrec UpdateTerminationProtection
Int -> ReadS UpdateTerminationProtection
ReadS [UpdateTerminationProtection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTerminationProtection]
$creadListPrec :: ReadPrec [UpdateTerminationProtection]
readPrec :: ReadPrec UpdateTerminationProtection
$creadPrec :: ReadPrec UpdateTerminationProtection
readList :: ReadS [UpdateTerminationProtection]
$creadList :: ReadS [UpdateTerminationProtection]
readsPrec :: Int -> ReadS UpdateTerminationProtection
$creadsPrec :: Int -> ReadS UpdateTerminationProtection
Prelude.Read, Int -> UpdateTerminationProtection -> ShowS
[UpdateTerminationProtection] -> ShowS
UpdateTerminationProtection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTerminationProtection] -> ShowS
$cshowList :: [UpdateTerminationProtection] -> ShowS
show :: UpdateTerminationProtection -> String
$cshow :: UpdateTerminationProtection -> String
showsPrec :: Int -> UpdateTerminationProtection -> ShowS
$cshowsPrec :: Int -> UpdateTerminationProtection -> ShowS
Prelude.Show, forall x.
Rep UpdateTerminationProtection x -> UpdateTerminationProtection
forall x.
UpdateTerminationProtection -> Rep UpdateTerminationProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTerminationProtection x -> UpdateTerminationProtection
$cfrom :: forall x.
UpdateTerminationProtection -> Rep UpdateTerminationProtection x
Prelude.Generic)
newUpdateTerminationProtection ::
Prelude.Bool ->
Prelude.Text ->
UpdateTerminationProtection
newUpdateTerminationProtection :: Bool -> Text -> UpdateTerminationProtection
newUpdateTerminationProtection
Bool
pEnableTerminationProtection_
Text
pStackName_ =
UpdateTerminationProtection'
{ $sel:enableTerminationProtection:UpdateTerminationProtection' :: Bool
enableTerminationProtection =
Bool
pEnableTerminationProtection_,
$sel:stackName:UpdateTerminationProtection' :: Text
stackName = Text
pStackName_
}
updateTerminationProtection_enableTerminationProtection :: Lens.Lens' UpdateTerminationProtection Prelude.Bool
updateTerminationProtection_enableTerminationProtection :: Lens' UpdateTerminationProtection Bool
updateTerminationProtection_enableTerminationProtection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTerminationProtection' {Bool
enableTerminationProtection :: Bool
$sel:enableTerminationProtection:UpdateTerminationProtection' :: UpdateTerminationProtection -> Bool
enableTerminationProtection} -> Bool
enableTerminationProtection) (\s :: UpdateTerminationProtection
s@UpdateTerminationProtection' {} Bool
a -> UpdateTerminationProtection
s {$sel:enableTerminationProtection:UpdateTerminationProtection' :: Bool
enableTerminationProtection = Bool
a} :: UpdateTerminationProtection)
updateTerminationProtection_stackName :: Lens.Lens' UpdateTerminationProtection Prelude.Text
updateTerminationProtection_stackName :: Lens' UpdateTerminationProtection Text
updateTerminationProtection_stackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTerminationProtection' {Text
stackName :: Text
$sel:stackName:UpdateTerminationProtection' :: UpdateTerminationProtection -> Text
stackName} -> Text
stackName) (\s :: UpdateTerminationProtection
s@UpdateTerminationProtection' {} Text
a -> UpdateTerminationProtection
s {$sel:stackName:UpdateTerminationProtection' :: Text
stackName = Text
a} :: UpdateTerminationProtection)
instance Core.AWSRequest UpdateTerminationProtection where
type
AWSResponse UpdateTerminationProtection =
UpdateTerminationProtectionResponse
request :: (Service -> Service)
-> UpdateTerminationProtection
-> Request UpdateTerminationProtection
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateTerminationProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateTerminationProtection)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"UpdateTerminationProtectionResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> UpdateTerminationProtectionResponse
UpdateTerminationProtectionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"StackId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateTerminationProtection where
hashWithSalt :: Int -> UpdateTerminationProtection -> Int
hashWithSalt Int
_salt UpdateTerminationProtection' {Bool
Text
stackName :: Text
enableTerminationProtection :: Bool
$sel:stackName:UpdateTerminationProtection' :: UpdateTerminationProtection -> Text
$sel:enableTerminationProtection:UpdateTerminationProtection' :: UpdateTerminationProtection -> Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enableTerminationProtection
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stackName
instance Prelude.NFData UpdateTerminationProtection where
rnf :: UpdateTerminationProtection -> ()
rnf UpdateTerminationProtection' {Bool
Text
stackName :: Text
enableTerminationProtection :: Bool
$sel:stackName:UpdateTerminationProtection' :: UpdateTerminationProtection -> Text
$sel:enableTerminationProtection:UpdateTerminationProtection' :: UpdateTerminationProtection -> Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Bool
enableTerminationProtection
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stackName
instance Data.ToHeaders UpdateTerminationProtection where
toHeaders :: UpdateTerminationProtection -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath UpdateTerminationProtection where
toPath :: UpdateTerminationProtection -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateTerminationProtection where
toQuery :: UpdateTerminationProtection -> QueryString
toQuery UpdateTerminationProtection' {Bool
Text
stackName :: Text
enableTerminationProtection :: Bool
$sel:stackName:UpdateTerminationProtection' :: UpdateTerminationProtection -> Text
$sel:enableTerminationProtection:UpdateTerminationProtection' :: UpdateTerminationProtection -> Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"UpdateTerminationProtection" ::
Prelude.ByteString
),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
ByteString
"EnableTerminationProtection"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Bool
enableTerminationProtection,
ByteString
"StackName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
stackName
]
data UpdateTerminationProtectionResponse = UpdateTerminationProtectionResponse'
{
UpdateTerminationProtectionResponse -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text,
UpdateTerminationProtectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateTerminationProtectionResponse
-> UpdateTerminationProtectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTerminationProtectionResponse
-> UpdateTerminationProtectionResponse -> Bool
$c/= :: UpdateTerminationProtectionResponse
-> UpdateTerminationProtectionResponse -> Bool
== :: UpdateTerminationProtectionResponse
-> UpdateTerminationProtectionResponse -> Bool
$c== :: UpdateTerminationProtectionResponse
-> UpdateTerminationProtectionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTerminationProtectionResponse]
ReadPrec UpdateTerminationProtectionResponse
Int -> ReadS UpdateTerminationProtectionResponse
ReadS [UpdateTerminationProtectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTerminationProtectionResponse]
$creadListPrec :: ReadPrec [UpdateTerminationProtectionResponse]
readPrec :: ReadPrec UpdateTerminationProtectionResponse
$creadPrec :: ReadPrec UpdateTerminationProtectionResponse
readList :: ReadS [UpdateTerminationProtectionResponse]
$creadList :: ReadS [UpdateTerminationProtectionResponse]
readsPrec :: Int -> ReadS UpdateTerminationProtectionResponse
$creadsPrec :: Int -> ReadS UpdateTerminationProtectionResponse
Prelude.Read, Int -> UpdateTerminationProtectionResponse -> ShowS
[UpdateTerminationProtectionResponse] -> ShowS
UpdateTerminationProtectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTerminationProtectionResponse] -> ShowS
$cshowList :: [UpdateTerminationProtectionResponse] -> ShowS
show :: UpdateTerminationProtectionResponse -> String
$cshow :: UpdateTerminationProtectionResponse -> String
showsPrec :: Int -> UpdateTerminationProtectionResponse -> ShowS
$cshowsPrec :: Int -> UpdateTerminationProtectionResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateTerminationProtectionResponse x
-> UpdateTerminationProtectionResponse
forall x.
UpdateTerminationProtectionResponse
-> Rep UpdateTerminationProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTerminationProtectionResponse x
-> UpdateTerminationProtectionResponse
$cfrom :: forall x.
UpdateTerminationProtectionResponse
-> Rep UpdateTerminationProtectionResponse x
Prelude.Generic)
newUpdateTerminationProtectionResponse ::
Prelude.Int ->
UpdateTerminationProtectionResponse
newUpdateTerminationProtectionResponse :: Int -> UpdateTerminationProtectionResponse
newUpdateTerminationProtectionResponse Int
pHttpStatus_ =
UpdateTerminationProtectionResponse'
{ $sel:stackId:UpdateTerminationProtectionResponse' :: Maybe Text
stackId =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateTerminationProtectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateTerminationProtectionResponse_stackId :: Lens.Lens' UpdateTerminationProtectionResponse (Prelude.Maybe Prelude.Text)
updateTerminationProtectionResponse_stackId :: Lens' UpdateTerminationProtectionResponse (Maybe Text)
updateTerminationProtectionResponse_stackId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTerminationProtectionResponse' {Maybe Text
stackId :: Maybe Text
$sel:stackId:UpdateTerminationProtectionResponse' :: UpdateTerminationProtectionResponse -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: UpdateTerminationProtectionResponse
s@UpdateTerminationProtectionResponse' {} Maybe Text
a -> UpdateTerminationProtectionResponse
s {$sel:stackId:UpdateTerminationProtectionResponse' :: Maybe Text
stackId = Maybe Text
a} :: UpdateTerminationProtectionResponse)
updateTerminationProtectionResponse_httpStatus :: Lens.Lens' UpdateTerminationProtectionResponse Prelude.Int
updateTerminationProtectionResponse_httpStatus :: Lens' UpdateTerminationProtectionResponse Int
updateTerminationProtectionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTerminationProtectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateTerminationProtectionResponse' :: UpdateTerminationProtectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateTerminationProtectionResponse
s@UpdateTerminationProtectionResponse' {} Int
a -> UpdateTerminationProtectionResponse
s {$sel:httpStatus:UpdateTerminationProtectionResponse' :: Int
httpStatus = Int
a} :: UpdateTerminationProtectionResponse)
instance
Prelude.NFData
UpdateTerminationProtectionResponse
where
rnf :: UpdateTerminationProtectionResponse -> ()
rnf UpdateTerminationProtectionResponse' {Int
Maybe Text
httpStatus :: Int
stackId :: Maybe Text
$sel:httpStatus:UpdateTerminationProtectionResponse' :: UpdateTerminationProtectionResponse -> Int
$sel:stackId:UpdateTerminationProtectionResponse' :: UpdateTerminationProtectionResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stackId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus