{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KMS.Types
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
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]
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
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. 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' {$sel:keyId:CancelKeyDeletion' :: Text
keyId = Text
pKeyId_}
cancelKeyDeletion_keyId :: Lens.Lens' CancelKeyDeletion Prelude.Text
cancelKeyDeletion_keyId :: Lens' CancelKeyDeletion Text
cancelKeyDeletion_keyId = 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 :: (Service -> Service)
-> CancelKeyDeletion -> Request CancelKeyDeletion
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CancelKeyDeletion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CancelKeyDeletion)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CancelKeyDeletionResponse
CancelKeyDeletionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"KeyId")
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 CancelKeyDeletion where
hashWithSalt :: Int -> CancelKeyDeletion -> Int
hashWithSalt Int
_salt CancelKeyDeletion' {Text
keyId :: Text
$sel:keyId:CancelKeyDeletion' :: CancelKeyDeletion -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyId
instance Prelude.NFData CancelKeyDeletion where
rnf :: CancelKeyDeletion -> ()
rnf CancelKeyDeletion' {Text
keyId :: Text
$sel:keyId:CancelKeyDeletion' :: CancelKeyDeletion -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
keyId
instance Data.ToHeaders CancelKeyDeletion where
toHeaders :: CancelKeyDeletion -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"TrentService.CancelKeyDeletion" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CancelKeyDeletion where
toJSON :: CancelKeyDeletion -> Value
toJSON CancelKeyDeletion' {Text
keyId :: Text
$sel:keyId:CancelKeyDeletion' :: CancelKeyDeletion -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"KeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
keyId)]
)
instance Data.ToPath CancelKeyDeletion where
toPath :: CancelKeyDeletion -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CancelKeyDeletion where
toQuery :: CancelKeyDeletion -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:keyId:CancelKeyDeletionResponse' :: Maybe Text
keyId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelKeyDeletionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelKeyDeletionResponse_keyId :: Lens.Lens' CancelKeyDeletionResponse (Prelude.Maybe Prelude.Text)
cancelKeyDeletionResponse_keyId :: Lens' CancelKeyDeletionResponse (Maybe Text)
cancelKeyDeletionResponse_keyId = 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 :: Lens' CancelKeyDeletionResponse Int
cancelKeyDeletionResponse_httpStatus = 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 where
rnf :: CancelKeyDeletionResponse -> ()
rnf CancelKeyDeletionResponse' {Int
Maybe Text
httpStatus :: Int
keyId :: Maybe Text
$sel:httpStatus:CancelKeyDeletionResponse' :: CancelKeyDeletionResponse -> Int
$sel:keyId:CancelKeyDeletionResponse' :: CancelKeyDeletionResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus