{-# 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.ScheduleKeyDeletion
(
scheduleKeyDeletion
, ScheduleKeyDeletion
, skdPendingWindowInDays
, skdKeyId
, scheduleKeyDeletionResponse
, ScheduleKeyDeletionResponse
, skdrsKeyId
, skdrsDeletionDate
, skdrsResponseStatus
) 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 ScheduleKeyDeletion = ScheduleKeyDeletion'
{ _skdPendingWindowInDays :: !(Maybe Nat)
, _skdKeyId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
scheduleKeyDeletion
:: Text
-> ScheduleKeyDeletion
scheduleKeyDeletion pKeyId_ =
ScheduleKeyDeletion'
{ _skdPendingWindowInDays = Nothing
, _skdKeyId = pKeyId_
}
skdPendingWindowInDays :: Lens' ScheduleKeyDeletion (Maybe Natural)
skdPendingWindowInDays = lens _skdPendingWindowInDays (\ s a -> s{_skdPendingWindowInDays = a}) . mapping _Nat;
skdKeyId :: Lens' ScheduleKeyDeletion Text
skdKeyId = lens _skdKeyId (\ s a -> s{_skdKeyId = a});
instance AWSRequest ScheduleKeyDeletion where
type Rs ScheduleKeyDeletion =
ScheduleKeyDeletionResponse
request = postJSON kms
response
= receiveJSON
(\ s h x ->
ScheduleKeyDeletionResponse' <$>
(x .?> "KeyId") <*> (x .?> "DeletionDate") <*>
(pure (fromEnum s)))
instance Hashable ScheduleKeyDeletion
instance NFData ScheduleKeyDeletion
instance ToHeaders ScheduleKeyDeletion where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("TrentService.ScheduleKeyDeletion" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ScheduleKeyDeletion where
toJSON ScheduleKeyDeletion'{..}
= object
(catMaybes
[("PendingWindowInDays" .=) <$>
_skdPendingWindowInDays,
Just ("KeyId" .= _skdKeyId)])
instance ToPath ScheduleKeyDeletion where
toPath = const "/"
instance ToQuery ScheduleKeyDeletion where
toQuery = const mempty
data ScheduleKeyDeletionResponse = ScheduleKeyDeletionResponse'
{ _skdrsKeyId :: !(Maybe Text)
, _skdrsDeletionDate :: !(Maybe POSIX)
, _skdrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
scheduleKeyDeletionResponse
:: Int
-> ScheduleKeyDeletionResponse
scheduleKeyDeletionResponse pResponseStatus_ =
ScheduleKeyDeletionResponse'
{ _skdrsKeyId = Nothing
, _skdrsDeletionDate = Nothing
, _skdrsResponseStatus = pResponseStatus_
}
skdrsKeyId :: Lens' ScheduleKeyDeletionResponse (Maybe Text)
skdrsKeyId = lens _skdrsKeyId (\ s a -> s{_skdrsKeyId = a});
skdrsDeletionDate :: Lens' ScheduleKeyDeletionResponse (Maybe UTCTime)
skdrsDeletionDate = lens _skdrsDeletionDate (\ s a -> s{_skdrsDeletionDate = a}) . mapping _Time;
skdrsResponseStatus :: Lens' ScheduleKeyDeletionResponse Int
skdrsResponseStatus = lens _skdrsResponseStatus (\ s a -> s{_skdrsResponseStatus = a});
instance NFData ScheduleKeyDeletionResponse