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