{-# 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.RevokeGrant
(
RevokeGrant (..),
newRevokeGrant,
revokeGrant_keyId,
revokeGrant_grantId,
RevokeGrantResponse (..),
newRevokeGrantResponse,
)
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 RevokeGrant = RevokeGrant'
{
RevokeGrant -> Text
keyId :: Prelude.Text,
RevokeGrant -> Text
grantId :: Prelude.Text
}
deriving (RevokeGrant -> RevokeGrant -> Bool
(RevokeGrant -> RevokeGrant -> Bool)
-> (RevokeGrant -> RevokeGrant -> Bool) -> Eq RevokeGrant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeGrant -> RevokeGrant -> Bool
$c/= :: RevokeGrant -> RevokeGrant -> Bool
== :: RevokeGrant -> RevokeGrant -> Bool
$c== :: RevokeGrant -> RevokeGrant -> Bool
Prelude.Eq, ReadPrec [RevokeGrant]
ReadPrec RevokeGrant
Int -> ReadS RevokeGrant
ReadS [RevokeGrant]
(Int -> ReadS RevokeGrant)
-> ReadS [RevokeGrant]
-> ReadPrec RevokeGrant
-> ReadPrec [RevokeGrant]
-> Read RevokeGrant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeGrant]
$creadListPrec :: ReadPrec [RevokeGrant]
readPrec :: ReadPrec RevokeGrant
$creadPrec :: ReadPrec RevokeGrant
readList :: ReadS [RevokeGrant]
$creadList :: ReadS [RevokeGrant]
readsPrec :: Int -> ReadS RevokeGrant
$creadsPrec :: Int -> ReadS RevokeGrant
Prelude.Read, Int -> RevokeGrant -> ShowS
[RevokeGrant] -> ShowS
RevokeGrant -> String
(Int -> RevokeGrant -> ShowS)
-> (RevokeGrant -> String)
-> ([RevokeGrant] -> ShowS)
-> Show RevokeGrant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeGrant] -> ShowS
$cshowList :: [RevokeGrant] -> ShowS
show :: RevokeGrant -> String
$cshow :: RevokeGrant -> String
showsPrec :: Int -> RevokeGrant -> ShowS
$cshowsPrec :: Int -> RevokeGrant -> ShowS
Prelude.Show, (forall x. RevokeGrant -> Rep RevokeGrant x)
-> (forall x. Rep RevokeGrant x -> RevokeGrant)
-> Generic RevokeGrant
forall x. Rep RevokeGrant x -> RevokeGrant
forall x. RevokeGrant -> Rep RevokeGrant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeGrant x -> RevokeGrant
$cfrom :: forall x. RevokeGrant -> Rep RevokeGrant x
Prelude.Generic)
newRevokeGrant ::
Prelude.Text ->
Prelude.Text ->
RevokeGrant
newRevokeGrant :: Text -> Text -> RevokeGrant
newRevokeGrant Text
pKeyId_ Text
pGrantId_ =
RevokeGrant' :: Text -> Text -> RevokeGrant
RevokeGrant' {$sel:keyId:RevokeGrant' :: Text
keyId = Text
pKeyId_, $sel:grantId:RevokeGrant' :: Text
grantId = Text
pGrantId_}
revokeGrant_keyId :: Lens.Lens' RevokeGrant Prelude.Text
revokeGrant_keyId :: (Text -> f Text) -> RevokeGrant -> f RevokeGrant
revokeGrant_keyId = (RevokeGrant -> Text)
-> (RevokeGrant -> Text -> RevokeGrant)
-> Lens RevokeGrant RevokeGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeGrant' {Text
keyId :: Text
$sel:keyId:RevokeGrant' :: RevokeGrant -> Text
keyId} -> Text
keyId) (\s :: RevokeGrant
s@RevokeGrant' {} Text
a -> RevokeGrant
s {$sel:keyId:RevokeGrant' :: Text
keyId = Text
a} :: RevokeGrant)
revokeGrant_grantId :: Lens.Lens' RevokeGrant Prelude.Text
revokeGrant_grantId :: (Text -> f Text) -> RevokeGrant -> f RevokeGrant
revokeGrant_grantId = (RevokeGrant -> Text)
-> (RevokeGrant -> Text -> RevokeGrant)
-> Lens RevokeGrant RevokeGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeGrant' {Text
grantId :: Text
$sel:grantId:RevokeGrant' :: RevokeGrant -> Text
grantId} -> Text
grantId) (\s :: RevokeGrant
s@RevokeGrant' {} Text
a -> RevokeGrant
s {$sel:grantId:RevokeGrant' :: Text
grantId = Text
a} :: RevokeGrant)
instance Core.AWSRequest RevokeGrant where
type AWSResponse RevokeGrant = RevokeGrantResponse
request :: RevokeGrant -> Request RevokeGrant
request = Service -> RevokeGrant -> Request RevokeGrant
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RevokeGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RevokeGrant)))
response = AWSResponse RevokeGrant
-> Logger
-> Service
-> Proxy RevokeGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RevokeGrant)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse RevokeGrant
RevokeGrantResponse
RevokeGrantResponse'
instance Prelude.Hashable RevokeGrant
instance Prelude.NFData RevokeGrant
instance Core.ToHeaders RevokeGrant where
toHeaders :: RevokeGrant -> [Header]
toHeaders =
[Header] -> RevokeGrant -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"TrentService.RevokeGrant" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON RevokeGrant where
toJSON :: RevokeGrant -> Value
toJSON RevokeGrant' {Text
grantId :: Text
keyId :: Text
$sel:grantId:RevokeGrant' :: RevokeGrant -> Text
$sel:keyId:RevokeGrant' :: RevokeGrant -> 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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GrantId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
grantId)
]
)
instance Core.ToPath RevokeGrant where
toPath :: RevokeGrant -> ByteString
toPath = ByteString -> RevokeGrant -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RevokeGrant where
toQuery :: RevokeGrant -> QueryString
toQuery = QueryString -> RevokeGrant -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RevokeGrantResponse = RevokeGrantResponse'
{
}
deriving (RevokeGrantResponse -> RevokeGrantResponse -> Bool
(RevokeGrantResponse -> RevokeGrantResponse -> Bool)
-> (RevokeGrantResponse -> RevokeGrantResponse -> Bool)
-> Eq RevokeGrantResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeGrantResponse -> RevokeGrantResponse -> Bool
$c/= :: RevokeGrantResponse -> RevokeGrantResponse -> Bool
== :: RevokeGrantResponse -> RevokeGrantResponse -> Bool
$c== :: RevokeGrantResponse -> RevokeGrantResponse -> Bool
Prelude.Eq, ReadPrec [RevokeGrantResponse]
ReadPrec RevokeGrantResponse
Int -> ReadS RevokeGrantResponse
ReadS [RevokeGrantResponse]
(Int -> ReadS RevokeGrantResponse)
-> ReadS [RevokeGrantResponse]
-> ReadPrec RevokeGrantResponse
-> ReadPrec [RevokeGrantResponse]
-> Read RevokeGrantResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeGrantResponse]
$creadListPrec :: ReadPrec [RevokeGrantResponse]
readPrec :: ReadPrec RevokeGrantResponse
$creadPrec :: ReadPrec RevokeGrantResponse
readList :: ReadS [RevokeGrantResponse]
$creadList :: ReadS [RevokeGrantResponse]
readsPrec :: Int -> ReadS RevokeGrantResponse
$creadsPrec :: Int -> ReadS RevokeGrantResponse
Prelude.Read, Int -> RevokeGrantResponse -> ShowS
[RevokeGrantResponse] -> ShowS
RevokeGrantResponse -> String
(Int -> RevokeGrantResponse -> ShowS)
-> (RevokeGrantResponse -> String)
-> ([RevokeGrantResponse] -> ShowS)
-> Show RevokeGrantResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeGrantResponse] -> ShowS
$cshowList :: [RevokeGrantResponse] -> ShowS
show :: RevokeGrantResponse -> String
$cshow :: RevokeGrantResponse -> String
showsPrec :: Int -> RevokeGrantResponse -> ShowS
$cshowsPrec :: Int -> RevokeGrantResponse -> ShowS
Prelude.Show, (forall x. RevokeGrantResponse -> Rep RevokeGrantResponse x)
-> (forall x. Rep RevokeGrantResponse x -> RevokeGrantResponse)
-> Generic RevokeGrantResponse
forall x. Rep RevokeGrantResponse x -> RevokeGrantResponse
forall x. RevokeGrantResponse -> Rep RevokeGrantResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeGrantResponse x -> RevokeGrantResponse
$cfrom :: forall x. RevokeGrantResponse -> Rep RevokeGrantResponse x
Prelude.Generic)
newRevokeGrantResponse ::
RevokeGrantResponse
newRevokeGrantResponse :: RevokeGrantResponse
newRevokeGrantResponse = RevokeGrantResponse
RevokeGrantResponse'
instance Prelude.NFData RevokeGrantResponse