{-# 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.RegisterInstancesWithLoadBalancer
(
registerInstancesWithLoadBalancer
, RegisterInstancesWithLoadBalancer
, riwlbLoadBalancerName
, riwlbInstances
, registerInstancesWithLoadBalancerResponse
, RegisterInstancesWithLoadBalancerResponse
, riwlbrsInstances
, riwlbrsResponseStatus
) 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 RegisterInstancesWithLoadBalancer = RegisterInstancesWithLoadBalancer'
{ _riwlbLoadBalancerName :: !Text
, _riwlbInstances :: ![Instance]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
registerInstancesWithLoadBalancer
:: Text
-> RegisterInstancesWithLoadBalancer
registerInstancesWithLoadBalancer pLoadBalancerName_ =
RegisterInstancesWithLoadBalancer'
{ _riwlbLoadBalancerName = pLoadBalancerName_
, _riwlbInstances = mempty
}
riwlbLoadBalancerName :: Lens' RegisterInstancesWithLoadBalancer Text
riwlbLoadBalancerName = lens _riwlbLoadBalancerName (\ s a -> s{_riwlbLoadBalancerName = a});
riwlbInstances :: Lens' RegisterInstancesWithLoadBalancer [Instance]
riwlbInstances = lens _riwlbInstances (\ s a -> s{_riwlbInstances = a}) . _Coerce;
instance AWSRequest RegisterInstancesWithLoadBalancer
where
type Rs RegisterInstancesWithLoadBalancer =
RegisterInstancesWithLoadBalancerResponse
request = postQuery elb
response
= receiveXMLWrapper
"RegisterInstancesWithLoadBalancerResult"
(\ s h x ->
RegisterInstancesWithLoadBalancerResponse' <$>
(x .@? "Instances" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance Hashable RegisterInstancesWithLoadBalancer
instance NFData RegisterInstancesWithLoadBalancer
instance ToHeaders RegisterInstancesWithLoadBalancer
where
toHeaders = const mempty
instance ToPath RegisterInstancesWithLoadBalancer
where
toPath = const "/"
instance ToQuery RegisterInstancesWithLoadBalancer
where
toQuery RegisterInstancesWithLoadBalancer'{..}
= mconcat
["Action" =:
("RegisterInstancesWithLoadBalancer" :: ByteString),
"Version" =: ("2012-06-01" :: ByteString),
"LoadBalancerName" =: _riwlbLoadBalancerName,
"Instances" =: toQueryList "member" _riwlbInstances]
data RegisterInstancesWithLoadBalancerResponse = RegisterInstancesWithLoadBalancerResponse'
{ _riwlbrsInstances :: !(Maybe [Instance])
, _riwlbrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
registerInstancesWithLoadBalancerResponse
:: Int
-> RegisterInstancesWithLoadBalancerResponse
registerInstancesWithLoadBalancerResponse pResponseStatus_ =
RegisterInstancesWithLoadBalancerResponse'
{ _riwlbrsInstances = Nothing
, _riwlbrsResponseStatus = pResponseStatus_
}
riwlbrsInstances :: Lens' RegisterInstancesWithLoadBalancerResponse [Instance]
riwlbrsInstances = lens _riwlbrsInstances (\ s a -> s{_riwlbrsInstances = a}) . _Default . _Coerce;
riwlbrsResponseStatus :: Lens' RegisterInstancesWithLoadBalancerResponse Int
riwlbrsResponseStatus = lens _riwlbrsResponseStatus (\ s a -> s{_riwlbrsResponseStatus = a});
instance NFData
RegisterInstancesWithLoadBalancerResponse