module Network.AWS.ELB.DescribeLoadBalancers
(
DescribeLoadBalancers
, describeLoadBalancers
, dlbLoadBalancerNames
, dlbMarker
, dlbPageSize
, DescribeLoadBalancersResponse
, describeLoadBalancersResponse
, dlbrLoadBalancerDescriptions
, dlbrNextMarker
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.ELB.Types
import qualified GHC.Exts
data DescribeLoadBalancers = DescribeLoadBalancers
{ _dlbLoadBalancerNames :: List "member" Text
, _dlbMarker :: Maybe Text
, _dlbPageSize :: Maybe Nat
} deriving (Eq, Ord, Read, Show)
describeLoadBalancers :: DescribeLoadBalancers
describeLoadBalancers = DescribeLoadBalancers
{ _dlbLoadBalancerNames = mempty
, _dlbMarker = Nothing
, _dlbPageSize = Nothing
}
dlbLoadBalancerNames :: Lens' DescribeLoadBalancers [Text]
dlbLoadBalancerNames =
lens _dlbLoadBalancerNames (\s a -> s { _dlbLoadBalancerNames = a })
. _List
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
data DescribeLoadBalancersResponse = DescribeLoadBalancersResponse
{ _dlbrLoadBalancerDescriptions :: List "member" LoadBalancerDescription
, _dlbrNextMarker :: Maybe Text
} deriving (Eq, Read, Show)
describeLoadBalancersResponse :: DescribeLoadBalancersResponse
describeLoadBalancersResponse = DescribeLoadBalancersResponse
{ _dlbrLoadBalancerDescriptions = mempty
, _dlbrNextMarker = Nothing
}
dlbrLoadBalancerDescriptions :: Lens' DescribeLoadBalancersResponse [LoadBalancerDescription]
dlbrLoadBalancerDescriptions =
lens _dlbrLoadBalancerDescriptions
(\s a -> s { _dlbrLoadBalancerDescriptions = a })
. _List
dlbrNextMarker :: Lens' DescribeLoadBalancersResponse (Maybe Text)
dlbrNextMarker = lens _dlbrNextMarker (\s a -> s { _dlbrNextMarker = a })
instance ToPath DescribeLoadBalancers where
toPath = const "/"
instance ToQuery DescribeLoadBalancers where
toQuery DescribeLoadBalancers{..} = mconcat
[ "LoadBalancerNames" =? _dlbLoadBalancerNames
, "Marker" =? _dlbMarker
, "PageSize" =? _dlbPageSize
]
instance ToHeaders DescribeLoadBalancers
instance AWSRequest DescribeLoadBalancers where
type Sv DescribeLoadBalancers = ELB
type Rs DescribeLoadBalancers = DescribeLoadBalancersResponse
request = post "DescribeLoadBalancers"
response = xmlResponse
instance FromXML DescribeLoadBalancersResponse where
parseXML = withElement "DescribeLoadBalancersResult" $ \x -> DescribeLoadBalancersResponse
<$> x .@? "LoadBalancerDescriptions" .!@ mempty
<*> x .@? "NextMarker"
instance AWSPager DescribeLoadBalancers where
page rq rs
| stop (rs ^. dlbrNextMarker) = Nothing
| otherwise = (\x -> rq & dlbMarker ?~ x)
<$> (rs ^. dlbrNextMarker)