module Network.AWS.KMS.PutKeyPolicy
(
putKeyPolicy
, PutKeyPolicy
, pkpKeyId
, pkpPolicyName
, pkpPolicy
, putKeyPolicyResponse
, PutKeyPolicyResponse
) where
import Network.AWS.KMS.Types
import Network.AWS.KMS.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PutKeyPolicy = PutKeyPolicy'
{ _pkpKeyId :: !Text
, _pkpPolicyName :: !Text
, _pkpPolicy :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putKeyPolicy
:: Text
-> Text
-> Text
-> PutKeyPolicy
putKeyPolicy pKeyId_ pPolicyName_ pPolicy_ =
PutKeyPolicy'
{ _pkpKeyId = pKeyId_
, _pkpPolicyName = pPolicyName_
, _pkpPolicy = pPolicy_
}
pkpKeyId :: Lens' PutKeyPolicy Text
pkpKeyId = lens _pkpKeyId (\ s a -> s{_pkpKeyId = a});
pkpPolicyName :: Lens' PutKeyPolicy Text
pkpPolicyName = lens _pkpPolicyName (\ s a -> s{_pkpPolicyName = a});
pkpPolicy :: Lens' PutKeyPolicy Text
pkpPolicy = lens _pkpPolicy (\ s a -> s{_pkpPolicy = a});
instance AWSRequest PutKeyPolicy where
type Rs PutKeyPolicy = PutKeyPolicyResponse
request = postJSON kms
response = receiveNull PutKeyPolicyResponse'
instance Hashable PutKeyPolicy
instance NFData PutKeyPolicy
instance ToHeaders PutKeyPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("TrentService.PutKeyPolicy" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutKeyPolicy where
toJSON PutKeyPolicy'{..}
= object
(catMaybes
[Just ("KeyId" .= _pkpKeyId),
Just ("PolicyName" .= _pkpPolicyName),
Just ("Policy" .= _pkpPolicy)])
instance ToPath PutKeyPolicy where
toPath = const "/"
instance ToQuery PutKeyPolicy where
toQuery = const mempty
data PutKeyPolicyResponse =
PutKeyPolicyResponse'
deriving (Eq,Read,Show,Data,Typeable,Generic)
putKeyPolicyResponse
:: PutKeyPolicyResponse
putKeyPolicyResponse = PutKeyPolicyResponse'
instance NFData PutKeyPolicyResponse