{-# 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.AutoScalingPlans.DescribeScalingPlans
(
describeScalingPlans
, DescribeScalingPlans
, dScalingPlanVersion
, dScalingPlanNames
, dNextToken
, dApplicationSources
, dMaxResults
, describeScalingPlansResponse
, DescribeScalingPlansResponse
, drsScalingPlans
, drsNextToken
, drsResponseStatus
) where
import Network.AWS.AutoScalingPlans.Types
import Network.AWS.AutoScalingPlans.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeScalingPlans = DescribeScalingPlans'
{ _dScalingPlanVersion :: !(Maybe Integer)
, _dScalingPlanNames :: !(Maybe [Text])
, _dNextToken :: !(Maybe Text)
, _dApplicationSources :: !(Maybe [ApplicationSource])
, _dMaxResults :: !(Maybe Int)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeScalingPlans
:: DescribeScalingPlans
describeScalingPlans =
DescribeScalingPlans'
{ _dScalingPlanVersion = Nothing
, _dScalingPlanNames = Nothing
, _dNextToken = Nothing
, _dApplicationSources = Nothing
, _dMaxResults = Nothing
}
dScalingPlanVersion :: Lens' DescribeScalingPlans (Maybe Integer)
dScalingPlanVersion = lens _dScalingPlanVersion (\ s a -> s{_dScalingPlanVersion = a})
dScalingPlanNames :: Lens' DescribeScalingPlans [Text]
dScalingPlanNames = lens _dScalingPlanNames (\ s a -> s{_dScalingPlanNames = a}) . _Default . _Coerce
dNextToken :: Lens' DescribeScalingPlans (Maybe Text)
dNextToken = lens _dNextToken (\ s a -> s{_dNextToken = a})
dApplicationSources :: Lens' DescribeScalingPlans [ApplicationSource]
dApplicationSources = lens _dApplicationSources (\ s a -> s{_dApplicationSources = a}) . _Default . _Coerce
dMaxResults :: Lens' DescribeScalingPlans (Maybe Int)
dMaxResults = lens _dMaxResults (\ s a -> s{_dMaxResults = a})
instance AWSRequest DescribeScalingPlans where
type Rs DescribeScalingPlans =
DescribeScalingPlansResponse
request = postJSON autoScalingPlans
response
= receiveJSON
(\ s h x ->
DescribeScalingPlansResponse' <$>
(x .?> "ScalingPlans" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable DescribeScalingPlans where
instance NFData DescribeScalingPlans where
instance ToHeaders DescribeScalingPlans where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AnyScaleScalingPlannerFrontendService.DescribeScalingPlans"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeScalingPlans where
toJSON DescribeScalingPlans'{..}
= object
(catMaybes
[("ScalingPlanVersion" .=) <$> _dScalingPlanVersion,
("ScalingPlanNames" .=) <$> _dScalingPlanNames,
("NextToken" .=) <$> _dNextToken,
("ApplicationSources" .=) <$> _dApplicationSources,
("MaxResults" .=) <$> _dMaxResults])
instance ToPath DescribeScalingPlans where
toPath = const "/"
instance ToQuery DescribeScalingPlans where
toQuery = const mempty
data DescribeScalingPlansResponse = DescribeScalingPlansResponse'
{ _drsScalingPlans :: !(Maybe [ScalingPlan])
, _drsNextToken :: !(Maybe Text)
, _drsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeScalingPlansResponse
:: Int
-> DescribeScalingPlansResponse
describeScalingPlansResponse pResponseStatus_ =
DescribeScalingPlansResponse'
{ _drsScalingPlans = Nothing
, _drsNextToken = Nothing
, _drsResponseStatus = pResponseStatus_
}
drsScalingPlans :: Lens' DescribeScalingPlansResponse [ScalingPlan]
drsScalingPlans = lens _drsScalingPlans (\ s a -> s{_drsScalingPlans = a}) . _Default . _Coerce
drsNextToken :: Lens' DescribeScalingPlansResponse (Maybe Text)
drsNextToken = lens _drsNextToken (\ s a -> s{_drsNextToken = a})
drsResponseStatus :: Lens' DescribeScalingPlansResponse Int
drsResponseStatus = lens _drsResponseStatus (\ s a -> s{_drsResponseStatus = a})
instance NFData DescribeScalingPlansResponse where