{-# 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.GetRuleGroup
(
getRuleGroup
, GetRuleGroup
, grgRuleGroupId
, getRuleGroupResponse
, GetRuleGroupResponse
, grgrsRuleGroup
, grgrsResponseStatus
) 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 GetRuleGroup = GetRuleGroup'
{ _grgRuleGroupId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRuleGroup
:: Text
-> GetRuleGroup
getRuleGroup pRuleGroupId_ = GetRuleGroup' {_grgRuleGroupId = pRuleGroupId_}
grgRuleGroupId :: Lens' GetRuleGroup Text
grgRuleGroupId = lens _grgRuleGroupId (\ s a -> s{_grgRuleGroupId = a})
instance AWSRequest GetRuleGroup where
type Rs GetRuleGroup = GetRuleGroupResponse
request = postJSON waf
response
= receiveJSON
(\ s h x ->
GetRuleGroupResponse' <$>
(x .?> "RuleGroup") <*> (pure (fromEnum s)))
instance Hashable GetRuleGroup where
instance NFData GetRuleGroup where
instance ToHeaders GetRuleGroup where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.GetRuleGroup" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetRuleGroup where
toJSON GetRuleGroup'{..}
= object
(catMaybes [Just ("RuleGroupId" .= _grgRuleGroupId)])
instance ToPath GetRuleGroup where
toPath = const "/"
instance ToQuery GetRuleGroup where
toQuery = const mempty
data GetRuleGroupResponse = GetRuleGroupResponse'
{ _grgrsRuleGroup :: !(Maybe RuleGroup)
, _grgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRuleGroupResponse
:: Int
-> GetRuleGroupResponse
getRuleGroupResponse pResponseStatus_ =
GetRuleGroupResponse'
{_grgrsRuleGroup = Nothing, _grgrsResponseStatus = pResponseStatus_}
grgrsRuleGroup :: Lens' GetRuleGroupResponse (Maybe RuleGroup)
grgrsRuleGroup = lens _grgrsRuleGroup (\ s a -> s{_grgrsRuleGroup = a})
grgrsResponseStatus :: Lens' GetRuleGroupResponse Int
grgrsResponseStatus = lens _grgrsResponseStatus (\ s a -> s{_grgrsResponseStatus = a})
instance NFData GetRuleGroupResponse where