{-# 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.ListRules
(
listRules
, ListRules
, lrNextMarker
, lrLimit
, listRulesResponse
, ListRulesResponse
, lrrsRules
, lrrsNextMarker
, lrrsResponseStatus
) 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 ListRules = ListRules'
{ _lrNextMarker :: !(Maybe Text)
, _lrLimit :: !Nat
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listRules
:: Natural
-> ListRules
listRules pLimit_ =
ListRules'
{ _lrNextMarker = Nothing
, _lrLimit = _Nat # pLimit_
}
lrNextMarker :: Lens' ListRules (Maybe Text)
lrNextMarker = lens _lrNextMarker (\ s a -> s{_lrNextMarker = a});
lrLimit :: Lens' ListRules Natural
lrLimit = lens _lrLimit (\ s a -> s{_lrLimit = a}) . _Nat;
instance AWSRequest ListRules where
type Rs ListRules = ListRulesResponse
request = postJSON waf
response
= receiveJSON
(\ s h x ->
ListRulesResponse' <$>
(x .?> "Rules" .!@ mempty) <*> (x .?> "NextMarker")
<*> (pure (fromEnum s)))
instance Hashable ListRules
instance NFData ListRules
instance ToHeaders ListRules where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.ListRules" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListRules where
toJSON ListRules'{..}
= object
(catMaybes
[("NextMarker" .=) <$> _lrNextMarker,
Just ("Limit" .= _lrLimit)])
instance ToPath ListRules where
toPath = const "/"
instance ToQuery ListRules where
toQuery = const mempty
data ListRulesResponse = ListRulesResponse'
{ _lrrsRules :: !(Maybe [RuleSummary])
, _lrrsNextMarker :: !(Maybe Text)
, _lrrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listRulesResponse
:: Int
-> ListRulesResponse
listRulesResponse pResponseStatus_ =
ListRulesResponse'
{ _lrrsRules = Nothing
, _lrrsNextMarker = Nothing
, _lrrsResponseStatus = pResponseStatus_
}
lrrsRules :: Lens' ListRulesResponse [RuleSummary]
lrrsRules = lens _lrrsRules (\ s a -> s{_lrrsRules = a}) . _Default . _Coerce;
lrrsNextMarker :: Lens' ListRulesResponse (Maybe Text)
lrrsNextMarker = lens _lrrsNextMarker (\ s a -> s{_lrrsNextMarker = a});
lrrsResponseStatus :: Lens' ListRulesResponse Int
lrrsResponseStatus = lens _lrrsResponseStatus (\ s a -> s{_lrrsResponseStatus = a});
instance NFData ListRulesResponse