{-# 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.KMS.CancelKeyDeletion
(
CancelKeyDeletion (..),
newCancelKeyDeletion,
cancelKeyDeletion_keyId,
CancelKeyDeletionResponse (..),
newCancelKeyDeletionResponse,
cancelKeyDeletionResponse_keyId,
cancelKeyDeletionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.KMS.Types
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 CancelKeyDeletion = CancelKeyDeletion'
{
CancelKeyDeletion -> Text
keyId :: Prelude.Text
}
deriving (CancelKeyDeletion -> CancelKeyDeletion -> Bool
(CancelKeyDeletion -> CancelKeyDeletion -> Bool)
-> (CancelKeyDeletion -> CancelKeyDeletion -> Bool)
-> Eq CancelKeyDeletion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelKeyDeletion -> CancelKeyDeletion -> Bool
$c/= :: CancelKeyDeletion -> CancelKeyDeletion -> Bool
== :: CancelKeyDeletion -> CancelKeyDeletion -> Bool
$c== :: CancelKeyDeletion -> CancelKeyDeletion -> Bool
Prelude.Eq, ReadPrec [CancelKeyDeletion]
ReadPrec CancelKeyDeletion
Int -> ReadS CancelKeyDeletion
ReadS [CancelKeyDeletion]
(Int -> ReadS CancelKeyDeletion)
-> ReadS [CancelKeyDeletion]
-> ReadPrec CancelKeyDeletion
-> ReadPrec [CancelKeyDeletion]
-> Read CancelKeyDeletion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelKeyDeletion]
$creadListPrec :: ReadPrec [CancelKeyDeletion]
readPrec :: ReadPrec CancelKeyDeletion
$creadPrec :: ReadPrec CancelKeyDeletion
readList :: ReadS [CancelKeyDeletion]
$creadList :: ReadS [CancelKeyDeletion]
readsPrec :: Int -> ReadS CancelKeyDeletion
$creadsPrec :: Int -> ReadS CancelKeyDeletion
Prelude.Read, Int -> CancelKeyDeletion -> ShowS
[CancelKeyDeletion] -> ShowS
CancelKeyDeletion -> String
(Int -> CancelKeyDeletion -> ShowS)
-> (CancelKeyDeletion -> String)
-> ([CancelKeyDeletion] -> ShowS)
-> Show CancelKeyDeletion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelKeyDeletion] -> ShowS
$cshowList :: [CancelKeyDeletion] -> ShowS
show :: CancelKeyDeletion -> String
$cshow :: CancelKeyDeletion -> String
showsPrec :: Int -> CancelKeyDeletion -> ShowS
$cshowsPrec :: Int -> CancelKeyDeletion -> ShowS
Prelude.Show, (forall x. CancelKeyDeletion -> Rep CancelKeyDeletion x)
-> (forall x. Rep CancelKeyDeletion x -> CancelKeyDeletion)
-> Generic CancelKeyDeletion
forall x. Rep CancelKeyDeletion x -> CancelKeyDeletion
forall x. CancelKeyDeletion -> Rep CancelKeyDeletion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelKeyDeletion x -> CancelKeyDeletion
$cfrom :: forall x. CancelKeyDeletion -> Rep CancelKeyDeletion x
Prelude.Generic)
newCancelKeyDeletion ::
Prelude.Text ->
CancelKeyDeletion
newCancelKeyDeletion :: Text -> CancelKeyDeletion
newCancelKeyDeletion Text
pKeyId_ =
CancelKeyDeletion' :: Text -> CancelKeyDeletion
CancelKeyDeletion' {$sel:keyId:CancelKeyDeletion' :: Text
keyId = Text
pKeyId_}
cancelKeyDeletion_keyId :: Lens.Lens' CancelKeyDeletion Prelude.Text
cancelKeyDeletion_keyId :: (Text -> f Text) -> CancelKeyDeletion -> f CancelKeyDeletion
cancelKeyDeletion_keyId = (CancelKeyDeletion -> Text)
-> (CancelKeyDeletion -> Text -> CancelKeyDeletion)
-> Lens CancelKeyDeletion CancelKeyDeletion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelKeyDeletion' {Text
keyId :: Text
$sel:keyId:CancelKeyDeletion' :: CancelKeyDeletion -> Text
keyId} -> Text
keyId) (\s :: CancelKeyDeletion
s@CancelKeyDeletion' {} Text
a -> CancelKeyDeletion
s {$sel:keyId:CancelKeyDeletion' :: Text
keyId = Text
a} :: CancelKeyDeletion)
instance Core.AWSRequest CancelKeyDeletion where
type
AWSResponse CancelKeyDeletion =
CancelKeyDeletionResponse
request :: CancelKeyDeletion -> Request CancelKeyDeletion
request = Service -> CancelKeyDeletion -> Request CancelKeyDeletion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CancelKeyDeletion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CancelKeyDeletion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CancelKeyDeletion))
-> Logger
-> Service
-> Proxy CancelKeyDeletion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CancelKeyDeletion)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CancelKeyDeletionResponse
CancelKeyDeletionResponse'
(Maybe Text -> Int -> CancelKeyDeletionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CancelKeyDeletionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KeyId")
Either String (Int -> CancelKeyDeletionResponse)
-> Either String Int -> Either String CancelKeyDeletionResponse
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 CancelKeyDeletion
instance Prelude.NFData CancelKeyDeletion
instance Core.ToHeaders CancelKeyDeletion where
toHeaders :: CancelKeyDeletion -> ResponseHeaders
toHeaders =
ResponseHeaders -> CancelKeyDeletion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"TrentService.CancelKeyDeletion" ::
Prelude.ByteString
),
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 CancelKeyDeletion where
toJSON :: CancelKeyDeletion -> Value
toJSON CancelKeyDeletion' {Text
keyId :: Text
$sel:keyId:CancelKeyDeletion' :: CancelKeyDeletion -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"KeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
keyId)]
)
instance Core.ToPath CancelKeyDeletion where
toPath :: CancelKeyDeletion -> ByteString
toPath = ByteString -> CancelKeyDeletion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CancelKeyDeletion where
toQuery :: CancelKeyDeletion -> QueryString
toQuery = QueryString -> CancelKeyDeletion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CancelKeyDeletionResponse = CancelKeyDeletionResponse'
{
CancelKeyDeletionResponse -> Maybe Text
keyId :: Prelude.Maybe Prelude.Text,
CancelKeyDeletionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CancelKeyDeletionResponse -> CancelKeyDeletionResponse -> Bool
(CancelKeyDeletionResponse -> CancelKeyDeletionResponse -> Bool)
-> (CancelKeyDeletionResponse -> CancelKeyDeletionResponse -> Bool)
-> Eq CancelKeyDeletionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelKeyDeletionResponse -> CancelKeyDeletionResponse -> Bool
$c/= :: CancelKeyDeletionResponse -> CancelKeyDeletionResponse -> Bool
== :: CancelKeyDeletionResponse -> CancelKeyDeletionResponse -> Bool
$c== :: CancelKeyDeletionResponse -> CancelKeyDeletionResponse -> Bool
Prelude.Eq, ReadPrec [CancelKeyDeletionResponse]
ReadPrec CancelKeyDeletionResponse
Int -> ReadS CancelKeyDeletionResponse
ReadS [CancelKeyDeletionResponse]
(Int -> ReadS CancelKeyDeletionResponse)
-> ReadS [CancelKeyDeletionResponse]
-> ReadPrec CancelKeyDeletionResponse
-> ReadPrec [CancelKeyDeletionResponse]
-> Read CancelKeyDeletionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelKeyDeletionResponse]
$creadListPrec :: ReadPrec [CancelKeyDeletionResponse]
readPrec :: ReadPrec CancelKeyDeletionResponse
$creadPrec :: ReadPrec CancelKeyDeletionResponse
readList :: ReadS [CancelKeyDeletionResponse]
$creadList :: ReadS [CancelKeyDeletionResponse]
readsPrec :: Int -> ReadS CancelKeyDeletionResponse
$creadsPrec :: Int -> ReadS CancelKeyDeletionResponse
Prelude.Read, Int -> CancelKeyDeletionResponse -> ShowS
[CancelKeyDeletionResponse] -> ShowS
CancelKeyDeletionResponse -> String
(Int -> CancelKeyDeletionResponse -> ShowS)
-> (CancelKeyDeletionResponse -> String)
-> ([CancelKeyDeletionResponse] -> ShowS)
-> Show CancelKeyDeletionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelKeyDeletionResponse] -> ShowS
$cshowList :: [CancelKeyDeletionResponse] -> ShowS
show :: CancelKeyDeletionResponse -> String
$cshow :: CancelKeyDeletionResponse -> String
showsPrec :: Int -> CancelKeyDeletionResponse -> ShowS
$cshowsPrec :: Int -> CancelKeyDeletionResponse -> ShowS
Prelude.Show, (forall x.
CancelKeyDeletionResponse -> Rep CancelKeyDeletionResponse x)
-> (forall x.
Rep CancelKeyDeletionResponse x -> CancelKeyDeletionResponse)
-> Generic CancelKeyDeletionResponse
forall x.
Rep CancelKeyDeletionResponse x -> CancelKeyDeletionResponse
forall x.
CancelKeyDeletionResponse -> Rep CancelKeyDeletionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelKeyDeletionResponse x -> CancelKeyDeletionResponse
$cfrom :: forall x.
CancelKeyDeletionResponse -> Rep CancelKeyDeletionResponse x
Prelude.Generic)
newCancelKeyDeletionResponse ::
Prelude.Int ->
CancelKeyDeletionResponse
newCancelKeyDeletionResponse :: Int -> CancelKeyDeletionResponse
newCancelKeyDeletionResponse Int
pHttpStatus_ =
CancelKeyDeletionResponse' :: Maybe Text -> Int -> CancelKeyDeletionResponse
CancelKeyDeletionResponse'
{ $sel:keyId:CancelKeyDeletionResponse' :: Maybe Text
keyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelKeyDeletionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelKeyDeletionResponse_keyId :: Lens.Lens' CancelKeyDeletionResponse (Prelude.Maybe Prelude.Text)
cancelKeyDeletionResponse_keyId :: (Maybe Text -> f (Maybe Text))
-> CancelKeyDeletionResponse -> f CancelKeyDeletionResponse
cancelKeyDeletionResponse_keyId = (CancelKeyDeletionResponse -> Maybe Text)
-> (CancelKeyDeletionResponse
-> Maybe Text -> CancelKeyDeletionResponse)
-> Lens
CancelKeyDeletionResponse
CancelKeyDeletionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelKeyDeletionResponse' {Maybe Text
keyId :: Maybe Text
$sel:keyId:CancelKeyDeletionResponse' :: CancelKeyDeletionResponse -> Maybe Text
keyId} -> Maybe Text
keyId) (\s :: CancelKeyDeletionResponse
s@CancelKeyDeletionResponse' {} Maybe Text
a -> CancelKeyDeletionResponse
s {$sel:keyId:CancelKeyDeletionResponse' :: Maybe Text
keyId = Maybe Text
a} :: CancelKeyDeletionResponse)
cancelKeyDeletionResponse_httpStatus :: Lens.Lens' CancelKeyDeletionResponse Prelude.Int
cancelKeyDeletionResponse_httpStatus :: (Int -> f Int)
-> CancelKeyDeletionResponse -> f CancelKeyDeletionResponse
cancelKeyDeletionResponse_httpStatus = (CancelKeyDeletionResponse -> Int)
-> (CancelKeyDeletionResponse -> Int -> CancelKeyDeletionResponse)
-> Lens CancelKeyDeletionResponse CancelKeyDeletionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelKeyDeletionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelKeyDeletionResponse' :: CancelKeyDeletionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CancelKeyDeletionResponse
s@CancelKeyDeletionResponse' {} Int
a -> CancelKeyDeletionResponse
s {$sel:httpStatus:CancelKeyDeletionResponse' :: Int
httpStatus = Int
a} :: CancelKeyDeletionResponse)
instance Prelude.NFData CancelKeyDeletionResponse