module Network.AWS.RDS.DescribeDBInstances
(
describeDBInstances
, DescribeDBInstances
, ddbiFilters
, ddbiDBInstanceIdentifier
, ddbiMaxRecords
, ddbiMarker
, describeDBInstancesResponse
, DescribeDBInstancesResponse
, ddbirsDBInstances
, ddbirsMarker
, ddbirsStatus
) 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 DescribeDBInstances = DescribeDBInstances'
{ _ddbiFilters :: !(Maybe [Filter])
, _ddbiDBInstanceIdentifier :: !(Maybe Text)
, _ddbiMaxRecords :: !(Maybe Int)
, _ddbiMarker :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDBInstances
:: DescribeDBInstances
describeDBInstances =
DescribeDBInstances'
{ _ddbiFilters = Nothing
, _ddbiDBInstanceIdentifier = Nothing
, _ddbiMaxRecords = Nothing
, _ddbiMarker = Nothing
}
ddbiFilters :: Lens' DescribeDBInstances [Filter]
ddbiFilters = lens _ddbiFilters (\ s a -> s{_ddbiFilters = a}) . _Default . _Coerce;
ddbiDBInstanceIdentifier :: Lens' DescribeDBInstances (Maybe Text)
ddbiDBInstanceIdentifier = lens _ddbiDBInstanceIdentifier (\ s a -> s{_ddbiDBInstanceIdentifier = a});
ddbiMaxRecords :: Lens' DescribeDBInstances (Maybe Int)
ddbiMaxRecords = lens _ddbiMaxRecords (\ s a -> s{_ddbiMaxRecords = a});
ddbiMarker :: Lens' DescribeDBInstances (Maybe Text)
ddbiMarker = lens _ddbiMarker (\ s a -> s{_ddbiMarker = a});
instance AWSPager DescribeDBInstances where
page rq rs
| stop (rs ^. ddbirsMarker) = Nothing
| stop (rs ^. ddbirsDBInstances) = Nothing
| otherwise =
Just $ rq & ddbiMarker .~ rs ^. ddbirsMarker
instance AWSRequest DescribeDBInstances where
type Sv DescribeDBInstances = RDS
type Rs DescribeDBInstances =
DescribeDBInstancesResponse
request = postQuery
response
= receiveXMLWrapper "DescribeDBInstancesResult"
(\ s h x ->
DescribeDBInstancesResponse' <$>
(x .@? "DBInstances" .!@ mempty >>=
may (parseXMLList "DBInstance"))
<*> (x .@? "Marker")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeDBInstances where
toHeaders = const mempty
instance ToPath DescribeDBInstances where
toPath = const "/"
instance ToQuery DescribeDBInstances where
toQuery DescribeDBInstances'{..}
= mconcat
["Action" =: ("DescribeDBInstances" :: ByteString),
"Version" =: ("2014-10-31" :: ByteString),
"Filters" =:
toQuery (toQueryList "Filter" <$> _ddbiFilters),
"DBInstanceIdentifier" =: _ddbiDBInstanceIdentifier,
"MaxRecords" =: _ddbiMaxRecords,
"Marker" =: _ddbiMarker]
data DescribeDBInstancesResponse = DescribeDBInstancesResponse'
{ _ddbirsDBInstances :: !(Maybe [DBInstance])
, _ddbirsMarker :: !(Maybe Text)
, _ddbirsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDBInstancesResponse
:: Int
-> DescribeDBInstancesResponse
describeDBInstancesResponse pStatus_ =
DescribeDBInstancesResponse'
{ _ddbirsDBInstances = Nothing
, _ddbirsMarker = Nothing
, _ddbirsStatus = pStatus_
}
ddbirsDBInstances :: Lens' DescribeDBInstancesResponse [DBInstance]
ddbirsDBInstances = lens _ddbirsDBInstances (\ s a -> s{_ddbirsDBInstances = a}) . _Default . _Coerce;
ddbirsMarker :: Lens' DescribeDBInstancesResponse (Maybe Text)
ddbirsMarker = lens _ddbirsMarker (\ s a -> s{_ddbirsMarker = a});
ddbirsStatus :: Lens' DescribeDBInstancesResponse Int
ddbirsStatus = lens _ddbirsStatus (\ s a -> s{_ddbirsStatus = a});