{-# 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.ELB.DescribeInstanceHealth
(
describeInstanceHealth
, DescribeInstanceHealth
, dihInstances
, dihLoadBalancerName
, describeInstanceHealthResponse
, DescribeInstanceHealthResponse
, dihrsInstanceStates
, dihrsResponseStatus
) where
import Network.AWS.ELB.Types
import Network.AWS.ELB.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeInstanceHealth = DescribeInstanceHealth'
{ _dihInstances :: !(Maybe [Instance])
, _dihLoadBalancerName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeInstanceHealth
:: Text
-> DescribeInstanceHealth
describeInstanceHealth pLoadBalancerName_ =
DescribeInstanceHealth'
{ _dihInstances = Nothing
, _dihLoadBalancerName = pLoadBalancerName_
}
dihInstances :: Lens' DescribeInstanceHealth [Instance]
dihInstances = lens _dihInstances (\ s a -> s{_dihInstances = a}) . _Default . _Coerce;
dihLoadBalancerName :: Lens' DescribeInstanceHealth Text
dihLoadBalancerName = lens _dihLoadBalancerName (\ s a -> s{_dihLoadBalancerName = a});
instance AWSRequest DescribeInstanceHealth where
type Rs DescribeInstanceHealth =
DescribeInstanceHealthResponse
request = postQuery elb
response
= receiveXMLWrapper "DescribeInstanceHealthResult"
(\ s h x ->
DescribeInstanceHealthResponse' <$>
(x .@? "InstanceStates" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance Hashable DescribeInstanceHealth
instance NFData DescribeInstanceHealth
instance ToHeaders DescribeInstanceHealth where
toHeaders = const mempty
instance ToPath DescribeInstanceHealth where
toPath = const "/"
instance ToQuery DescribeInstanceHealth where
toQuery DescribeInstanceHealth'{..}
= mconcat
["Action" =:
("DescribeInstanceHealth" :: ByteString),
"Version" =: ("2012-06-01" :: ByteString),
"Instances" =:
toQuery (toQueryList "member" <$> _dihInstances),
"LoadBalancerName" =: _dihLoadBalancerName]
data DescribeInstanceHealthResponse = DescribeInstanceHealthResponse'
{ _dihrsInstanceStates :: !(Maybe [InstanceState])
, _dihrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeInstanceHealthResponse
:: Int
-> DescribeInstanceHealthResponse
describeInstanceHealthResponse pResponseStatus_ =
DescribeInstanceHealthResponse'
{ _dihrsInstanceStates = Nothing
, _dihrsResponseStatus = pResponseStatus_
}
dihrsInstanceStates :: Lens' DescribeInstanceHealthResponse [InstanceState]
dihrsInstanceStates = lens _dihrsInstanceStates (\ s a -> s{_dihrsInstanceStates = a}) . _Default . _Coerce;
dihrsResponseStatus :: Lens' DescribeInstanceHealthResponse Int
dihrsResponseStatus = lens _dihrsResponseStatus (\ s a -> s{_dihrsResponseStatus = a});
instance NFData DescribeInstanceHealthResponse