module Network.AWS.ElastiCache.DescribeCacheSubnetGroups
(
DescribeCacheSubnetGroups
, describeCacheSubnetGroups
, dcsgCacheSubnetGroupName
, dcsgMarker
, dcsgMaxRecords
, DescribeCacheSubnetGroupsResponse
, describeCacheSubnetGroupsResponse
, dcsgrCacheSubnetGroups
, dcsgrMarker
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.ElastiCache.Types
import qualified GHC.Exts
data DescribeCacheSubnetGroups = DescribeCacheSubnetGroups
{ _dcsgCacheSubnetGroupName :: Maybe Text
, _dcsgMarker :: Maybe Text
, _dcsgMaxRecords :: Maybe Int
} deriving (Eq, Ord, Show)
describeCacheSubnetGroups :: DescribeCacheSubnetGroups
describeCacheSubnetGroups = DescribeCacheSubnetGroups
{ _dcsgCacheSubnetGroupName = Nothing
, _dcsgMaxRecords = Nothing
, _dcsgMarker = 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 })
data DescribeCacheSubnetGroupsResponse = DescribeCacheSubnetGroupsResponse
{ _dcsgrCacheSubnetGroups :: List "member" CacheSubnetGroup
, _dcsgrMarker :: Maybe Text
} deriving (Eq, Show)
describeCacheSubnetGroupsResponse :: DescribeCacheSubnetGroupsResponse
describeCacheSubnetGroupsResponse = DescribeCacheSubnetGroupsResponse
{ _dcsgrMarker = Nothing
, _dcsgrCacheSubnetGroups = mempty
}
dcsgrCacheSubnetGroups :: Lens' DescribeCacheSubnetGroupsResponse [CacheSubnetGroup]
dcsgrCacheSubnetGroups =
lens _dcsgrCacheSubnetGroups (\s a -> s { _dcsgrCacheSubnetGroups = a })
. _List
dcsgrMarker :: Lens' DescribeCacheSubnetGroupsResponse (Maybe Text)
dcsgrMarker = lens _dcsgrMarker (\s a -> s { _dcsgrMarker = a })
instance ToPath DescribeCacheSubnetGroups where
toPath = const "/"
instance ToQuery DescribeCacheSubnetGroups where
toQuery DescribeCacheSubnetGroups{..} = mconcat
[ "CacheSubnetGroupName" =? _dcsgCacheSubnetGroupName
, "Marker" =? _dcsgMarker
, "MaxRecords" =? _dcsgMaxRecords
]
instance ToHeaders DescribeCacheSubnetGroups
instance AWSRequest DescribeCacheSubnetGroups where
type Sv DescribeCacheSubnetGroups = ElastiCache
type Rs DescribeCacheSubnetGroups = DescribeCacheSubnetGroupsResponse
request = post "DescribeCacheSubnetGroups"
response = xmlResponse
instance FromXML DescribeCacheSubnetGroupsResponse where
parseXML = withElement "DescribeCacheSubnetGroupsResult" $ \x -> DescribeCacheSubnetGroupsResponse
<$> x .@? "CacheSubnetGroups" .!@ mempty
<*> x .@? "Marker"
instance AWSPager DescribeCacheSubnetGroups where
page rq rs
| stop (rq ^. dcsgMarker) = Nothing
| otherwise = (\x -> rq & dcsgMarker ?~ x)
<$> (rs ^. dcsgrMarker)