{-# 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.DescribeReplicationGroups
(
describeReplicationGroups
, DescribeReplicationGroups
, drgsMarker
, drgsMaxRecords
, drgsReplicationGroupId
, describeReplicationGroupsResponse
, DescribeReplicationGroupsResponse
, drgrsMarker
, drgrsReplicationGroups
, drgrsResponseStatus
) 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 DescribeReplicationGroups = DescribeReplicationGroups'
{ _drgsMarker :: !(Maybe Text)
, _drgsMaxRecords :: !(Maybe Int)
, _drgsReplicationGroupId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeReplicationGroups
:: DescribeReplicationGroups
describeReplicationGroups =
DescribeReplicationGroups'
{ _drgsMarker = Nothing
, _drgsMaxRecords = Nothing
, _drgsReplicationGroupId = Nothing
}
drgsMarker :: Lens' DescribeReplicationGroups (Maybe Text)
drgsMarker = lens _drgsMarker (\ s a -> s{_drgsMarker = a})
drgsMaxRecords :: Lens' DescribeReplicationGroups (Maybe Int)
drgsMaxRecords = lens _drgsMaxRecords (\ s a -> s{_drgsMaxRecords = 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 Rs DescribeReplicationGroups =
DescribeReplicationGroupsResponse
request = postQuery elastiCache
response
= receiveXMLWrapper "DescribeReplicationGroupsResult"
(\ s h x ->
DescribeReplicationGroupsResponse' <$>
(x .@? "Marker") <*>
(x .@? "ReplicationGroups" .!@ mempty >>=
may (parseXMLList "ReplicationGroup"))
<*> (pure (fromEnum s)))
instance Hashable DescribeReplicationGroups where
instance NFData DescribeReplicationGroups where
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),
"Marker" =: _drgsMarker,
"MaxRecords" =: _drgsMaxRecords,
"ReplicationGroupId" =: _drgsReplicationGroupId]
data DescribeReplicationGroupsResponse = DescribeReplicationGroupsResponse'
{ _drgrsMarker :: !(Maybe Text)
, _drgrsReplicationGroups :: !(Maybe [ReplicationGroup])
, _drgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeReplicationGroupsResponse
:: Int
-> DescribeReplicationGroupsResponse
describeReplicationGroupsResponse pResponseStatus_ =
DescribeReplicationGroupsResponse'
{ _drgrsMarker = Nothing
, _drgrsReplicationGroups = Nothing
, _drgrsResponseStatus = pResponseStatus_
}
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
drgrsResponseStatus :: Lens' DescribeReplicationGroupsResponse Int
drgrsResponseStatus = lens _drgrsResponseStatus (\ s a -> s{_drgrsResponseStatus = a})
instance NFData DescribeReplicationGroupsResponse
where