{-# 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.ELBv2.SetSubnets
(
setSubnets
, SetSubnets
, ssSubnetMappings
, ssLoadBalancerARN
, ssSubnets
, setSubnetsResponse
, SetSubnetsResponse
, ssrsAvailabilityZones
, ssrsResponseStatus
) where
import Network.AWS.ELBv2.Types
import Network.AWS.ELBv2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data SetSubnets = SetSubnets'
{ _ssSubnetMappings :: !(Maybe [SubnetMapping])
, _ssLoadBalancerARN :: !Text
, _ssSubnets :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
setSubnets
:: Text
-> SetSubnets
setSubnets pLoadBalancerARN_ =
SetSubnets'
{ _ssSubnetMappings = Nothing
, _ssLoadBalancerARN = pLoadBalancerARN_
, _ssSubnets = mempty
}
ssSubnetMappings :: Lens' SetSubnets [SubnetMapping]
ssSubnetMappings = lens _ssSubnetMappings (\ s a -> s{_ssSubnetMappings = a}) . _Default . _Coerce
ssLoadBalancerARN :: Lens' SetSubnets Text
ssLoadBalancerARN = lens _ssLoadBalancerARN (\ s a -> s{_ssLoadBalancerARN = a})
ssSubnets :: Lens' SetSubnets [Text]
ssSubnets = lens _ssSubnets (\ s a -> s{_ssSubnets = a}) . _Coerce
instance AWSRequest SetSubnets where
type Rs SetSubnets = SetSubnetsResponse
request = postQuery eLBv2
response
= receiveXMLWrapper "SetSubnetsResult"
(\ s h x ->
SetSubnetsResponse' <$>
(x .@? "AvailabilityZones" .!@ mempty >>=
may (parseXMLList "member"))
<*> (pure (fromEnum s)))
instance Hashable SetSubnets where
instance NFData SetSubnets where
instance ToHeaders SetSubnets where
toHeaders = const mempty
instance ToPath SetSubnets where
toPath = const "/"
instance ToQuery SetSubnets where
toQuery SetSubnets'{..}
= mconcat
["Action" =: ("SetSubnets" :: ByteString),
"Version" =: ("2015-12-01" :: ByteString),
"SubnetMappings" =:
toQuery (toQueryList "member" <$> _ssSubnetMappings),
"LoadBalancerArn" =: _ssLoadBalancerARN,
"Subnets" =: toQueryList "member" _ssSubnets]
data SetSubnetsResponse = SetSubnetsResponse'
{ _ssrsAvailabilityZones :: !(Maybe [AvailabilityZone])
, _ssrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
setSubnetsResponse
:: Int
-> SetSubnetsResponse
setSubnetsResponse pResponseStatus_ =
SetSubnetsResponse'
{_ssrsAvailabilityZones = Nothing, _ssrsResponseStatus = pResponseStatus_}
ssrsAvailabilityZones :: Lens' SetSubnetsResponse [AvailabilityZone]
ssrsAvailabilityZones = lens _ssrsAvailabilityZones (\ s a -> s{_ssrsAvailabilityZones = a}) . _Default . _Coerce
ssrsResponseStatus :: Lens' SetSubnetsResponse Int
ssrsResponseStatus = lens _ssrsResponseStatus (\ s a -> s{_ssrsResponseStatus = a})
instance NFData SetSubnetsResponse where