{-# 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.ListSizeConstraintSets
(
listSizeConstraintSets
, ListSizeConstraintSets
, lscsNextMarker
, lscsLimit
, listSizeConstraintSetsResponse
, ListSizeConstraintSetsResponse
, lscsrsSizeConstraintSets
, lscsrsNextMarker
, lscsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WAF.Types
import Network.AWS.WAF.Types.Product
data ListSizeConstraintSets = ListSizeConstraintSets'
{ _lscsNextMarker :: !(Maybe Text)
, _lscsLimit :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listSizeConstraintSets
:: ListSizeConstraintSets
listSizeConstraintSets =
ListSizeConstraintSets' {_lscsNextMarker = Nothing, _lscsLimit = Nothing}
lscsNextMarker :: Lens' ListSizeConstraintSets (Maybe Text)
lscsNextMarker = lens _lscsNextMarker (\ s a -> s{_lscsNextMarker = a})
lscsLimit :: Lens' ListSizeConstraintSets (Maybe Natural)
lscsLimit = lens _lscsLimit (\ s a -> s{_lscsLimit = a}) . mapping _Nat
instance AWSPager ListSizeConstraintSets where
page rq rs
| stop (rs ^. lscsrsNextMarker) = Nothing
| stop (rs ^. lscsrsSizeConstraintSets) = Nothing
| otherwise =
Just $ rq & lscsNextMarker .~ rs ^. lscsrsNextMarker
instance AWSRequest ListSizeConstraintSets where
type Rs ListSizeConstraintSets =
ListSizeConstraintSetsResponse
request = postJSON waf
response
= receiveJSON
(\ s h x ->
ListSizeConstraintSetsResponse' <$>
(x .?> "SizeConstraintSets" .!@ mempty) <*>
(x .?> "NextMarker")
<*> (pure (fromEnum s)))
instance Hashable ListSizeConstraintSets where
instance NFData ListSizeConstraintSets where
instance ToHeaders ListSizeConstraintSets where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.ListSizeConstraintSets" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListSizeConstraintSets where
toJSON ListSizeConstraintSets'{..}
= object
(catMaybes
[("NextMarker" .=) <$> _lscsNextMarker,
("Limit" .=) <$> _lscsLimit])
instance ToPath ListSizeConstraintSets where
toPath = const "/"
instance ToQuery ListSizeConstraintSets where
toQuery = const mempty
data ListSizeConstraintSetsResponse = ListSizeConstraintSetsResponse'
{ _lscsrsSizeConstraintSets :: !(Maybe [SizeConstraintSetSummary])
, _lscsrsNextMarker :: !(Maybe Text)
, _lscsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listSizeConstraintSetsResponse
:: Int
-> ListSizeConstraintSetsResponse
listSizeConstraintSetsResponse pResponseStatus_ =
ListSizeConstraintSetsResponse'
{ _lscsrsSizeConstraintSets = Nothing
, _lscsrsNextMarker = Nothing
, _lscsrsResponseStatus = pResponseStatus_
}
lscsrsSizeConstraintSets :: Lens' ListSizeConstraintSetsResponse [SizeConstraintSetSummary]
lscsrsSizeConstraintSets = lens _lscsrsSizeConstraintSets (\ s a -> s{_lscsrsSizeConstraintSets = a}) . _Default . _Coerce
lscsrsNextMarker :: Lens' ListSizeConstraintSetsResponse (Maybe Text)
lscsrsNextMarker = lens _lscsrsNextMarker (\ s a -> s{_lscsrsNextMarker = a})
lscsrsResponseStatus :: Lens' ListSizeConstraintSetsResponse Int
lscsrsResponseStatus = lens _lscsrsResponseStatus (\ s a -> s{_lscsrsResponseStatus = a})
instance NFData ListSizeConstraintSetsResponse where