{-# 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.DescribeScalingPlanResources
(
describeScalingPlanResources
, DescribeScalingPlanResources
, dsprNextToken
, dsprMaxResults
, dsprScalingPlanName
, dsprScalingPlanVersion
, describeScalingPlanResourcesResponse
, DescribeScalingPlanResourcesResponse
, dsprrsNextToken
, dsprrsScalingPlanResources
, dsprrsResponseStatus
) 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 DescribeScalingPlanResources = DescribeScalingPlanResources'
{ _dsprNextToken :: !(Maybe Text)
, _dsprMaxResults :: !(Maybe Int)
, _dsprScalingPlanName :: !Text
, _dsprScalingPlanVersion :: !Integer
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeScalingPlanResources
:: Text
-> Integer
-> DescribeScalingPlanResources
describeScalingPlanResources pScalingPlanName_ pScalingPlanVersion_ =
DescribeScalingPlanResources'
{ _dsprNextToken = Nothing
, _dsprMaxResults = Nothing
, _dsprScalingPlanName = pScalingPlanName_
, _dsprScalingPlanVersion = pScalingPlanVersion_
}
dsprNextToken :: Lens' DescribeScalingPlanResources (Maybe Text)
dsprNextToken = lens _dsprNextToken (\ s a -> s{_dsprNextToken = a})
dsprMaxResults :: Lens' DescribeScalingPlanResources (Maybe Int)
dsprMaxResults = lens _dsprMaxResults (\ s a -> s{_dsprMaxResults = a})
dsprScalingPlanName :: Lens' DescribeScalingPlanResources Text
dsprScalingPlanName = lens _dsprScalingPlanName (\ s a -> s{_dsprScalingPlanName = a})
dsprScalingPlanVersion :: Lens' DescribeScalingPlanResources Integer
dsprScalingPlanVersion = lens _dsprScalingPlanVersion (\ s a -> s{_dsprScalingPlanVersion = a})
instance AWSRequest DescribeScalingPlanResources
where
type Rs DescribeScalingPlanResources =
DescribeScalingPlanResourcesResponse
request = postJSON autoScalingPlans
response
= receiveJSON
(\ s h x ->
DescribeScalingPlanResourcesResponse' <$>
(x .?> "NextToken") <*>
(x .?> "ScalingPlanResources" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeScalingPlanResources where
instance NFData DescribeScalingPlanResources where
instance ToHeaders DescribeScalingPlanResources where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AnyScaleScalingPlannerFrontendService.DescribeScalingPlanResources"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeScalingPlanResources where
toJSON DescribeScalingPlanResources'{..}
= object
(catMaybes
[("NextToken" .=) <$> _dsprNextToken,
("MaxResults" .=) <$> _dsprMaxResults,
Just ("ScalingPlanName" .= _dsprScalingPlanName),
Just
("ScalingPlanVersion" .= _dsprScalingPlanVersion)])
instance ToPath DescribeScalingPlanResources where
toPath = const "/"
instance ToQuery DescribeScalingPlanResources where
toQuery = const mempty
data DescribeScalingPlanResourcesResponse = DescribeScalingPlanResourcesResponse'
{ _dsprrsNextToken :: !(Maybe Text)
, _dsprrsScalingPlanResources :: !(Maybe [ScalingPlanResource])
, _dsprrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeScalingPlanResourcesResponse
:: Int
-> DescribeScalingPlanResourcesResponse
describeScalingPlanResourcesResponse pResponseStatus_ =
DescribeScalingPlanResourcesResponse'
{ _dsprrsNextToken = Nothing
, _dsprrsScalingPlanResources = Nothing
, _dsprrsResponseStatus = pResponseStatus_
}
dsprrsNextToken :: Lens' DescribeScalingPlanResourcesResponse (Maybe Text)
dsprrsNextToken = lens _dsprrsNextToken (\ s a -> s{_dsprrsNextToken = a})
dsprrsScalingPlanResources :: Lens' DescribeScalingPlanResourcesResponse [ScalingPlanResource]
dsprrsScalingPlanResources = lens _dsprrsScalingPlanResources (\ s a -> s{_dsprrsScalingPlanResources = a}) . _Default . _Coerce
dsprrsResponseStatus :: Lens' DescribeScalingPlanResourcesResponse Int
dsprrsResponseStatus = lens _dsprrsResponseStatus (\ s a -> s{_dsprrsResponseStatus = a})
instance NFData DescribeScalingPlanResourcesResponse
where