module Network.AWS.KMS.GenerateDataKeyWithoutPlaintext
(
generateDataKeyWithoutPlaintext
, GenerateDataKeyWithoutPlaintext
, gdkwpKeySpec
, gdkwpEncryptionContext
, gdkwpNumberOfBytes
, gdkwpGrantTokens
, gdkwpKeyId
, generateDataKeyWithoutPlaintextResponse
, GenerateDataKeyWithoutPlaintextResponse
, gdkwprsKeyId
, gdkwprsCiphertextBlob
, gdkwprsStatus
) where
import Network.AWS.KMS.Types
import Network.AWS.KMS.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GenerateDataKeyWithoutPlaintext = GenerateDataKeyWithoutPlaintext'
{ _gdkwpKeySpec :: !(Maybe DataKeySpec)
, _gdkwpEncryptionContext :: !(Maybe (Map Text Text))
, _gdkwpNumberOfBytes :: !(Maybe Nat)
, _gdkwpGrantTokens :: !(Maybe [Text])
, _gdkwpKeyId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
generateDataKeyWithoutPlaintext
:: Text
-> GenerateDataKeyWithoutPlaintext
generateDataKeyWithoutPlaintext pKeyId_ =
GenerateDataKeyWithoutPlaintext'
{ _gdkwpKeySpec = Nothing
, _gdkwpEncryptionContext = Nothing
, _gdkwpNumberOfBytes = Nothing
, _gdkwpGrantTokens = Nothing
, _gdkwpKeyId = pKeyId_
}
gdkwpKeySpec :: Lens' GenerateDataKeyWithoutPlaintext (Maybe DataKeySpec)
gdkwpKeySpec = lens _gdkwpKeySpec (\ s a -> s{_gdkwpKeySpec = a});
gdkwpEncryptionContext :: Lens' GenerateDataKeyWithoutPlaintext (HashMap Text Text)
gdkwpEncryptionContext = lens _gdkwpEncryptionContext (\ s a -> s{_gdkwpEncryptionContext = a}) . _Default . _Map;
gdkwpNumberOfBytes :: Lens' GenerateDataKeyWithoutPlaintext (Maybe Natural)
gdkwpNumberOfBytes = lens _gdkwpNumberOfBytes (\ s a -> s{_gdkwpNumberOfBytes = a}) . mapping _Nat;
gdkwpGrantTokens :: Lens' GenerateDataKeyWithoutPlaintext [Text]
gdkwpGrantTokens = lens _gdkwpGrantTokens (\ s a -> s{_gdkwpGrantTokens = a}) . _Default . _Coerce;
gdkwpKeyId :: Lens' GenerateDataKeyWithoutPlaintext Text
gdkwpKeyId = lens _gdkwpKeyId (\ s a -> s{_gdkwpKeyId = a});
instance AWSRequest GenerateDataKeyWithoutPlaintext
where
type Rs GenerateDataKeyWithoutPlaintext =
GenerateDataKeyWithoutPlaintextResponse
request = postJSON kMS
response
= receiveJSON
(\ s h x ->
GenerateDataKeyWithoutPlaintextResponse' <$>
(x .?> "KeyId") <*> (x .?> "CiphertextBlob") <*>
(pure (fromEnum s)))
instance ToHeaders GenerateDataKeyWithoutPlaintext
where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("TrentService.GenerateDataKeyWithoutPlaintext" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GenerateDataKeyWithoutPlaintext where
toJSON GenerateDataKeyWithoutPlaintext'{..}
= object
(catMaybes
[("KeySpec" .=) <$> _gdkwpKeySpec,
("EncryptionContext" .=) <$> _gdkwpEncryptionContext,
("NumberOfBytes" .=) <$> _gdkwpNumberOfBytes,
("GrantTokens" .=) <$> _gdkwpGrantTokens,
Just ("KeyId" .= _gdkwpKeyId)])
instance ToPath GenerateDataKeyWithoutPlaintext where
toPath = const "/"
instance ToQuery GenerateDataKeyWithoutPlaintext
where
toQuery = const mempty
data GenerateDataKeyWithoutPlaintextResponse = GenerateDataKeyWithoutPlaintextResponse'
{ _gdkwprsKeyId :: !(Maybe Text)
, _gdkwprsCiphertextBlob :: !(Maybe Base64)
, _gdkwprsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
generateDataKeyWithoutPlaintextResponse
:: Int
-> GenerateDataKeyWithoutPlaintextResponse
generateDataKeyWithoutPlaintextResponse pStatus_ =
GenerateDataKeyWithoutPlaintextResponse'
{ _gdkwprsKeyId = Nothing
, _gdkwprsCiphertextBlob = Nothing
, _gdkwprsStatus = pStatus_
}
gdkwprsKeyId :: Lens' GenerateDataKeyWithoutPlaintextResponse (Maybe Text)
gdkwprsKeyId = lens _gdkwprsKeyId (\ s a -> s{_gdkwprsKeyId = a});
gdkwprsCiphertextBlob :: Lens' GenerateDataKeyWithoutPlaintextResponse (Maybe ByteString)
gdkwprsCiphertextBlob = lens _gdkwprsCiphertextBlob (\ s a -> s{_gdkwprsCiphertextBlob = a}) . mapping _Base64;
gdkwprsStatus :: Lens' GenerateDataKeyWithoutPlaintextResponse Int
gdkwprsStatus = lens _gdkwprsStatus (\ s a -> s{_gdkwprsStatus = a});