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