module Network.AWS.ElastiCache.DescribeCacheParameterGroups
(
describeCacheParameterGroups
, DescribeCacheParameterGroups
, dcpgCacheParameterGroupName
, dcpgMarker
, dcpgMaxRecords
, describeCacheParameterGroupsResponse
, DescribeCacheParameterGroupsResponse
, dcpgrsCacheParameterGroups
, dcpgrsMarker
, dcpgrsResponseStatus
) 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 DescribeCacheParameterGroups = DescribeCacheParameterGroups'
{ _dcpgCacheParameterGroupName :: !(Maybe Text)
, _dcpgMarker :: !(Maybe Text)
, _dcpgMaxRecords :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeCacheParameterGroups
:: DescribeCacheParameterGroups
describeCacheParameterGroups =
DescribeCacheParameterGroups'
{ _dcpgCacheParameterGroupName = Nothing
, _dcpgMarker = Nothing
, _dcpgMaxRecords = Nothing
}
dcpgCacheParameterGroupName :: Lens' DescribeCacheParameterGroups (Maybe Text)
dcpgCacheParameterGroupName = lens _dcpgCacheParameterGroupName (\ s a -> s{_dcpgCacheParameterGroupName = a});
dcpgMarker :: Lens' DescribeCacheParameterGroups (Maybe Text)
dcpgMarker = lens _dcpgMarker (\ s a -> s{_dcpgMarker = a});
dcpgMaxRecords :: Lens' DescribeCacheParameterGroups (Maybe Int)
dcpgMaxRecords = lens _dcpgMaxRecords (\ s a -> s{_dcpgMaxRecords = a});
instance AWSPager DescribeCacheParameterGroups where
page rq rs
| stop (rs ^. dcpgrsMarker) = Nothing
| stop (rs ^. dcpgrsCacheParameterGroups) = Nothing
| otherwise =
Just $ rq & dcpgMarker .~ rs ^. dcpgrsMarker
instance AWSRequest DescribeCacheParameterGroups
where
type Rs DescribeCacheParameterGroups =
DescribeCacheParameterGroupsResponse
request = postQuery elastiCache
response
= receiveXMLWrapper
"DescribeCacheParameterGroupsResult"
(\ s h x ->
DescribeCacheParameterGroupsResponse' <$>
(x .@? "CacheParameterGroups" .!@ mempty >>=
may (parseXMLList "CacheParameterGroup"))
<*> (x .@? "Marker")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeCacheParameterGroups where
toHeaders = const mempty
instance ToPath DescribeCacheParameterGroups where
toPath = const "/"
instance ToQuery DescribeCacheParameterGroups where
toQuery DescribeCacheParameterGroups'{..}
= mconcat
["Action" =:
("DescribeCacheParameterGroups" :: ByteString),
"Version" =: ("2015-02-02" :: ByteString),
"CacheParameterGroupName" =:
_dcpgCacheParameterGroupName,
"Marker" =: _dcpgMarker,
"MaxRecords" =: _dcpgMaxRecords]
data DescribeCacheParameterGroupsResponse = DescribeCacheParameterGroupsResponse'
{ _dcpgrsCacheParameterGroups :: !(Maybe [CacheParameterGroup])
, _dcpgrsMarker :: !(Maybe Text)
, _dcpgrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeCacheParameterGroupsResponse
:: Int
-> DescribeCacheParameterGroupsResponse
describeCacheParameterGroupsResponse pResponseStatus_ =
DescribeCacheParameterGroupsResponse'
{ _dcpgrsCacheParameterGroups = Nothing
, _dcpgrsMarker = Nothing
, _dcpgrsResponseStatus = pResponseStatus_
}
dcpgrsCacheParameterGroups :: Lens' DescribeCacheParameterGroupsResponse [CacheParameterGroup]
dcpgrsCacheParameterGroups = lens _dcpgrsCacheParameterGroups (\ s a -> s{_dcpgrsCacheParameterGroups = a}) . _Default . _Coerce;
dcpgrsMarker :: Lens' DescribeCacheParameterGroupsResponse (Maybe Text)
dcpgrsMarker = lens _dcpgrsMarker (\ s a -> s{_dcpgrsMarker = a});
dcpgrsResponseStatus :: Lens' DescribeCacheParameterGroupsResponse Int
dcpgrsResponseStatus = lens _dcpgrsResponseStatus (\ s a -> s{_dcpgrsResponseStatus = a});