module Network.AWS.AutoScaling.DescribeLaunchConfigurations
(
DescribeLaunchConfigurations
, describeLaunchConfigurations
, dlcLaunchConfigurationNames
, dlcMaxRecords
, dlcNextToken
, DescribeLaunchConfigurationsResponse
, describeLaunchConfigurationsResponse
, dlcrLaunchConfigurations
, dlcrNextToken
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.AutoScaling.Types
import qualified GHC.Exts
data DescribeLaunchConfigurations = DescribeLaunchConfigurations
{ _dlcLaunchConfigurationNames :: List "member" Text
, _dlcMaxRecords :: Maybe Int
, _dlcNextToken :: Maybe Text
} deriving (Eq, Ord, Read, Show)
describeLaunchConfigurations :: DescribeLaunchConfigurations
describeLaunchConfigurations = DescribeLaunchConfigurations
{ _dlcLaunchConfigurationNames = mempty
, _dlcNextToken = Nothing
, _dlcMaxRecords = Nothing
}
dlcLaunchConfigurationNames :: Lens' DescribeLaunchConfigurations [Text]
dlcLaunchConfigurationNames =
lens _dlcLaunchConfigurationNames
(\s a -> s { _dlcLaunchConfigurationNames = a })
. _List
dlcMaxRecords :: Lens' DescribeLaunchConfigurations (Maybe Int)
dlcMaxRecords = lens _dlcMaxRecords (\s a -> s { _dlcMaxRecords = a })
dlcNextToken :: Lens' DescribeLaunchConfigurations (Maybe Text)
dlcNextToken = lens _dlcNextToken (\s a -> s { _dlcNextToken = a })
data DescribeLaunchConfigurationsResponse = DescribeLaunchConfigurationsResponse
{ _dlcrLaunchConfigurations :: List "member" LaunchConfiguration
, _dlcrNextToken :: Maybe Text
} deriving (Eq, Read, Show)
describeLaunchConfigurationsResponse :: DescribeLaunchConfigurationsResponse
describeLaunchConfigurationsResponse = DescribeLaunchConfigurationsResponse
{ _dlcrLaunchConfigurations = mempty
, _dlcrNextToken = Nothing
}
dlcrLaunchConfigurations :: Lens' DescribeLaunchConfigurationsResponse [LaunchConfiguration]
dlcrLaunchConfigurations =
lens _dlcrLaunchConfigurations
(\s a -> s { _dlcrLaunchConfigurations = a })
. _List
dlcrNextToken :: Lens' DescribeLaunchConfigurationsResponse (Maybe Text)
dlcrNextToken = lens _dlcrNextToken (\s a -> s { _dlcrNextToken = a })
instance ToPath DescribeLaunchConfigurations where
toPath = const "/"
instance ToQuery DescribeLaunchConfigurations where
toQuery DescribeLaunchConfigurations{..} = mconcat
[ "LaunchConfigurationNames" =? _dlcLaunchConfigurationNames
, "MaxRecords" =? _dlcMaxRecords
, "NextToken" =? _dlcNextToken
]
instance ToHeaders DescribeLaunchConfigurations
instance AWSRequest DescribeLaunchConfigurations where
type Sv DescribeLaunchConfigurations = AutoScaling
type Rs DescribeLaunchConfigurations = DescribeLaunchConfigurationsResponse
request = post "DescribeLaunchConfigurations"
response = xmlResponse
instance FromXML DescribeLaunchConfigurationsResponse where
parseXML = withElement "DescribeLaunchConfigurationsResult" $ \x -> DescribeLaunchConfigurationsResponse
<$> x .@? "LaunchConfigurations" .!@ mempty
<*> x .@? "NextToken"
instance AWSPager DescribeLaunchConfigurations where
page rq rs
| stop (rs ^. dlcrNextToken) = Nothing
| otherwise = (\x -> rq & dlcNextToken ?~ x)
<$> (rs ^. dlcrNextToken)