{-# 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.DMS.DescribeReplicationSubnetGroups
(
describeReplicationSubnetGroups
, DescribeReplicationSubnetGroups
, drsgFilters
, drsgMarker
, drsgMaxRecords
, describeReplicationSubnetGroupsResponse
, DescribeReplicationSubnetGroupsResponse
, drsgsrsMarker
, drsgsrsReplicationSubnetGroups
, drsgsrsResponseStatus
) where
import Network.AWS.DMS.Types
import Network.AWS.DMS.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeReplicationSubnetGroups = DescribeReplicationSubnetGroups'
{ _drsgFilters :: !(Maybe [Filter])
, _drsgMarker :: !(Maybe Text)
, _drsgMaxRecords :: !(Maybe Int)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeReplicationSubnetGroups
:: DescribeReplicationSubnetGroups
describeReplicationSubnetGroups =
DescribeReplicationSubnetGroups'
{_drsgFilters = Nothing, _drsgMarker = Nothing, _drsgMaxRecords = Nothing}
drsgFilters :: Lens' DescribeReplicationSubnetGroups [Filter]
drsgFilters = lens _drsgFilters (\ s a -> s{_drsgFilters = a}) . _Default . _Coerce
drsgMarker :: Lens' DescribeReplicationSubnetGroups (Maybe Text)
drsgMarker = lens _drsgMarker (\ s a -> s{_drsgMarker = a})
drsgMaxRecords :: Lens' DescribeReplicationSubnetGroups (Maybe Int)
drsgMaxRecords = lens _drsgMaxRecords (\ s a -> s{_drsgMaxRecords = a})
instance AWSPager DescribeReplicationSubnetGroups
where
page rq rs
| stop (rs ^. drsgsrsMarker) = Nothing
| stop (rs ^. drsgsrsReplicationSubnetGroups) =
Nothing
| otherwise =
Just $ rq & drsgMarker .~ rs ^. drsgsrsMarker
instance AWSRequest DescribeReplicationSubnetGroups
where
type Rs DescribeReplicationSubnetGroups =
DescribeReplicationSubnetGroupsResponse
request = postJSON dms
response
= receiveJSON
(\ s h x ->
DescribeReplicationSubnetGroupsResponse' <$>
(x .?> "Marker") <*>
(x .?> "ReplicationSubnetGroups" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeReplicationSubnetGroups
where
instance NFData DescribeReplicationSubnetGroups where
instance ToHeaders DescribeReplicationSubnetGroups
where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonDMSv20160101.DescribeReplicationSubnetGroups"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeReplicationSubnetGroups where
toJSON DescribeReplicationSubnetGroups'{..}
= object
(catMaybes
[("Filters" .=) <$> _drsgFilters,
("Marker" .=) <$> _drsgMarker,
("MaxRecords" .=) <$> _drsgMaxRecords])
instance ToPath DescribeReplicationSubnetGroups where
toPath = const "/"
instance ToQuery DescribeReplicationSubnetGroups
where
toQuery = const mempty
data DescribeReplicationSubnetGroupsResponse = DescribeReplicationSubnetGroupsResponse'
{ _drsgsrsMarker :: !(Maybe Text)
, _drsgsrsReplicationSubnetGroups :: !(Maybe [ReplicationSubnetGroup])
, _drsgsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeReplicationSubnetGroupsResponse
:: Int
-> DescribeReplicationSubnetGroupsResponse
describeReplicationSubnetGroupsResponse pResponseStatus_ =
DescribeReplicationSubnetGroupsResponse'
{ _drsgsrsMarker = Nothing
, _drsgsrsReplicationSubnetGroups = Nothing
, _drsgsrsResponseStatus = pResponseStatus_
}
drsgsrsMarker :: Lens' DescribeReplicationSubnetGroupsResponse (Maybe Text)
drsgsrsMarker = lens _drsgsrsMarker (\ s a -> s{_drsgsrsMarker = a})
drsgsrsReplicationSubnetGroups :: Lens' DescribeReplicationSubnetGroupsResponse [ReplicationSubnetGroup]
drsgsrsReplicationSubnetGroups = lens _drsgsrsReplicationSubnetGroups (\ s a -> s{_drsgsrsReplicationSubnetGroups = a}) . _Default . _Coerce
drsgsrsResponseStatus :: Lens' DescribeReplicationSubnetGroupsResponse Int
drsgsrsResponseStatus = lens _drsgsrsResponseStatus (\ s a -> s{_drsgsrsResponseStatus = a})
instance NFData
DescribeReplicationSubnetGroupsResponse
where