module Network.AWS.RDS.DescribeDBSnapshots
(
describeDBSnapshots
, DescribeDBSnapshots
, ddsFilters
, ddsDBSnapshotIdentifier
, ddsSnapshotType
, ddsDBInstanceIdentifier
, ddsMaxRecords
, ddsMarker
, describeDBSnapshotsResponse
, DescribeDBSnapshotsResponse
, ddsrsMarker
, ddsrsDBSnapshots
, ddsrsStatus
) 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 DescribeDBSnapshots = DescribeDBSnapshots'
{ _ddsFilters :: !(Maybe [Filter])
, _ddsDBSnapshotIdentifier :: !(Maybe Text)
, _ddsSnapshotType :: !(Maybe Text)
, _ddsDBInstanceIdentifier :: !(Maybe Text)
, _ddsMaxRecords :: !(Maybe Int)
, _ddsMarker :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDBSnapshots
:: DescribeDBSnapshots
describeDBSnapshots =
DescribeDBSnapshots'
{ _ddsFilters = Nothing
, _ddsDBSnapshotIdentifier = Nothing
, _ddsSnapshotType = Nothing
, _ddsDBInstanceIdentifier = Nothing
, _ddsMaxRecords = Nothing
, _ddsMarker = Nothing
}
ddsFilters :: Lens' DescribeDBSnapshots [Filter]
ddsFilters = lens _ddsFilters (\ s a -> s{_ddsFilters = a}) . _Default . _Coerce;
ddsDBSnapshotIdentifier :: Lens' DescribeDBSnapshots (Maybe Text)
ddsDBSnapshotIdentifier = lens _ddsDBSnapshotIdentifier (\ s a -> s{_ddsDBSnapshotIdentifier = a});
ddsSnapshotType :: Lens' DescribeDBSnapshots (Maybe Text)
ddsSnapshotType = lens _ddsSnapshotType (\ s a -> s{_ddsSnapshotType = a});
ddsDBInstanceIdentifier :: Lens' DescribeDBSnapshots (Maybe Text)
ddsDBInstanceIdentifier = lens _ddsDBInstanceIdentifier (\ s a -> s{_ddsDBInstanceIdentifier = a});
ddsMaxRecords :: Lens' DescribeDBSnapshots (Maybe Int)
ddsMaxRecords = lens _ddsMaxRecords (\ s a -> s{_ddsMaxRecords = a});
ddsMarker :: Lens' DescribeDBSnapshots (Maybe Text)
ddsMarker = lens _ddsMarker (\ s a -> s{_ddsMarker = a});
instance AWSPager DescribeDBSnapshots where
page rq rs
| stop (rs ^. ddsrsMarker) = Nothing
| stop (rs ^. ddsrsDBSnapshots) = Nothing
| otherwise =
Just $ rq & ddsMarker .~ rs ^. ddsrsMarker
instance AWSRequest DescribeDBSnapshots where
type Sv DescribeDBSnapshots = RDS
type Rs DescribeDBSnapshots =
DescribeDBSnapshotsResponse
request = postQuery
response
= receiveXMLWrapper "DescribeDBSnapshotsResult"
(\ s h x ->
DescribeDBSnapshotsResponse' <$>
(x .@? "Marker") <*>
(x .@? "DBSnapshots" .!@ mempty >>=
may (parseXMLList "DBSnapshot"))
<*> (pure (fromEnum s)))
instance ToHeaders DescribeDBSnapshots where
toHeaders = const mempty
instance ToPath DescribeDBSnapshots where
toPath = const "/"
instance ToQuery DescribeDBSnapshots where
toQuery DescribeDBSnapshots'{..}
= mconcat
["Action" =: ("DescribeDBSnapshots" :: ByteString),
"Version" =: ("2014-10-31" :: ByteString),
"Filters" =:
toQuery (toQueryList "Filter" <$> _ddsFilters),
"DBSnapshotIdentifier" =: _ddsDBSnapshotIdentifier,
"SnapshotType" =: _ddsSnapshotType,
"DBInstanceIdentifier" =: _ddsDBInstanceIdentifier,
"MaxRecords" =: _ddsMaxRecords,
"Marker" =: _ddsMarker]
data DescribeDBSnapshotsResponse = DescribeDBSnapshotsResponse'
{ _ddsrsMarker :: !(Maybe Text)
, _ddsrsDBSnapshots :: !(Maybe [DBSnapshot])
, _ddsrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeDBSnapshotsResponse
:: Int
-> DescribeDBSnapshotsResponse
describeDBSnapshotsResponse pStatus_ =
DescribeDBSnapshotsResponse'
{ _ddsrsMarker = Nothing
, _ddsrsDBSnapshots = Nothing
, _ddsrsStatus = pStatus_
}
ddsrsMarker :: Lens' DescribeDBSnapshotsResponse (Maybe Text)
ddsrsMarker = lens _ddsrsMarker (\ s a -> s{_ddsrsMarker = a});
ddsrsDBSnapshots :: Lens' DescribeDBSnapshotsResponse [DBSnapshot]
ddsrsDBSnapshots = lens _ddsrsDBSnapshots (\ s a -> s{_ddsrsDBSnapshots = a}) . _Default . _Coerce;
ddsrsStatus :: Lens' DescribeDBSnapshotsResponse Int
ddsrsStatus = lens _ddsrsStatus (\ s a -> s{_ddsrsStatus = a});