module Network.AWS.KMS.GetKeyRotationStatus
(
getKeyRotationStatus
, GetKeyRotationStatus
, gkrsKeyId
, getKeyRotationStatusResponse
, GetKeyRotationStatusResponse
, gkrsrsKeyRotationEnabled
, gkrsrsStatus
) where
import Network.AWS.KMS.Types
import Network.AWS.KMS.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetKeyRotationStatus = GetKeyRotationStatus'
{ _gkrsKeyId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getKeyRotationStatus
:: Text
-> GetKeyRotationStatus
getKeyRotationStatus pKeyId_ =
GetKeyRotationStatus'
{ _gkrsKeyId = pKeyId_
}
gkrsKeyId :: Lens' GetKeyRotationStatus Text
gkrsKeyId = lens _gkrsKeyId (\ s a -> s{_gkrsKeyId = a});
instance AWSRequest GetKeyRotationStatus where
type Rs GetKeyRotationStatus =
GetKeyRotationStatusResponse
request = postJSON kMS
response
= receiveJSON
(\ s h x ->
GetKeyRotationStatusResponse' <$>
(x .?> "KeyRotationEnabled") <*> (pure (fromEnum s)))
instance ToHeaders GetKeyRotationStatus where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("TrentService.GetKeyRotationStatus" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetKeyRotationStatus where
toJSON GetKeyRotationStatus'{..}
= object (catMaybes [Just ("KeyId" .= _gkrsKeyId)])
instance ToPath GetKeyRotationStatus where
toPath = const "/"
instance ToQuery GetKeyRotationStatus where
toQuery = const mempty
data GetKeyRotationStatusResponse = GetKeyRotationStatusResponse'
{ _gkrsrsKeyRotationEnabled :: !(Maybe Bool)
, _gkrsrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getKeyRotationStatusResponse
:: Int
-> GetKeyRotationStatusResponse
getKeyRotationStatusResponse pStatus_ =
GetKeyRotationStatusResponse'
{ _gkrsrsKeyRotationEnabled = Nothing
, _gkrsrsStatus = pStatus_
}
gkrsrsKeyRotationEnabled :: Lens' GetKeyRotationStatusResponse (Maybe Bool)
gkrsrsKeyRotationEnabled = lens _gkrsrsKeyRotationEnabled (\ s a -> s{_gkrsrsKeyRotationEnabled = a});
gkrsrsStatus :: Lens' GetKeyRotationStatusResponse Int
gkrsrsStatus = lens _gkrsrsStatus (\ s a -> s{_gkrsrsStatus = a});