{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.KMS.GetKeyRotationStatus
(
getKeyRotationStatus
, GetKeyRotationStatus
, gkrsKeyId
, getKeyRotationStatusResponse
, GetKeyRotationStatusResponse
, gkrsrsKeyRotationEnabled
, gkrsrsResponseStatus
) 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
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 Hashable GetKeyRotationStatus where
instance NFData GetKeyRotationStatus where
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)
, _gkrsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getKeyRotationStatusResponse
:: Int
-> GetKeyRotationStatusResponse
getKeyRotationStatusResponse pResponseStatus_ =
GetKeyRotationStatusResponse'
{ _gkrsrsKeyRotationEnabled = Nothing
, _gkrsrsResponseStatus = pResponseStatus_
}
gkrsrsKeyRotationEnabled :: Lens' GetKeyRotationStatusResponse (Maybe Bool)
gkrsrsKeyRotationEnabled = lens _gkrsrsKeyRotationEnabled (\ s a -> s{_gkrsrsKeyRotationEnabled = a})
gkrsrsResponseStatus :: Lens' GetKeyRotationStatusResponse Int
gkrsrsResponseStatus = lens _gkrsrsResponseStatus (\ s a -> s{_gkrsrsResponseStatus = a})
instance NFData GetKeyRotationStatusResponse where