module Network.AWS.RDS.DescribeDBSubnetGroups
    (
    
      describeDBSubnetGroups
    , DescribeDBSubnetGroups
    
    , ddsgDBSubnetGroupName
    , ddsgFilters
    , ddsgMarker
    , ddsgMaxRecords
    
    , describeDBSubnetGroupsResponse
    , DescribeDBSubnetGroupsResponse
    
    , ddsgrsDBSubnetGroups
    , ddsgrsMarker
    , ddsgrsResponseStatus
    ) where
import           Network.AWS.Pager
import           Network.AWS.Prelude
import           Network.AWS.RDS.Types
import           Network.AWS.RDS.Types.Product
import           Network.AWS.Request
import           Network.AWS.Response
data DescribeDBSubnetGroups = DescribeDBSubnetGroups'
    { _ddsgDBSubnetGroupName :: !(Maybe Text)
    , _ddsgFilters           :: !(Maybe [Filter])
    , _ddsgMarker            :: !(Maybe Text)
    , _ddsgMaxRecords        :: !(Maybe Int)
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDBSubnetGroups
    :: DescribeDBSubnetGroups
describeDBSubnetGroups =
    DescribeDBSubnetGroups'
    { _ddsgDBSubnetGroupName = Nothing
    , _ddsgFilters = Nothing
    , _ddsgMarker = Nothing
    , _ddsgMaxRecords = Nothing
    }
ddsgDBSubnetGroupName :: Lens' DescribeDBSubnetGroups (Maybe Text)
ddsgDBSubnetGroupName = lens _ddsgDBSubnetGroupName (\ s a -> s{_ddsgDBSubnetGroupName = a});
ddsgFilters :: Lens' DescribeDBSubnetGroups [Filter]
ddsgFilters = lens _ddsgFilters (\ s a -> s{_ddsgFilters = a}) . _Default . _Coerce;
ddsgMarker :: Lens' DescribeDBSubnetGroups (Maybe Text)
ddsgMarker = lens _ddsgMarker (\ s a -> s{_ddsgMarker = a});
ddsgMaxRecords :: Lens' DescribeDBSubnetGroups (Maybe Int)
ddsgMaxRecords = lens _ddsgMaxRecords (\ s a -> s{_ddsgMaxRecords = a});
instance AWSPager DescribeDBSubnetGroups where
        page rq rs
          | stop (rs ^. ddsgrsMarker) = Nothing
          | stop (rs ^. ddsgrsDBSubnetGroups) = Nothing
          | otherwise =
            Just $ rq & ddsgMarker .~ rs ^. ddsgrsMarker
instance AWSRequest DescribeDBSubnetGroups where
        type Rs DescribeDBSubnetGroups =
             DescribeDBSubnetGroupsResponse
        request = postQuery rDS
        response
          = receiveXMLWrapper "DescribeDBSubnetGroupsResult"
              (\ s h x ->
                 DescribeDBSubnetGroupsResponse' <$>
                   (x .@? "DBSubnetGroups" .!@ mempty >>=
                      may (parseXMLList "DBSubnetGroup"))
                     <*> (x .@? "Marker")
                     <*> (pure (fromEnum s)))
instance ToHeaders DescribeDBSubnetGroups where
        toHeaders = const mempty
instance ToPath DescribeDBSubnetGroups where
        toPath = const "/"
instance ToQuery DescribeDBSubnetGroups where
        toQuery DescribeDBSubnetGroups'{..}
          = mconcat
              ["Action" =:
                 ("DescribeDBSubnetGroups" :: ByteString),
               "Version" =: ("2014-10-31" :: ByteString),
               "DBSubnetGroupName" =: _ddsgDBSubnetGroupName,
               "Filters" =:
                 toQuery (toQueryList "Filter" <$> _ddsgFilters),
               "Marker" =: _ddsgMarker,
               "MaxRecords" =: _ddsgMaxRecords]
data DescribeDBSubnetGroupsResponse = DescribeDBSubnetGroupsResponse'
    { _ddsgrsDBSubnetGroups :: !(Maybe [DBSubnetGroup])
    , _ddsgrsMarker         :: !(Maybe Text)
    , _ddsgrsResponseStatus :: !Int
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDBSubnetGroupsResponse
    :: Int 
    -> DescribeDBSubnetGroupsResponse
describeDBSubnetGroupsResponse pResponseStatus_ =
    DescribeDBSubnetGroupsResponse'
    { _ddsgrsDBSubnetGroups = Nothing
    , _ddsgrsMarker = Nothing
    , _ddsgrsResponseStatus = pResponseStatus_
    }
ddsgrsDBSubnetGroups :: Lens' DescribeDBSubnetGroupsResponse [DBSubnetGroup]
ddsgrsDBSubnetGroups = lens _ddsgrsDBSubnetGroups (\ s a -> s{_ddsgrsDBSubnetGroups = a}) . _Default . _Coerce;
ddsgrsMarker :: Lens' DescribeDBSubnetGroupsResponse (Maybe Text)
ddsgrsMarker = lens _ddsgrsMarker (\ s a -> s{_ddsgrsMarker = a});
ddsgrsResponseStatus :: Lens' DescribeDBSubnetGroupsResponse Int
ddsgrsResponseStatus = lens _ddsgrsResponseStatus (\ s a -> s{_ddsgrsResponseStatus = a});