{-# 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.GetRateBasedRule
(
getRateBasedRule
, GetRateBasedRule
, grbrRuleId
, getRateBasedRuleResponse
, GetRateBasedRuleResponse
, grbrrsRule
, grbrrsResponseStatus
) 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
newtype GetRateBasedRule = GetRateBasedRule'
{ _grbrRuleId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRateBasedRule
:: Text
-> GetRateBasedRule
getRateBasedRule pRuleId_ = GetRateBasedRule' {_grbrRuleId = pRuleId_}
grbrRuleId :: Lens' GetRateBasedRule Text
grbrRuleId = lens _grbrRuleId (\ s a -> s{_grbrRuleId = a})
instance AWSRequest GetRateBasedRule where
type Rs GetRateBasedRule = GetRateBasedRuleResponse
request = postJSON waf
response
= receiveJSON
(\ s h x ->
GetRateBasedRuleResponse' <$>
(x .?> "Rule") <*> (pure (fromEnum s)))
instance Hashable GetRateBasedRule where
instance NFData GetRateBasedRule where
instance ToHeaders GetRateBasedRule where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.GetRateBasedRule" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetRateBasedRule where
toJSON GetRateBasedRule'{..}
= object (catMaybes [Just ("RuleId" .= _grbrRuleId)])
instance ToPath GetRateBasedRule where
toPath = const "/"
instance ToQuery GetRateBasedRule where
toQuery = const mempty
data GetRateBasedRuleResponse = GetRateBasedRuleResponse'
{ _grbrrsRule :: !(Maybe RateBasedRule)
, _grbrrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRateBasedRuleResponse
:: Int
-> GetRateBasedRuleResponse
getRateBasedRuleResponse pResponseStatus_ =
GetRateBasedRuleResponse'
{_grbrrsRule = Nothing, _grbrrsResponseStatus = pResponseStatus_}
grbrrsRule :: Lens' GetRateBasedRuleResponse (Maybe RateBasedRule)
grbrrsRule = lens _grbrrsRule (\ s a -> s{_grbrrsRule = a})
grbrrsResponseStatus :: Lens' GetRateBasedRuleResponse Int
grbrrsResponseStatus = lens _grbrrsResponseStatus (\ s a -> s{_grbrrsResponseStatus = a})
instance NFData GetRateBasedRuleResponse where