{-# 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.ElastiCache.DescribeReservedCacheNodes
(
describeReservedCacheNodes
, DescribeReservedCacheNodes
, drcnCacheNodeType
, drcnProductDescription
, drcnMarker
, drcnMaxRecords
, drcnReservedCacheNodeId
, drcnOfferingType
, drcnDuration
, drcnReservedCacheNodesOfferingId
, describeReservedCacheNodesResponse
, DescribeReservedCacheNodesResponse
, drcnrsMarker
, drcnrsReservedCacheNodes
, drcnrsResponseStatus
) where
import Network.AWS.ElastiCache.Types
import Network.AWS.ElastiCache.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeReservedCacheNodes = DescribeReservedCacheNodes'
{ _drcnCacheNodeType :: !(Maybe Text)
, _drcnProductDescription :: !(Maybe Text)
, _drcnMarker :: !(Maybe Text)
, _drcnMaxRecords :: !(Maybe Int)
, _drcnReservedCacheNodeId :: !(Maybe Text)
, _drcnOfferingType :: !(Maybe Text)
, _drcnDuration :: !(Maybe Text)
, _drcnReservedCacheNodesOfferingId :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeReservedCacheNodes
:: DescribeReservedCacheNodes
describeReservedCacheNodes =
DescribeReservedCacheNodes'
{ _drcnCacheNodeType = Nothing
, _drcnProductDescription = Nothing
, _drcnMarker = Nothing
, _drcnMaxRecords = Nothing
, _drcnReservedCacheNodeId = Nothing
, _drcnOfferingType = Nothing
, _drcnDuration = Nothing
, _drcnReservedCacheNodesOfferingId = Nothing
}
drcnCacheNodeType :: Lens' DescribeReservedCacheNodes (Maybe Text)
drcnCacheNodeType = lens _drcnCacheNodeType (\ s a -> s{_drcnCacheNodeType = a});
drcnProductDescription :: Lens' DescribeReservedCacheNodes (Maybe Text)
drcnProductDescription = lens _drcnProductDescription (\ s a -> s{_drcnProductDescription = a});
drcnMarker :: Lens' DescribeReservedCacheNodes (Maybe Text)
drcnMarker = lens _drcnMarker (\ s a -> s{_drcnMarker = a});
drcnMaxRecords :: Lens' DescribeReservedCacheNodes (Maybe Int)
drcnMaxRecords = lens _drcnMaxRecords (\ s a -> s{_drcnMaxRecords = a});
drcnReservedCacheNodeId :: Lens' DescribeReservedCacheNodes (Maybe Text)
drcnReservedCacheNodeId = lens _drcnReservedCacheNodeId (\ s a -> s{_drcnReservedCacheNodeId = a});
drcnOfferingType :: Lens' DescribeReservedCacheNodes (Maybe Text)
drcnOfferingType = lens _drcnOfferingType (\ s a -> s{_drcnOfferingType = a});
drcnDuration :: Lens' DescribeReservedCacheNodes (Maybe Text)
drcnDuration = lens _drcnDuration (\ s a -> s{_drcnDuration = a});
drcnReservedCacheNodesOfferingId :: Lens' DescribeReservedCacheNodes (Maybe Text)
drcnReservedCacheNodesOfferingId = lens _drcnReservedCacheNodesOfferingId (\ s a -> s{_drcnReservedCacheNodesOfferingId = a});
instance AWSPager DescribeReservedCacheNodes where
page rq rs
| stop (rs ^. drcnrsMarker) = Nothing
| stop (rs ^. drcnrsReservedCacheNodes) = Nothing
| otherwise =
Just $ rq & drcnMarker .~ rs ^. drcnrsMarker
instance AWSRequest DescribeReservedCacheNodes where
type Rs DescribeReservedCacheNodes =
DescribeReservedCacheNodesResponse
request = postQuery elastiCache
response
= receiveXMLWrapper
"DescribeReservedCacheNodesResult"
(\ s h x ->
DescribeReservedCacheNodesResponse' <$>
(x .@? "Marker") <*>
(x .@? "ReservedCacheNodes" .!@ mempty >>=
may (parseXMLList "ReservedCacheNode"))
<*> (pure (fromEnum s)))
instance Hashable DescribeReservedCacheNodes
instance NFData DescribeReservedCacheNodes
instance ToHeaders DescribeReservedCacheNodes where
toHeaders = const mempty
instance ToPath DescribeReservedCacheNodes where
toPath = const "/"
instance ToQuery DescribeReservedCacheNodes where
toQuery DescribeReservedCacheNodes'{..}
= mconcat
["Action" =:
("DescribeReservedCacheNodes" :: ByteString),
"Version" =: ("2015-02-02" :: ByteString),
"CacheNodeType" =: _drcnCacheNodeType,
"ProductDescription" =: _drcnProductDescription,
"Marker" =: _drcnMarker,
"MaxRecords" =: _drcnMaxRecords,
"ReservedCacheNodeId" =: _drcnReservedCacheNodeId,
"OfferingType" =: _drcnOfferingType,
"Duration" =: _drcnDuration,
"ReservedCacheNodesOfferingId" =:
_drcnReservedCacheNodesOfferingId]
data DescribeReservedCacheNodesResponse = DescribeReservedCacheNodesResponse'
{ _drcnrsMarker :: !(Maybe Text)
, _drcnrsReservedCacheNodes :: !(Maybe [ReservedCacheNode])
, _drcnrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeReservedCacheNodesResponse
:: Int
-> DescribeReservedCacheNodesResponse
describeReservedCacheNodesResponse pResponseStatus_ =
DescribeReservedCacheNodesResponse'
{ _drcnrsMarker = Nothing
, _drcnrsReservedCacheNodes = Nothing
, _drcnrsResponseStatus = pResponseStatus_
}
drcnrsMarker :: Lens' DescribeReservedCacheNodesResponse (Maybe Text)
drcnrsMarker = lens _drcnrsMarker (\ s a -> s{_drcnrsMarker = a});
drcnrsReservedCacheNodes :: Lens' DescribeReservedCacheNodesResponse [ReservedCacheNode]
drcnrsReservedCacheNodes = lens _drcnrsReservedCacheNodes (\ s a -> s{_drcnrsReservedCacheNodes = a}) . _Default . _Coerce;
drcnrsResponseStatus :: Lens' DescribeReservedCacheNodesResponse Int
drcnrsResponseStatus = lens _drcnrsResponseStatus (\ s a -> s{_drcnrsResponseStatus = a});
instance NFData DescribeReservedCacheNodesResponse