{-# 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.RDS.DescribeDBSecurityGroups
(
describeDBSecurityGroups
, DescribeDBSecurityGroups
, ddbsgFilters
, ddbsgMarker
, ddbsgMaxRecords
, ddbsgDBSecurityGroupName
, describeDBSecurityGroupsResponse
, DescribeDBSecurityGroupsResponse
, ddbsgrsDBSecurityGroups
, ddbsgrsMarker
, ddbsgrsResponseStatus
) where
import Network.AWS.Lens
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 DescribeDBSecurityGroups = DescribeDBSecurityGroups'
{ _ddbsgFilters :: !(Maybe [Filter])
, _ddbsgMarker :: !(Maybe Text)
, _ddbsgMaxRecords :: !(Maybe Int)
, _ddbsgDBSecurityGroupName :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeDBSecurityGroups
:: DescribeDBSecurityGroups
describeDBSecurityGroups =
DescribeDBSecurityGroups'
{ _ddbsgFilters = Nothing
, _ddbsgMarker = Nothing
, _ddbsgMaxRecords = Nothing
, _ddbsgDBSecurityGroupName = Nothing
}
ddbsgFilters :: Lens' DescribeDBSecurityGroups [Filter]
ddbsgFilters = lens _ddbsgFilters (\ s a -> s{_ddbsgFilters = a}) . _Default . _Coerce
ddbsgMarker :: Lens' DescribeDBSecurityGroups (Maybe Text)
ddbsgMarker = lens _ddbsgMarker (\ s a -> s{_ddbsgMarker = a})
ddbsgMaxRecords :: Lens' DescribeDBSecurityGroups (Maybe Int)
ddbsgMaxRecords = lens _ddbsgMaxRecords (\ s a -> s{_ddbsgMaxRecords = a})
ddbsgDBSecurityGroupName :: Lens' DescribeDBSecurityGroups (Maybe Text)
ddbsgDBSecurityGroupName = lens _ddbsgDBSecurityGroupName (\ s a -> s{_ddbsgDBSecurityGroupName = a})
instance AWSPager DescribeDBSecurityGroups where
page rq rs
| stop (rs ^. ddbsgrsMarker) = Nothing
| stop (rs ^. ddbsgrsDBSecurityGroups) = Nothing
| otherwise =
Just $ rq & ddbsgMarker .~ rs ^. ddbsgrsMarker
instance AWSRequest DescribeDBSecurityGroups where
type Rs DescribeDBSecurityGroups =
DescribeDBSecurityGroupsResponse
request = postQuery rds
response
= receiveXMLWrapper "DescribeDBSecurityGroupsResult"
(\ s h x ->
DescribeDBSecurityGroupsResponse' <$>
(x .@? "DBSecurityGroups" .!@ mempty >>=
may (parseXMLList "DBSecurityGroup"))
<*> (x .@? "Marker")
<*> (pure (fromEnum s)))
instance Hashable DescribeDBSecurityGroups where
instance NFData DescribeDBSecurityGroups where
instance ToHeaders DescribeDBSecurityGroups where
toHeaders = const mempty
instance ToPath DescribeDBSecurityGroups where
toPath = const "/"
instance ToQuery DescribeDBSecurityGroups where
toQuery DescribeDBSecurityGroups'{..}
= mconcat
["Action" =:
("DescribeDBSecurityGroups" :: ByteString),
"Version" =: ("2014-10-31" :: ByteString),
"Filters" =:
toQuery (toQueryList "Filter" <$> _ddbsgFilters),
"Marker" =: _ddbsgMarker,
"MaxRecords" =: _ddbsgMaxRecords,
"DBSecurityGroupName" =: _ddbsgDBSecurityGroupName]
data DescribeDBSecurityGroupsResponse = DescribeDBSecurityGroupsResponse'
{ _ddbsgrsDBSecurityGroups :: !(Maybe [DBSecurityGroup])
, _ddbsgrsMarker :: !(Maybe Text)
, _ddbsgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeDBSecurityGroupsResponse
:: Int
-> DescribeDBSecurityGroupsResponse
describeDBSecurityGroupsResponse pResponseStatus_ =
DescribeDBSecurityGroupsResponse'
{ _ddbsgrsDBSecurityGroups = Nothing
, _ddbsgrsMarker = Nothing
, _ddbsgrsResponseStatus = pResponseStatus_
}
ddbsgrsDBSecurityGroups :: Lens' DescribeDBSecurityGroupsResponse [DBSecurityGroup]
ddbsgrsDBSecurityGroups = lens _ddbsgrsDBSecurityGroups (\ s a -> s{_ddbsgrsDBSecurityGroups = a}) . _Default . _Coerce
ddbsgrsMarker :: Lens' DescribeDBSecurityGroupsResponse (Maybe Text)
ddbsgrsMarker = lens _ddbsgrsMarker (\ s a -> s{_ddbsgrsMarker = a})
ddbsgrsResponseStatus :: Lens' DescribeDBSecurityGroupsResponse Int
ddbsgrsResponseStatus = lens _ddbsgrsResponseStatus (\ s a -> s{_ddbsgrsResponseStatus = a})
instance NFData DescribeDBSecurityGroupsResponse
where