module Network.AWS.ELB.DescribeLoadBalancers
(
describeLoadBalancers
, DescribeLoadBalancers
, dlbMarker
, dlbPageSize
, dlbLoadBalancerNames
, describeLoadBalancersResponse
, DescribeLoadBalancersResponse
, dlbrsLoadBalancerDescriptions
, dlbrsNextMarker
, dlbrsResponseStatus
) where
import Network.AWS.ELB.Types
import Network.AWS.ELB.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeLoadBalancers = DescribeLoadBalancers'
{ _dlbMarker :: !(Maybe Text)
, _dlbPageSize :: !(Maybe Nat)
, _dlbLoadBalancerNames :: !(Maybe [Text])
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeLoadBalancers
:: DescribeLoadBalancers
describeLoadBalancers =
DescribeLoadBalancers'
{ _dlbMarker = Nothing
, _dlbPageSize = Nothing
, _dlbLoadBalancerNames = Nothing
}
dlbMarker :: Lens' DescribeLoadBalancers (Maybe Text)
dlbMarker = lens _dlbMarker (\ s a -> s{_dlbMarker = a});
dlbPageSize :: Lens' DescribeLoadBalancers (Maybe Natural)
dlbPageSize = lens _dlbPageSize (\ s a -> s{_dlbPageSize = a}) . mapping _Nat;
dlbLoadBalancerNames :: Lens' DescribeLoadBalancers [Text]
dlbLoadBalancerNames = lens _dlbLoadBalancerNames (\ s a -> s{_dlbLoadBalancerNames = a}) . _Default . _Coerce;
instance AWSPager DescribeLoadBalancers where
page rq rs
| stop (rs ^. dlbrsNextMarker) = Nothing
| stop (rs ^. dlbrsLoadBalancerDescriptions) =
Nothing
| otherwise =
Just $ rq & dlbMarker .~ rs ^. dlbrsNextMarker
instance AWSRequest DescribeLoadBalancers where
type Rs DescribeLoadBalancers =
DescribeLoadBalancersResponse
request = postQuery eLB
response
= receiveXMLWrapper "DescribeLoadBalancersResult"
(\ s h x ->
DescribeLoadBalancersResponse' <$>
(x .@? "LoadBalancerDescriptions" .!@ mempty >>=
may (parseXMLList "member"))
<*> (x .@? "NextMarker")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeLoadBalancers where
toHeaders = const mempty
instance ToPath DescribeLoadBalancers where
toPath = const "/"
instance ToQuery DescribeLoadBalancers where
toQuery DescribeLoadBalancers'{..}
= mconcat
["Action" =: ("DescribeLoadBalancers" :: ByteString),
"Version" =: ("2012-06-01" :: ByteString),
"Marker" =: _dlbMarker, "PageSize" =: _dlbPageSize,
"LoadBalancerNames" =:
toQuery
(toQueryList "member" <$> _dlbLoadBalancerNames)]
data DescribeLoadBalancersResponse = DescribeLoadBalancersResponse'
{ _dlbrsLoadBalancerDescriptions :: !(Maybe [LoadBalancerDescription])
, _dlbrsNextMarker :: !(Maybe Text)
, _dlbrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeLoadBalancersResponse
:: Int
-> DescribeLoadBalancersResponse
describeLoadBalancersResponse pResponseStatus_ =
DescribeLoadBalancersResponse'
{ _dlbrsLoadBalancerDescriptions = Nothing
, _dlbrsNextMarker = Nothing
, _dlbrsResponseStatus = pResponseStatus_
}
dlbrsLoadBalancerDescriptions :: Lens' DescribeLoadBalancersResponse [LoadBalancerDescription]
dlbrsLoadBalancerDescriptions = lens _dlbrsLoadBalancerDescriptions (\ s a -> s{_dlbrsLoadBalancerDescriptions = a}) . _Default . _Coerce;
dlbrsNextMarker :: Lens' DescribeLoadBalancersResponse (Maybe Text)
dlbrsNextMarker = lens _dlbrsNextMarker (\ s a -> s{_dlbrsNextMarker = a});
dlbrsResponseStatus :: Lens' DescribeLoadBalancersResponse Int
dlbrsResponseStatus = lens _dlbrsResponseStatus (\ s a -> s{_dlbrsResponseStatus = a});