{-# 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.SSMIncidents.UpdateDeletionProtection
(
UpdateDeletionProtection (..),
newUpdateDeletionProtection,
updateDeletionProtection_clientToken,
updateDeletionProtection_arn,
updateDeletionProtection_deletionProtected,
UpdateDeletionProtectionResponse (..),
newUpdateDeletionProtectionResponse,
updateDeletionProtectionResponse_httpStatus,
)
where
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
import Amazonka.SSMIncidents.Types
data UpdateDeletionProtection = UpdateDeletionProtection'
{
UpdateDeletionProtection -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
UpdateDeletionProtection -> Text
arn :: Prelude.Text,
UpdateDeletionProtection -> Bool
deletionProtected :: Prelude.Bool
}
deriving (UpdateDeletionProtection -> UpdateDeletionProtection -> Bool
(UpdateDeletionProtection -> UpdateDeletionProtection -> Bool)
-> (UpdateDeletionProtection -> UpdateDeletionProtection -> Bool)
-> Eq UpdateDeletionProtection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeletionProtection -> UpdateDeletionProtection -> Bool
$c/= :: UpdateDeletionProtection -> UpdateDeletionProtection -> Bool
== :: UpdateDeletionProtection -> UpdateDeletionProtection -> Bool
$c== :: UpdateDeletionProtection -> UpdateDeletionProtection -> Bool
Prelude.Eq, ReadPrec [UpdateDeletionProtection]
ReadPrec UpdateDeletionProtection
Int -> ReadS UpdateDeletionProtection
ReadS [UpdateDeletionProtection]
(Int -> ReadS UpdateDeletionProtection)
-> ReadS [UpdateDeletionProtection]
-> ReadPrec UpdateDeletionProtection
-> ReadPrec [UpdateDeletionProtection]
-> Read UpdateDeletionProtection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeletionProtection]
$creadListPrec :: ReadPrec [UpdateDeletionProtection]
readPrec :: ReadPrec UpdateDeletionProtection
$creadPrec :: ReadPrec UpdateDeletionProtection
readList :: ReadS [UpdateDeletionProtection]
$creadList :: ReadS [UpdateDeletionProtection]
readsPrec :: Int -> ReadS UpdateDeletionProtection
$creadsPrec :: Int -> ReadS UpdateDeletionProtection
Prelude.Read, Int -> UpdateDeletionProtection -> ShowS
[UpdateDeletionProtection] -> ShowS
UpdateDeletionProtection -> String
(Int -> UpdateDeletionProtection -> ShowS)
-> (UpdateDeletionProtection -> String)
-> ([UpdateDeletionProtection] -> ShowS)
-> Show UpdateDeletionProtection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeletionProtection] -> ShowS
$cshowList :: [UpdateDeletionProtection] -> ShowS
show :: UpdateDeletionProtection -> String
$cshow :: UpdateDeletionProtection -> String
showsPrec :: Int -> UpdateDeletionProtection -> ShowS
$cshowsPrec :: Int -> UpdateDeletionProtection -> ShowS
Prelude.Show, (forall x.
UpdateDeletionProtection -> Rep UpdateDeletionProtection x)
-> (forall x.
Rep UpdateDeletionProtection x -> UpdateDeletionProtection)
-> Generic UpdateDeletionProtection
forall x.
Rep UpdateDeletionProtection x -> UpdateDeletionProtection
forall x.
UpdateDeletionProtection -> Rep UpdateDeletionProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDeletionProtection x -> UpdateDeletionProtection
$cfrom :: forall x.
UpdateDeletionProtection -> Rep UpdateDeletionProtection x
Prelude.Generic)
newUpdateDeletionProtection ::
Prelude.Text ->
Prelude.Bool ->
UpdateDeletionProtection
newUpdateDeletionProtection :: Text -> Bool -> UpdateDeletionProtection
newUpdateDeletionProtection Text
pArn_ Bool
pDeletionProtected_ =
UpdateDeletionProtection' :: Maybe Text -> Text -> Bool -> UpdateDeletionProtection
UpdateDeletionProtection'
{ $sel:clientToken:UpdateDeletionProtection' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:arn:UpdateDeletionProtection' :: Text
arn = Text
pArn_,
$sel:deletionProtected:UpdateDeletionProtection' :: Bool
deletionProtected = Bool
pDeletionProtected_
}
updateDeletionProtection_clientToken :: Lens.Lens' UpdateDeletionProtection (Prelude.Maybe Prelude.Text)
updateDeletionProtection_clientToken :: (Maybe Text -> f (Maybe Text))
-> UpdateDeletionProtection -> f UpdateDeletionProtection
updateDeletionProtection_clientToken = (UpdateDeletionProtection -> Maybe Text)
-> (UpdateDeletionProtection
-> Maybe Text -> UpdateDeletionProtection)
-> Lens
UpdateDeletionProtection
UpdateDeletionProtection
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeletionProtection' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:UpdateDeletionProtection' :: UpdateDeletionProtection -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: UpdateDeletionProtection
s@UpdateDeletionProtection' {} Maybe Text
a -> UpdateDeletionProtection
s {$sel:clientToken:UpdateDeletionProtection' :: Maybe Text
clientToken = Maybe Text
a} :: UpdateDeletionProtection)
updateDeletionProtection_arn :: Lens.Lens' UpdateDeletionProtection Prelude.Text
updateDeletionProtection_arn :: (Text -> f Text)
-> UpdateDeletionProtection -> f UpdateDeletionProtection
updateDeletionProtection_arn = (UpdateDeletionProtection -> Text)
-> (UpdateDeletionProtection -> Text -> UpdateDeletionProtection)
-> Lens UpdateDeletionProtection UpdateDeletionProtection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeletionProtection' {Text
arn :: Text
$sel:arn:UpdateDeletionProtection' :: UpdateDeletionProtection -> Text
arn} -> Text
arn) (\s :: UpdateDeletionProtection
s@UpdateDeletionProtection' {} Text
a -> UpdateDeletionProtection
s {$sel:arn:UpdateDeletionProtection' :: Text
arn = Text
a} :: UpdateDeletionProtection)
updateDeletionProtection_deletionProtected :: Lens.Lens' UpdateDeletionProtection Prelude.Bool
updateDeletionProtection_deletionProtected :: (Bool -> f Bool)
-> UpdateDeletionProtection -> f UpdateDeletionProtection
updateDeletionProtection_deletionProtected = (UpdateDeletionProtection -> Bool)
-> (UpdateDeletionProtection -> Bool -> UpdateDeletionProtection)
-> Lens UpdateDeletionProtection UpdateDeletionProtection Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeletionProtection' {Bool
deletionProtected :: Bool
$sel:deletionProtected:UpdateDeletionProtection' :: UpdateDeletionProtection -> Bool
deletionProtected} -> Bool
deletionProtected) (\s :: UpdateDeletionProtection
s@UpdateDeletionProtection' {} Bool
a -> UpdateDeletionProtection
s {$sel:deletionProtected:UpdateDeletionProtection' :: Bool
deletionProtected = Bool
a} :: UpdateDeletionProtection)
instance Core.AWSRequest UpdateDeletionProtection where
type
AWSResponse UpdateDeletionProtection =
UpdateDeletionProtectionResponse
request :: UpdateDeletionProtection -> Request UpdateDeletionProtection
request = Service
-> UpdateDeletionProtection -> Request UpdateDeletionProtection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDeletionProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeletionProtection)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateDeletionProtection))
-> Logger
-> Service
-> Proxy UpdateDeletionProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeletionProtection)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateDeletionProtectionResponse
UpdateDeletionProtectionResponse'
(Int -> UpdateDeletionProtectionResponse)
-> Either String Int
-> Either String UpdateDeletionProtectionResponse
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 UpdateDeletionProtection
instance Prelude.NFData UpdateDeletionProtection
instance Core.ToHeaders UpdateDeletionProtection where
toHeaders :: UpdateDeletionProtection -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDeletionProtection -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateDeletionProtection where
toJSON :: UpdateDeletionProtection -> Value
toJSON UpdateDeletionProtection' {Bool
Maybe Text
Text
deletionProtected :: Bool
arn :: Text
clientToken :: Maybe Text
$sel:deletionProtected:UpdateDeletionProtection' :: UpdateDeletionProtection -> Bool
$sel:arn:UpdateDeletionProtection' :: UpdateDeletionProtection -> Text
$sel:clientToken:UpdateDeletionProtection' :: UpdateDeletionProtection -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"deletionProtected" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
deletionProtected)
]
)
instance Core.ToPath UpdateDeletionProtection where
toPath :: UpdateDeletionProtection -> ByteString
toPath = ByteString -> UpdateDeletionProtection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/updateDeletionProtection"
instance Core.ToQuery UpdateDeletionProtection where
toQuery :: UpdateDeletionProtection -> QueryString
toQuery = QueryString -> UpdateDeletionProtection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDeletionProtectionResponse = UpdateDeletionProtectionResponse'
{
UpdateDeletionProtectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDeletionProtectionResponse
-> UpdateDeletionProtectionResponse -> Bool
(UpdateDeletionProtectionResponse
-> UpdateDeletionProtectionResponse -> Bool)
-> (UpdateDeletionProtectionResponse
-> UpdateDeletionProtectionResponse -> Bool)
-> Eq UpdateDeletionProtectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeletionProtectionResponse
-> UpdateDeletionProtectionResponse -> Bool
$c/= :: UpdateDeletionProtectionResponse
-> UpdateDeletionProtectionResponse -> Bool
== :: UpdateDeletionProtectionResponse
-> UpdateDeletionProtectionResponse -> Bool
$c== :: UpdateDeletionProtectionResponse
-> UpdateDeletionProtectionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDeletionProtectionResponse]
ReadPrec UpdateDeletionProtectionResponse
Int -> ReadS UpdateDeletionProtectionResponse
ReadS [UpdateDeletionProtectionResponse]
(Int -> ReadS UpdateDeletionProtectionResponse)
-> ReadS [UpdateDeletionProtectionResponse]
-> ReadPrec UpdateDeletionProtectionResponse
-> ReadPrec [UpdateDeletionProtectionResponse]
-> Read UpdateDeletionProtectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeletionProtectionResponse]
$creadListPrec :: ReadPrec [UpdateDeletionProtectionResponse]
readPrec :: ReadPrec UpdateDeletionProtectionResponse
$creadPrec :: ReadPrec UpdateDeletionProtectionResponse
readList :: ReadS [UpdateDeletionProtectionResponse]
$creadList :: ReadS [UpdateDeletionProtectionResponse]
readsPrec :: Int -> ReadS UpdateDeletionProtectionResponse
$creadsPrec :: Int -> ReadS UpdateDeletionProtectionResponse
Prelude.Read, Int -> UpdateDeletionProtectionResponse -> ShowS
[UpdateDeletionProtectionResponse] -> ShowS
UpdateDeletionProtectionResponse -> String
(Int -> UpdateDeletionProtectionResponse -> ShowS)
-> (UpdateDeletionProtectionResponse -> String)
-> ([UpdateDeletionProtectionResponse] -> ShowS)
-> Show UpdateDeletionProtectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeletionProtectionResponse] -> ShowS
$cshowList :: [UpdateDeletionProtectionResponse] -> ShowS
show :: UpdateDeletionProtectionResponse -> String
$cshow :: UpdateDeletionProtectionResponse -> String
showsPrec :: Int -> UpdateDeletionProtectionResponse -> ShowS
$cshowsPrec :: Int -> UpdateDeletionProtectionResponse -> ShowS
Prelude.Show, (forall x.
UpdateDeletionProtectionResponse
-> Rep UpdateDeletionProtectionResponse x)
-> (forall x.
Rep UpdateDeletionProtectionResponse x
-> UpdateDeletionProtectionResponse)
-> Generic UpdateDeletionProtectionResponse
forall x.
Rep UpdateDeletionProtectionResponse x
-> UpdateDeletionProtectionResponse
forall x.
UpdateDeletionProtectionResponse
-> Rep UpdateDeletionProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDeletionProtectionResponse x
-> UpdateDeletionProtectionResponse
$cfrom :: forall x.
UpdateDeletionProtectionResponse
-> Rep UpdateDeletionProtectionResponse x
Prelude.Generic)
newUpdateDeletionProtectionResponse ::
Prelude.Int ->
UpdateDeletionProtectionResponse
newUpdateDeletionProtectionResponse :: Int -> UpdateDeletionProtectionResponse
newUpdateDeletionProtectionResponse Int
pHttpStatus_ =
UpdateDeletionProtectionResponse' :: Int -> UpdateDeletionProtectionResponse
UpdateDeletionProtectionResponse'
{ $sel:httpStatus:UpdateDeletionProtectionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateDeletionProtectionResponse_httpStatus :: Lens.Lens' UpdateDeletionProtectionResponse Prelude.Int
updateDeletionProtectionResponse_httpStatus :: (Int -> f Int)
-> UpdateDeletionProtectionResponse
-> f UpdateDeletionProtectionResponse
updateDeletionProtectionResponse_httpStatus = (UpdateDeletionProtectionResponse -> Int)
-> (UpdateDeletionProtectionResponse
-> Int -> UpdateDeletionProtectionResponse)
-> Lens
UpdateDeletionProtectionResponse
UpdateDeletionProtectionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeletionProtectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDeletionProtectionResponse' :: UpdateDeletionProtectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDeletionProtectionResponse
s@UpdateDeletionProtectionResponse' {} Int
a -> UpdateDeletionProtectionResponse
s {$sel:httpStatus:UpdateDeletionProtectionResponse' :: Int
httpStatus = Int
a} :: UpdateDeletionProtectionResponse)
instance
Prelude.NFData
UpdateDeletionProtectionResponse