module Network.AWS.AutoScaling.DescribeLaunchConfigurations
(
describeLaunchConfigurations
, DescribeLaunchConfigurations
, dlcLaunchConfigurationNames
, dlcNextToken
, dlcMaxRecords
, describeLaunchConfigurationsResponse
, DescribeLaunchConfigurationsResponse
, dlcrsNextToken
, dlcrsStatus
, dlcrsLaunchConfigurations
) where
import Network.AWS.AutoScaling.Types
import Network.AWS.AutoScaling.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeLaunchConfigurations = DescribeLaunchConfigurations'
{ _dlcLaunchConfigurationNames :: !(Maybe [Text])
, _dlcNextToken :: !(Maybe Text)
, _dlcMaxRecords :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeLaunchConfigurations
:: DescribeLaunchConfigurations
describeLaunchConfigurations =
DescribeLaunchConfigurations'
{ _dlcLaunchConfigurationNames = Nothing
, _dlcNextToken = Nothing
, _dlcMaxRecords = Nothing
}
dlcLaunchConfigurationNames :: Lens' DescribeLaunchConfigurations [Text]
dlcLaunchConfigurationNames = lens _dlcLaunchConfigurationNames (\ s a -> s{_dlcLaunchConfigurationNames = a}) . _Default . _Coerce;
dlcNextToken :: Lens' DescribeLaunchConfigurations (Maybe Text)
dlcNextToken = lens _dlcNextToken (\ s a -> s{_dlcNextToken = a});
dlcMaxRecords :: Lens' DescribeLaunchConfigurations (Maybe Int)
dlcMaxRecords = lens _dlcMaxRecords (\ s a -> s{_dlcMaxRecords = a});
instance AWSPager DescribeLaunchConfigurations where
page rq rs
| stop (rs ^. dlcrsNextToken) = Nothing
| stop (rs ^. dlcrsLaunchConfigurations) = Nothing
| otherwise =
Just $ rq & dlcNextToken .~ rs ^. dlcrsNextToken
instance AWSRequest DescribeLaunchConfigurations
where
type Rs DescribeLaunchConfigurations =
DescribeLaunchConfigurationsResponse
request = postQuery autoScaling
response
= receiveXMLWrapper
"DescribeLaunchConfigurationsResult"
(\ s h x ->
DescribeLaunchConfigurationsResponse' <$>
(x .@? "NextToken") <*> (pure (fromEnum s)) <*>
(x .@? "LaunchConfigurations" .!@ mempty >>=
parseXMLList "member"))
instance ToHeaders DescribeLaunchConfigurations where
toHeaders = const mempty
instance ToPath DescribeLaunchConfigurations where
toPath = const "/"
instance ToQuery DescribeLaunchConfigurations where
toQuery DescribeLaunchConfigurations'{..}
= mconcat
["Action" =:
("DescribeLaunchConfigurations" :: ByteString),
"Version" =: ("2011-01-01" :: ByteString),
"LaunchConfigurationNames" =:
toQuery
(toQueryList "member" <$>
_dlcLaunchConfigurationNames),
"NextToken" =: _dlcNextToken,
"MaxRecords" =: _dlcMaxRecords]
data DescribeLaunchConfigurationsResponse = DescribeLaunchConfigurationsResponse'
{ _dlcrsNextToken :: !(Maybe Text)
, _dlcrsStatus :: !Int
, _dlcrsLaunchConfigurations :: ![LaunchConfiguration]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeLaunchConfigurationsResponse
:: Int
-> DescribeLaunchConfigurationsResponse
describeLaunchConfigurationsResponse pStatus_ =
DescribeLaunchConfigurationsResponse'
{ _dlcrsNextToken = Nothing
, _dlcrsStatus = pStatus_
, _dlcrsLaunchConfigurations = mempty
}
dlcrsNextToken :: Lens' DescribeLaunchConfigurationsResponse (Maybe Text)
dlcrsNextToken = lens _dlcrsNextToken (\ s a -> s{_dlcrsNextToken = a});
dlcrsStatus :: Lens' DescribeLaunchConfigurationsResponse Int
dlcrsStatus = lens _dlcrsStatus (\ s a -> s{_dlcrsStatus = a});
dlcrsLaunchConfigurations :: Lens' DescribeLaunchConfigurationsResponse [LaunchConfiguration]
dlcrsLaunchConfigurations = lens _dlcrsLaunchConfigurations (\ s a -> s{_dlcrsLaunchConfigurations = a}) . _Coerce;