{-# 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.ElastiCache.DescribeCacheSubnetGroups
(
describeCacheSubnetGroups
, DescribeCacheSubnetGroups
, dcsgCacheSubnetGroupName
, dcsgMarker
, dcsgMaxRecords
, describeCacheSubnetGroupsResponse
, DescribeCacheSubnetGroupsResponse
, dcsgrsMarker
, dcsgrsCacheSubnetGroups
, dcsgrsResponseStatus
) where
import Network.AWS.ElastiCache.Types
import Network.AWS.ElastiCache.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeCacheSubnetGroups = DescribeCacheSubnetGroups'
{ _dcsgCacheSubnetGroupName :: !(Maybe Text)
, _dcsgMarker :: !(Maybe Text)
, _dcsgMaxRecords :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeCacheSubnetGroups
:: DescribeCacheSubnetGroups
describeCacheSubnetGroups =
DescribeCacheSubnetGroups'
{ _dcsgCacheSubnetGroupName = Nothing
, _dcsgMarker = Nothing
, _dcsgMaxRecords = Nothing
}
dcsgCacheSubnetGroupName :: Lens' DescribeCacheSubnetGroups (Maybe Text)
dcsgCacheSubnetGroupName = lens _dcsgCacheSubnetGroupName (\ s a -> s{_dcsgCacheSubnetGroupName = a});
dcsgMarker :: Lens' DescribeCacheSubnetGroups (Maybe Text)
dcsgMarker = lens _dcsgMarker (\ s a -> s{_dcsgMarker = a});
dcsgMaxRecords :: Lens' DescribeCacheSubnetGroups (Maybe Int)
dcsgMaxRecords = lens _dcsgMaxRecords (\ s a -> s{_dcsgMaxRecords = a});
instance AWSPager DescribeCacheSubnetGroups where
page rq rs
| stop (rs ^. dcsgrsMarker) = Nothing
| stop (rs ^. dcsgrsCacheSubnetGroups) = Nothing
| otherwise =
Just $ rq & dcsgMarker .~ rs ^. dcsgrsMarker
instance AWSRequest DescribeCacheSubnetGroups where
type Rs DescribeCacheSubnetGroups =
DescribeCacheSubnetGroupsResponse
request = postQuery elastiCache
response
= receiveXMLWrapper "DescribeCacheSubnetGroupsResult"
(\ s h x ->
DescribeCacheSubnetGroupsResponse' <$>
(x .@? "Marker") <*>
(x .@? "CacheSubnetGroups" .!@ mempty >>=
may (parseXMLList "CacheSubnetGroup"))
<*> (pure (fromEnum s)))
instance Hashable DescribeCacheSubnetGroups
instance NFData DescribeCacheSubnetGroups
instance ToHeaders DescribeCacheSubnetGroups where
toHeaders = const mempty
instance ToPath DescribeCacheSubnetGroups where
toPath = const "/"
instance ToQuery DescribeCacheSubnetGroups where
toQuery DescribeCacheSubnetGroups'{..}
= mconcat
["Action" =:
("DescribeCacheSubnetGroups" :: ByteString),
"Version" =: ("2015-02-02" :: ByteString),
"CacheSubnetGroupName" =: _dcsgCacheSubnetGroupName,
"Marker" =: _dcsgMarker,
"MaxRecords" =: _dcsgMaxRecords]
data DescribeCacheSubnetGroupsResponse = DescribeCacheSubnetGroupsResponse'
{ _dcsgrsMarker :: !(Maybe Text)
, _dcsgrsCacheSubnetGroups :: !(Maybe [CacheSubnetGroup])
, _dcsgrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeCacheSubnetGroupsResponse
:: Int
-> DescribeCacheSubnetGroupsResponse
describeCacheSubnetGroupsResponse pResponseStatus_ =
DescribeCacheSubnetGroupsResponse'
{ _dcsgrsMarker = Nothing
, _dcsgrsCacheSubnetGroups = Nothing
, _dcsgrsResponseStatus = pResponseStatus_
}
dcsgrsMarker :: Lens' DescribeCacheSubnetGroupsResponse (Maybe Text)
dcsgrsMarker = lens _dcsgrsMarker (\ s a -> s{_dcsgrsMarker = a});
dcsgrsCacheSubnetGroups :: Lens' DescribeCacheSubnetGroupsResponse [CacheSubnetGroup]
dcsgrsCacheSubnetGroups = lens _dcsgrsCacheSubnetGroups (\ s a -> s{_dcsgrsCacheSubnetGroups = a}) . _Default . _Coerce;
dcsgrsResponseStatus :: Lens' DescribeCacheSubnetGroupsResponse Int
dcsgrsResponseStatus = lens _dcsgrsResponseStatus (\ s a -> s{_dcsgrsResponseStatus = a});
instance NFData DescribeCacheSubnetGroupsResponse