module Network.AWS.Redshift.DescribeReservedNodes
(
describeReservedNodes
, DescribeReservedNodes
, drnReservedNodeId
, drnMaxRecords
, drnMarker
, describeReservedNodesResponse
, DescribeReservedNodesResponse
, drnrsReservedNodes
, drnrsMarker
, drnrsStatus
) where
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Redshift.Types
import Network.AWS.Redshift.Types.Product
import Network.AWS.Request
import Network.AWS.Response
data DescribeReservedNodes = DescribeReservedNodes'
{ _drnReservedNodeId :: !(Maybe Text)
, _drnMaxRecords :: !(Maybe Int)
, _drnMarker :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeReservedNodes
:: DescribeReservedNodes
describeReservedNodes =
DescribeReservedNodes'
{ _drnReservedNodeId = Nothing
, _drnMaxRecords = Nothing
, _drnMarker = Nothing
}
drnReservedNodeId :: Lens' DescribeReservedNodes (Maybe Text)
drnReservedNodeId = lens _drnReservedNodeId (\ s a -> s{_drnReservedNodeId = a});
drnMaxRecords :: Lens' DescribeReservedNodes (Maybe Int)
drnMaxRecords = lens _drnMaxRecords (\ s a -> s{_drnMaxRecords = a});
drnMarker :: Lens' DescribeReservedNodes (Maybe Text)
drnMarker = lens _drnMarker (\ s a -> s{_drnMarker = a});
instance AWSPager DescribeReservedNodes where
page rq rs
| stop (rs ^. drnrsMarker) = Nothing
| stop (rs ^. drnrsReservedNodes) = Nothing
| otherwise =
Just $ rq & drnMarker .~ rs ^. drnrsMarker
instance AWSRequest DescribeReservedNodes where
type Sv DescribeReservedNodes = Redshift
type Rs DescribeReservedNodes =
DescribeReservedNodesResponse
request = postQuery
response
= receiveXMLWrapper "DescribeReservedNodesResult"
(\ s h x ->
DescribeReservedNodesResponse' <$>
(x .@? "ReservedNodes" .!@ mempty >>=
may (parseXMLList "ReservedNode"))
<*> (x .@? "Marker")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeReservedNodes where
toHeaders = const mempty
instance ToPath DescribeReservedNodes where
toPath = const "/"
instance ToQuery DescribeReservedNodes where
toQuery DescribeReservedNodes'{..}
= mconcat
["Action" =: ("DescribeReservedNodes" :: ByteString),
"Version" =: ("2012-12-01" :: ByteString),
"ReservedNodeId" =: _drnReservedNodeId,
"MaxRecords" =: _drnMaxRecords,
"Marker" =: _drnMarker]
data DescribeReservedNodesResponse = DescribeReservedNodesResponse'
{ _drnrsReservedNodes :: !(Maybe [ReservedNode])
, _drnrsMarker :: !(Maybe Text)
, _drnrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeReservedNodesResponse
:: Int
-> DescribeReservedNodesResponse
describeReservedNodesResponse pStatus_ =
DescribeReservedNodesResponse'
{ _drnrsReservedNodes = Nothing
, _drnrsMarker = Nothing
, _drnrsStatus = pStatus_
}
drnrsReservedNodes :: Lens' DescribeReservedNodesResponse [ReservedNode]
drnrsReservedNodes = lens _drnrsReservedNodes (\ s a -> s{_drnrsReservedNodes = a}) . _Default . _Coerce;
drnrsMarker :: Lens' DescribeReservedNodesResponse (Maybe Text)
drnrsMarker = lens _drnrsMarker (\ s a -> s{_drnrsMarker = a});
drnrsStatus :: Lens' DescribeReservedNodesResponse Int
drnrsStatus = lens _drnrsStatus (\ s a -> s{_drnrsStatus = a});