module Network.AWS.ElastiCache.DescribeReplicationGroups
(
describeReplicationGroups
, DescribeReplicationGroups
, drgsMaxRecords
, drgsMarker
, drgsReplicationGroupId
, describeReplicationGroupsResponse
, DescribeReplicationGroupsResponse
, drgrsMarker
, drgrsReplicationGroups
, drgrsStatus
) 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 DescribeReplicationGroups = DescribeReplicationGroups'
{ _drgsMaxRecords :: !(Maybe Int)
, _drgsMarker :: !(Maybe Text)
, _drgsReplicationGroupId :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeReplicationGroups
:: DescribeReplicationGroups
describeReplicationGroups =
DescribeReplicationGroups'
{ _drgsMaxRecords = Nothing
, _drgsMarker = Nothing
, _drgsReplicationGroupId = Nothing
}
drgsMaxRecords :: Lens' DescribeReplicationGroups (Maybe Int)
drgsMaxRecords = lens _drgsMaxRecords (\ s a -> s{_drgsMaxRecords = a});
drgsMarker :: Lens' DescribeReplicationGroups (Maybe Text)
drgsMarker = lens _drgsMarker (\ s a -> s{_drgsMarker = a});
drgsReplicationGroupId :: Lens' DescribeReplicationGroups (Maybe Text)
drgsReplicationGroupId = lens _drgsReplicationGroupId (\ s a -> s{_drgsReplicationGroupId = a});
instance AWSPager DescribeReplicationGroups where
page rq rs
| stop (rs ^. drgrsMarker) = Nothing
| stop (rs ^. drgrsReplicationGroups) = Nothing
| otherwise =
Just $ rq & drgsMarker .~ rs ^. drgrsMarker
instance AWSRequest DescribeReplicationGroups where
type Sv DescribeReplicationGroups = ElastiCache
type Rs DescribeReplicationGroups =
DescribeReplicationGroupsResponse
request = postQuery
response
= receiveXMLWrapper "DescribeReplicationGroupsResult"
(\ s h x ->
DescribeReplicationGroupsResponse' <$>
(x .@? "Marker") <*>
(x .@? "ReplicationGroups" .!@ mempty >>=
may (parseXMLList "ReplicationGroup"))
<*> (pure (fromEnum s)))
instance ToHeaders DescribeReplicationGroups where
toHeaders = const mempty
instance ToPath DescribeReplicationGroups where
toPath = const "/"
instance ToQuery DescribeReplicationGroups where
toQuery DescribeReplicationGroups'{..}
= mconcat
["Action" =:
("DescribeReplicationGroups" :: ByteString),
"Version" =: ("2015-02-02" :: ByteString),
"MaxRecords" =: _drgsMaxRecords,
"Marker" =: _drgsMarker,
"ReplicationGroupId" =: _drgsReplicationGroupId]
data DescribeReplicationGroupsResponse = DescribeReplicationGroupsResponse'
{ _drgrsMarker :: !(Maybe Text)
, _drgrsReplicationGroups :: !(Maybe [ReplicationGroup])
, _drgrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeReplicationGroupsResponse
:: Int
-> DescribeReplicationGroupsResponse
describeReplicationGroupsResponse pStatus_ =
DescribeReplicationGroupsResponse'
{ _drgrsMarker = Nothing
, _drgrsReplicationGroups = Nothing
, _drgrsStatus = pStatus_
}
drgrsMarker :: Lens' DescribeReplicationGroupsResponse (Maybe Text)
drgrsMarker = lens _drgrsMarker (\ s a -> s{_drgrsMarker = a});
drgrsReplicationGroups :: Lens' DescribeReplicationGroupsResponse [ReplicationGroup]
drgrsReplicationGroups = lens _drgrsReplicationGroups (\ s a -> s{_drgrsReplicationGroups = a}) . _Default . _Coerce;
drgrsStatus :: Lens' DescribeReplicationGroupsResponse Int
drgrsStatus = lens _drgrsStatus (\ s a -> s{_drgrsStatus = a});