module Network.AWS.KMS.GenerateDataKeyWithoutPlaintext
(
GenerateDataKeyWithoutPlaintext
, generateDataKeyWithoutPlaintext
, gdkwpEncryptionContext
, gdkwpGrantTokens
, gdkwpKeyId
, gdkwpKeySpec
, gdkwpNumberOfBytes
, GenerateDataKeyWithoutPlaintextResponse
, generateDataKeyWithoutPlaintextResponse
, gdkwprCiphertextBlob
, gdkwprKeyId
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.KMS.Types
import qualified GHC.Exts
data GenerateDataKeyWithoutPlaintext = GenerateDataKeyWithoutPlaintext
{ _gdkwpEncryptionContext :: Map Text Text
, _gdkwpGrantTokens :: List "GrantTokens" Text
, _gdkwpKeyId :: Text
, _gdkwpKeySpec :: Maybe DataKeySpec
, _gdkwpNumberOfBytes :: Maybe Nat
} deriving (Eq, Show)
generateDataKeyWithoutPlaintext :: Text
-> GenerateDataKeyWithoutPlaintext
generateDataKeyWithoutPlaintext p1 = GenerateDataKeyWithoutPlaintext
{ _gdkwpKeyId = p1
, _gdkwpEncryptionContext = mempty
, _gdkwpKeySpec = Nothing
, _gdkwpNumberOfBytes = Nothing
, _gdkwpGrantTokens = mempty
}
gdkwpEncryptionContext :: Lens' GenerateDataKeyWithoutPlaintext (HashMap Text Text)
gdkwpEncryptionContext =
lens _gdkwpEncryptionContext (\s a -> s { _gdkwpEncryptionContext = a })
. _Map
gdkwpGrantTokens :: Lens' GenerateDataKeyWithoutPlaintext [Text]
gdkwpGrantTokens = lens _gdkwpGrantTokens (\s a -> s { _gdkwpGrantTokens = a }) . _List
gdkwpKeyId :: Lens' GenerateDataKeyWithoutPlaintext Text
gdkwpKeyId = lens _gdkwpKeyId (\s a -> s { _gdkwpKeyId = a })
gdkwpKeySpec :: Lens' GenerateDataKeyWithoutPlaintext (Maybe DataKeySpec)
gdkwpKeySpec = lens _gdkwpKeySpec (\s a -> s { _gdkwpKeySpec = a })
gdkwpNumberOfBytes :: Lens' GenerateDataKeyWithoutPlaintext (Maybe Natural)
gdkwpNumberOfBytes =
lens _gdkwpNumberOfBytes (\s a -> s { _gdkwpNumberOfBytes = a })
. mapping _Nat
data GenerateDataKeyWithoutPlaintextResponse = GenerateDataKeyWithoutPlaintextResponse
{ _gdkwprCiphertextBlob :: Maybe Base64
, _gdkwprKeyId :: Maybe Text
} deriving (Eq, Show)
generateDataKeyWithoutPlaintextResponse :: GenerateDataKeyWithoutPlaintextResponse
generateDataKeyWithoutPlaintextResponse = GenerateDataKeyWithoutPlaintextResponse
{ _gdkwprCiphertextBlob = Nothing
, _gdkwprKeyId = Nothing
}
gdkwprCiphertextBlob :: Lens' GenerateDataKeyWithoutPlaintextResponse (Maybe Base64)
gdkwprCiphertextBlob =
lens _gdkwprCiphertextBlob (\s a -> s { _gdkwprCiphertextBlob = a })
gdkwprKeyId :: Lens' GenerateDataKeyWithoutPlaintextResponse (Maybe Text)
gdkwprKeyId = lens _gdkwprKeyId (\s a -> s { _gdkwprKeyId = a })
instance ToPath GenerateDataKeyWithoutPlaintext where
toPath = const "/"
instance ToQuery GenerateDataKeyWithoutPlaintext where
toQuery = const mempty
instance ToHeaders GenerateDataKeyWithoutPlaintext
instance ToJSON GenerateDataKeyWithoutPlaintext where
toJSON GenerateDataKeyWithoutPlaintext{..} = object
[ "KeyId" .= _gdkwpKeyId
, "EncryptionContext" .= _gdkwpEncryptionContext
, "KeySpec" .= _gdkwpKeySpec
, "NumberOfBytes" .= _gdkwpNumberOfBytes
, "GrantTokens" .= _gdkwpGrantTokens
]
instance AWSRequest GenerateDataKeyWithoutPlaintext where
type Sv GenerateDataKeyWithoutPlaintext = KMS
type Rs GenerateDataKeyWithoutPlaintext = GenerateDataKeyWithoutPlaintextResponse
request = post "GenerateDataKeyWithoutPlaintext"
response = jsonResponse
instance FromJSON GenerateDataKeyWithoutPlaintextResponse where
parseJSON = withObject "GenerateDataKeyWithoutPlaintextResponse" $ \o -> GenerateDataKeyWithoutPlaintextResponse
<$> o .:? "CiphertextBlob"
<*> o .:? "KeyId"