{-# 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.RetireGrant
(
RetireGrant (..),
newRetireGrant,
retireGrant_keyId,
retireGrant_grantId,
retireGrant_grantToken,
RetireGrantResponse (..),
newRetireGrantResponse,
)
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 RetireGrant = RetireGrant'
{
RetireGrant -> Maybe Text
keyId :: Prelude.Maybe Prelude.Text,
RetireGrant -> Maybe Text
grantId :: Prelude.Maybe Prelude.Text,
RetireGrant -> Maybe Text
grantToken :: Prelude.Maybe Prelude.Text
}
deriving (RetireGrant -> RetireGrant -> Bool
(RetireGrant -> RetireGrant -> Bool)
-> (RetireGrant -> RetireGrant -> Bool) -> Eq RetireGrant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetireGrant -> RetireGrant -> Bool
$c/= :: RetireGrant -> RetireGrant -> Bool
== :: RetireGrant -> RetireGrant -> Bool
$c== :: RetireGrant -> RetireGrant -> Bool
Prelude.Eq, ReadPrec [RetireGrant]
ReadPrec RetireGrant
Int -> ReadS RetireGrant
ReadS [RetireGrant]
(Int -> ReadS RetireGrant)
-> ReadS [RetireGrant]
-> ReadPrec RetireGrant
-> ReadPrec [RetireGrant]
-> Read RetireGrant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetireGrant]
$creadListPrec :: ReadPrec [RetireGrant]
readPrec :: ReadPrec RetireGrant
$creadPrec :: ReadPrec RetireGrant
readList :: ReadS [RetireGrant]
$creadList :: ReadS [RetireGrant]
readsPrec :: Int -> ReadS RetireGrant
$creadsPrec :: Int -> ReadS RetireGrant
Prelude.Read, Int -> RetireGrant -> ShowS
[RetireGrant] -> ShowS
RetireGrant -> String
(Int -> RetireGrant -> ShowS)
-> (RetireGrant -> String)
-> ([RetireGrant] -> ShowS)
-> Show RetireGrant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetireGrant] -> ShowS
$cshowList :: [RetireGrant] -> ShowS
show :: RetireGrant -> String
$cshow :: RetireGrant -> String
showsPrec :: Int -> RetireGrant -> ShowS
$cshowsPrec :: Int -> RetireGrant -> ShowS
Prelude.Show, (forall x. RetireGrant -> Rep RetireGrant x)
-> (forall x. Rep RetireGrant x -> RetireGrant)
-> Generic RetireGrant
forall x. Rep RetireGrant x -> RetireGrant
forall x. RetireGrant -> Rep RetireGrant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RetireGrant x -> RetireGrant
$cfrom :: forall x. RetireGrant -> Rep RetireGrant x
Prelude.Generic)
newRetireGrant ::
RetireGrant
newRetireGrant :: RetireGrant
newRetireGrant =
RetireGrant' :: Maybe Text -> Maybe Text -> Maybe Text -> RetireGrant
RetireGrant'
{ $sel:keyId:RetireGrant' :: Maybe Text
keyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:grantId:RetireGrant' :: Maybe Text
grantId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:grantToken:RetireGrant' :: Maybe Text
grantToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
retireGrant_keyId :: Lens.Lens' RetireGrant (Prelude.Maybe Prelude.Text)
retireGrant_keyId :: (Maybe Text -> f (Maybe Text)) -> RetireGrant -> f RetireGrant
retireGrant_keyId = (RetireGrant -> Maybe Text)
-> (RetireGrant -> Maybe Text -> RetireGrant)
-> Lens RetireGrant RetireGrant (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetireGrant' {Maybe Text
keyId :: Maybe Text
$sel:keyId:RetireGrant' :: RetireGrant -> Maybe Text
keyId} -> Maybe Text
keyId) (\s :: RetireGrant
s@RetireGrant' {} Maybe Text
a -> RetireGrant
s {$sel:keyId:RetireGrant' :: Maybe Text
keyId = Maybe Text
a} :: RetireGrant)
retireGrant_grantId :: Lens.Lens' RetireGrant (Prelude.Maybe Prelude.Text)
retireGrant_grantId :: (Maybe Text -> f (Maybe Text)) -> RetireGrant -> f RetireGrant
retireGrant_grantId = (RetireGrant -> Maybe Text)
-> (RetireGrant -> Maybe Text -> RetireGrant)
-> Lens RetireGrant RetireGrant (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetireGrant' {Maybe Text
grantId :: Maybe Text
$sel:grantId:RetireGrant' :: RetireGrant -> Maybe Text
grantId} -> Maybe Text
grantId) (\s :: RetireGrant
s@RetireGrant' {} Maybe Text
a -> RetireGrant
s {$sel:grantId:RetireGrant' :: Maybe Text
grantId = Maybe Text
a} :: RetireGrant)
retireGrant_grantToken :: Lens.Lens' RetireGrant (Prelude.Maybe Prelude.Text)
retireGrant_grantToken :: (Maybe Text -> f (Maybe Text)) -> RetireGrant -> f RetireGrant
retireGrant_grantToken = (RetireGrant -> Maybe Text)
-> (RetireGrant -> Maybe Text -> RetireGrant)
-> Lens RetireGrant RetireGrant (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetireGrant' {Maybe Text
grantToken :: Maybe Text
$sel:grantToken:RetireGrant' :: RetireGrant -> Maybe Text
grantToken} -> Maybe Text
grantToken) (\s :: RetireGrant
s@RetireGrant' {} Maybe Text
a -> RetireGrant
s {$sel:grantToken:RetireGrant' :: Maybe Text
grantToken = Maybe Text
a} :: RetireGrant)
instance Core.AWSRequest RetireGrant where
type AWSResponse RetireGrant = RetireGrantResponse
request :: RetireGrant -> Request RetireGrant
request = Service -> RetireGrant -> Request RetireGrant
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RetireGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RetireGrant)))
response = AWSResponse RetireGrant
-> Logger
-> Service
-> Proxy RetireGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RetireGrant)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse RetireGrant
RetireGrantResponse
RetireGrantResponse'
instance Prelude.Hashable RetireGrant
instance Prelude.NFData RetireGrant
instance Core.ToHeaders RetireGrant where
toHeaders :: RetireGrant -> [Header]
toHeaders =
[Header] -> RetireGrant -> [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.RetireGrant" :: 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 RetireGrant where
toJSON :: RetireGrant -> Value
toJSON RetireGrant' {Maybe Text
grantToken :: Maybe Text
grantId :: Maybe Text
keyId :: Maybe Text
$sel:grantToken:RetireGrant' :: RetireGrant -> Maybe Text
$sel:grantId:RetireGrant' :: RetireGrant -> Maybe Text
$sel:keyId:RetireGrant' :: RetireGrant -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"KeyId" 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
keyId,
(Text
"GrantId" 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
grantId,
(Text
"GrantToken" 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
grantToken
]
)
instance Core.ToPath RetireGrant where
toPath :: RetireGrant -> ByteString
toPath = ByteString -> RetireGrant -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RetireGrant where
toQuery :: RetireGrant -> QueryString
toQuery = QueryString -> RetireGrant -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RetireGrantResponse = RetireGrantResponse'
{
}
deriving (RetireGrantResponse -> RetireGrantResponse -> Bool
(RetireGrantResponse -> RetireGrantResponse -> Bool)
-> (RetireGrantResponse -> RetireGrantResponse -> Bool)
-> Eq RetireGrantResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetireGrantResponse -> RetireGrantResponse -> Bool
$c/= :: RetireGrantResponse -> RetireGrantResponse -> Bool
== :: RetireGrantResponse -> RetireGrantResponse -> Bool
$c== :: RetireGrantResponse -> RetireGrantResponse -> Bool
Prelude.Eq, ReadPrec [RetireGrantResponse]
ReadPrec RetireGrantResponse
Int -> ReadS RetireGrantResponse
ReadS [RetireGrantResponse]
(Int -> ReadS RetireGrantResponse)
-> ReadS [RetireGrantResponse]
-> ReadPrec RetireGrantResponse
-> ReadPrec [RetireGrantResponse]
-> Read RetireGrantResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetireGrantResponse]
$creadListPrec :: ReadPrec [RetireGrantResponse]
readPrec :: ReadPrec RetireGrantResponse
$creadPrec :: ReadPrec RetireGrantResponse
readList :: ReadS [RetireGrantResponse]
$creadList :: ReadS [RetireGrantResponse]
readsPrec :: Int -> ReadS RetireGrantResponse
$creadsPrec :: Int -> ReadS RetireGrantResponse
Prelude.Read, Int -> RetireGrantResponse -> ShowS
[RetireGrantResponse] -> ShowS
RetireGrantResponse -> String
(Int -> RetireGrantResponse -> ShowS)
-> (RetireGrantResponse -> String)
-> ([RetireGrantResponse] -> ShowS)
-> Show RetireGrantResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetireGrantResponse] -> ShowS
$cshowList :: [RetireGrantResponse] -> ShowS
show :: RetireGrantResponse -> String
$cshow :: RetireGrantResponse -> String
showsPrec :: Int -> RetireGrantResponse -> ShowS
$cshowsPrec :: Int -> RetireGrantResponse -> ShowS
Prelude.Show, (forall x. RetireGrantResponse -> Rep RetireGrantResponse x)
-> (forall x. Rep RetireGrantResponse x -> RetireGrantResponse)
-> Generic RetireGrantResponse
forall x. Rep RetireGrantResponse x -> RetireGrantResponse
forall x. RetireGrantResponse -> Rep RetireGrantResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RetireGrantResponse x -> RetireGrantResponse
$cfrom :: forall x. RetireGrantResponse -> Rep RetireGrantResponse x
Prelude.Generic)
newRetireGrantResponse ::
RetireGrantResponse
newRetireGrantResponse :: RetireGrantResponse
newRetireGrantResponse = RetireGrantResponse
RetireGrantResponse'
instance Prelude.NFData RetireGrantResponse