{-# 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.ListIPSets
(
listIPSets
, ListIPSets
, lisNextMarker
, lisLimit
, listIPSetsResponse
, ListIPSetsResponse
, lisrsNextMarker
, lisrsIPSets
, lisrsResponseStatus
) 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 ListIPSets = ListIPSets'
{ _lisNextMarker :: !(Maybe Text)
, _lisLimit :: !Nat
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listIPSets
:: Natural
-> ListIPSets
listIPSets pLimit_ =
ListIPSets'
{ _lisNextMarker = Nothing
, _lisLimit = _Nat # pLimit_
}
lisNextMarker :: Lens' ListIPSets (Maybe Text)
lisNextMarker = lens _lisNextMarker (\ s a -> s{_lisNextMarker = a});
lisLimit :: Lens' ListIPSets Natural
lisLimit = lens _lisLimit (\ s a -> s{_lisLimit = a}) . _Nat;
instance AWSRequest ListIPSets where
type Rs ListIPSets = ListIPSetsResponse
request = postJSON waf
response
= receiveJSON
(\ s h x ->
ListIPSetsResponse' <$>
(x .?> "NextMarker") <*> (x .?> "IPSets" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListIPSets
instance NFData ListIPSets
instance ToHeaders ListIPSets where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.ListIPSets" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListIPSets where
toJSON ListIPSets'{..}
= object
(catMaybes
[("NextMarker" .=) <$> _lisNextMarker,
Just ("Limit" .= _lisLimit)])
instance ToPath ListIPSets where
toPath = const "/"
instance ToQuery ListIPSets where
toQuery = const mempty
data ListIPSetsResponse = ListIPSetsResponse'
{ _lisrsNextMarker :: !(Maybe Text)
, _lisrsIPSets :: !(Maybe [IPSetSummary])
, _lisrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listIPSetsResponse
:: Int
-> ListIPSetsResponse
listIPSetsResponse pResponseStatus_ =
ListIPSetsResponse'
{ _lisrsNextMarker = Nothing
, _lisrsIPSets = Nothing
, _lisrsResponseStatus = pResponseStatus_
}
lisrsNextMarker :: Lens' ListIPSetsResponse (Maybe Text)
lisrsNextMarker = lens _lisrsNextMarker (\ s a -> s{_lisrsNextMarker = a});
lisrsIPSets :: Lens' ListIPSetsResponse [IPSetSummary]
lisrsIPSets = lens _lisrsIPSets (\ s a -> s{_lisrsIPSets = a}) . _Default . _Coerce;
lisrsResponseStatus :: Lens' ListIPSetsResponse Int
lisrsResponseStatus = lens _lisrsResponseStatus (\ s a -> s{_lisrsResponseStatus = a});
instance NFData ListIPSetsResponse