module Network.AWS.ElastiCache.DescribeCacheSecurityGroups
(
describeCacheSecurityGroups
, DescribeCacheSecurityGroups
, dcsgsCacheSecurityGroupName
, dcsgsMaxRecords
, dcsgsMarker
, describeCacheSecurityGroupsResponse
, DescribeCacheSecurityGroupsResponse
, dcsgsrsCacheSecurityGroups
, dcsgsrsMarker
, dcsgsrsStatus
) where
import Network.AWS.ElastiCache.Types
import Network.AWS.ElastiCache.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeCacheSecurityGroups = DescribeCacheSecurityGroups'
{ _dcsgsCacheSecurityGroupName :: !(Maybe Text)
, _dcsgsMaxRecords :: !(Maybe Int)
, _dcsgsMarker :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeCacheSecurityGroups
:: DescribeCacheSecurityGroups
describeCacheSecurityGroups =
DescribeCacheSecurityGroups'
{ _dcsgsCacheSecurityGroupName = Nothing
, _dcsgsMaxRecords = Nothing
, _dcsgsMarker = Nothing
}
dcsgsCacheSecurityGroupName :: Lens' DescribeCacheSecurityGroups (Maybe Text)
dcsgsCacheSecurityGroupName = lens _dcsgsCacheSecurityGroupName (\ s a -> s{_dcsgsCacheSecurityGroupName = a});
dcsgsMaxRecords :: Lens' DescribeCacheSecurityGroups (Maybe Int)
dcsgsMaxRecords = lens _dcsgsMaxRecords (\ s a -> s{_dcsgsMaxRecords = a});
dcsgsMarker :: Lens' DescribeCacheSecurityGroups (Maybe Text)
dcsgsMarker = lens _dcsgsMarker (\ s a -> s{_dcsgsMarker = a});
instance AWSPager DescribeCacheSecurityGroups where
page rq rs
| stop (rs ^. dcsgsrsMarker) = Nothing
| stop (rs ^. dcsgsrsCacheSecurityGroups) = Nothing
| otherwise =
Just $ rq & dcsgsMarker .~ rs ^. dcsgsrsMarker
instance AWSRequest DescribeCacheSecurityGroups where
type Sv DescribeCacheSecurityGroups = ElastiCache
type Rs DescribeCacheSecurityGroups =
DescribeCacheSecurityGroupsResponse
request = postQuery
response
= receiveXMLWrapper
"DescribeCacheSecurityGroupsResult"
(\ s h x ->
DescribeCacheSecurityGroupsResponse' <$>
(x .@? "CacheSecurityGroups" .!@ mempty >>=
may (parseXMLList "CacheSecurityGroup"))
<*> (x .@? "Marker")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeCacheSecurityGroups where
toHeaders = const mempty
instance ToPath DescribeCacheSecurityGroups where
toPath = const "/"
instance ToQuery DescribeCacheSecurityGroups where
toQuery DescribeCacheSecurityGroups'{..}
= mconcat
["Action" =:
("DescribeCacheSecurityGroups" :: ByteString),
"Version" =: ("2015-02-02" :: ByteString),
"CacheSecurityGroupName" =:
_dcsgsCacheSecurityGroupName,
"MaxRecords" =: _dcsgsMaxRecords,
"Marker" =: _dcsgsMarker]
data DescribeCacheSecurityGroupsResponse = DescribeCacheSecurityGroupsResponse'
{ _dcsgsrsCacheSecurityGroups :: !(Maybe [CacheSecurityGroup])
, _dcsgsrsMarker :: !(Maybe Text)
, _dcsgsrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeCacheSecurityGroupsResponse
:: Int
-> DescribeCacheSecurityGroupsResponse
describeCacheSecurityGroupsResponse pStatus_ =
DescribeCacheSecurityGroupsResponse'
{ _dcsgsrsCacheSecurityGroups = Nothing
, _dcsgsrsMarker = Nothing
, _dcsgsrsStatus = pStatus_
}
dcsgsrsCacheSecurityGroups :: Lens' DescribeCacheSecurityGroupsResponse [CacheSecurityGroup]
dcsgsrsCacheSecurityGroups = lens _dcsgsrsCacheSecurityGroups (\ s a -> s{_dcsgsrsCacheSecurityGroups = a}) . _Default . _Coerce;
dcsgsrsMarker :: Lens' DescribeCacheSecurityGroupsResponse (Maybe Text)
dcsgsrsMarker = lens _dcsgsrsMarker (\ s a -> s{_dcsgsrsMarker = a});
dcsgsrsStatus :: Lens' DescribeCacheSecurityGroupsResponse Int
dcsgsrsStatus = lens _dcsgsrsStatus (\ s a -> s{_dcsgsrsStatus = a});