module Network.AWS.ElastiCache.DescribeReplicationGroups
(
DescribeReplicationGroups
, describeReplicationGroups
, drg1Marker
, drg1MaxRecords
, drg1ReplicationGroupId
, DescribeReplicationGroupsResponse
, describeReplicationGroupsResponse
, drgrMarker
, drgrReplicationGroups
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.ElastiCache.Types
import qualified GHC.Exts
data DescribeReplicationGroups = DescribeReplicationGroups
{ _drg1Marker :: Maybe Text
, _drg1MaxRecords :: Maybe Int
, _drg1ReplicationGroupId :: Maybe Text
} deriving (Eq, Ord, Show)
describeReplicationGroups :: DescribeReplicationGroups
describeReplicationGroups = DescribeReplicationGroups
{ _drg1ReplicationGroupId = Nothing
, _drg1MaxRecords = Nothing
, _drg1Marker = Nothing
}
drg1Marker :: Lens' DescribeReplicationGroups (Maybe Text)
drg1Marker = lens _drg1Marker (\s a -> s { _drg1Marker = a })
drg1MaxRecords :: Lens' DescribeReplicationGroups (Maybe Int)
drg1MaxRecords = lens _drg1MaxRecords (\s a -> s { _drg1MaxRecords = a })
drg1ReplicationGroupId :: Lens' DescribeReplicationGroups (Maybe Text)
drg1ReplicationGroupId =
lens _drg1ReplicationGroupId (\s a -> s { _drg1ReplicationGroupId = a })
data DescribeReplicationGroupsResponse = DescribeReplicationGroupsResponse
{ _drgrMarker :: Maybe Text
, _drgrReplicationGroups :: List "member" ReplicationGroup
} deriving (Eq, Show)
describeReplicationGroupsResponse :: DescribeReplicationGroupsResponse
describeReplicationGroupsResponse = DescribeReplicationGroupsResponse
{ _drgrMarker = Nothing
, _drgrReplicationGroups = mempty
}
drgrMarker :: Lens' DescribeReplicationGroupsResponse (Maybe Text)
drgrMarker = lens _drgrMarker (\s a -> s { _drgrMarker = a })
drgrReplicationGroups :: Lens' DescribeReplicationGroupsResponse [ReplicationGroup]
drgrReplicationGroups =
lens _drgrReplicationGroups (\s a -> s { _drgrReplicationGroups = a })
. _List
instance ToPath DescribeReplicationGroups where
toPath = const "/"
instance ToQuery DescribeReplicationGroups where
toQuery DescribeReplicationGroups{..} = mconcat
[ "Marker" =? _drg1Marker
, "MaxRecords" =? _drg1MaxRecords
, "ReplicationGroupId" =? _drg1ReplicationGroupId
]
instance ToHeaders DescribeReplicationGroups
instance AWSRequest DescribeReplicationGroups where
type Sv DescribeReplicationGroups = ElastiCache
type Rs DescribeReplicationGroups = DescribeReplicationGroupsResponse
request = post "DescribeReplicationGroups"
response = xmlResponse
instance FromXML DescribeReplicationGroupsResponse where
parseXML = withElement "DescribeReplicationGroupsResult" $ \x -> DescribeReplicationGroupsResponse
<$> x .@? "Marker"
<*> x .@? "ReplicationGroups" .!@ mempty
instance AWSPager DescribeReplicationGroups where
page rq rs
| stop (rq ^. drg1Marker) = Nothing
| otherwise = (\x -> rq & drg1Marker ?~ x)
<$> (rs ^. drgrMarker)