{-# 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.WAF.DeleteRule
(
deleteRule
, DeleteRule
, drRuleId
, drChangeToken
, deleteRuleResponse
, DeleteRuleResponse
, drrsChangeToken
, drrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WAF.Types
import Network.AWS.WAF.Types.Product
data DeleteRule = DeleteRule'
{ _drRuleId :: !Text
, _drChangeToken :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
deleteRule
:: Text
-> Text
-> DeleteRule
deleteRule pRuleId_ pChangeToken_ =
DeleteRule' {_drRuleId = pRuleId_, _drChangeToken = pChangeToken_}
drRuleId :: Lens' DeleteRule Text
drRuleId = lens _drRuleId (\ s a -> s{_drRuleId = a})
drChangeToken :: Lens' DeleteRule Text
drChangeToken = lens _drChangeToken (\ s a -> s{_drChangeToken = a})
instance AWSRequest DeleteRule where
type Rs DeleteRule = DeleteRuleResponse
request = postJSON waf
response
= receiveJSON
(\ s h x ->
DeleteRuleResponse' <$>
(x .?> "ChangeToken") <*> (pure (fromEnum s)))
instance Hashable DeleteRule where
instance NFData DeleteRule where
instance ToHeaders DeleteRule where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.DeleteRule" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DeleteRule where
toJSON DeleteRule'{..}
= object
(catMaybes
[Just ("RuleId" .= _drRuleId),
Just ("ChangeToken" .= _drChangeToken)])
instance ToPath DeleteRule where
toPath = const "/"
instance ToQuery DeleteRule where
toQuery = const mempty
data DeleteRuleResponse = DeleteRuleResponse'
{ _drrsChangeToken :: !(Maybe Text)
, _drrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
deleteRuleResponse
:: Int
-> DeleteRuleResponse
deleteRuleResponse pResponseStatus_ =
DeleteRuleResponse'
{_drrsChangeToken = Nothing, _drrsResponseStatus = pResponseStatus_}
drrsChangeToken :: Lens' DeleteRuleResponse (Maybe Text)
drrsChangeToken = lens _drrsChangeToken (\ s a -> s{_drrsChangeToken = a})
drrsResponseStatus :: Lens' DeleteRuleResponse Int
drrsResponseStatus = lens _drrsResponseStatus (\ s a -> s{_drrsResponseStatus = a})
instance NFData DeleteRuleResponse where