{-# 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.UpdateScalingPlan
(
updateScalingPlan
, UpdateScalingPlan
, uspScalingInstructions
, uspApplicationSource
, uspScalingPlanName
, uspScalingPlanVersion
, updateScalingPlanResponse
, UpdateScalingPlanResponse
, usprsResponseStatus
) 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 UpdateScalingPlan = UpdateScalingPlan'
{ _uspScalingInstructions :: !(Maybe [ScalingInstruction])
, _uspApplicationSource :: !(Maybe ApplicationSource)
, _uspScalingPlanName :: !Text
, _uspScalingPlanVersion :: !Integer
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateScalingPlan
:: Text
-> Integer
-> UpdateScalingPlan
updateScalingPlan pScalingPlanName_ pScalingPlanVersion_ =
UpdateScalingPlan'
{ _uspScalingInstructions = Nothing
, _uspApplicationSource = Nothing
, _uspScalingPlanName = pScalingPlanName_
, _uspScalingPlanVersion = pScalingPlanVersion_
}
uspScalingInstructions :: Lens' UpdateScalingPlan [ScalingInstruction]
uspScalingInstructions = lens _uspScalingInstructions (\ s a -> s{_uspScalingInstructions = a}) . _Default . _Coerce
uspApplicationSource :: Lens' UpdateScalingPlan (Maybe ApplicationSource)
uspApplicationSource = lens _uspApplicationSource (\ s a -> s{_uspApplicationSource = a})
uspScalingPlanName :: Lens' UpdateScalingPlan Text
uspScalingPlanName = lens _uspScalingPlanName (\ s a -> s{_uspScalingPlanName = a})
uspScalingPlanVersion :: Lens' UpdateScalingPlan Integer
uspScalingPlanVersion = lens _uspScalingPlanVersion (\ s a -> s{_uspScalingPlanVersion = a})
instance AWSRequest UpdateScalingPlan where
type Rs UpdateScalingPlan = UpdateScalingPlanResponse
request = postJSON autoScalingPlans
response
= receiveEmpty
(\ s h x ->
UpdateScalingPlanResponse' <$> (pure (fromEnum s)))
instance Hashable UpdateScalingPlan where
instance NFData UpdateScalingPlan where
instance ToHeaders UpdateScalingPlan where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AnyScaleScalingPlannerFrontendService.UpdateScalingPlan"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateScalingPlan where
toJSON UpdateScalingPlan'{..}
= object
(catMaybes
[("ScalingInstructions" .=) <$>
_uspScalingInstructions,
("ApplicationSource" .=) <$> _uspApplicationSource,
Just ("ScalingPlanName" .= _uspScalingPlanName),
Just
("ScalingPlanVersion" .= _uspScalingPlanVersion)])
instance ToPath UpdateScalingPlan where
toPath = const "/"
instance ToQuery UpdateScalingPlan where
toQuery = const mempty
newtype UpdateScalingPlanResponse = UpdateScalingPlanResponse'
{ _usprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateScalingPlanResponse
:: Int
-> UpdateScalingPlanResponse
updateScalingPlanResponse pResponseStatus_ =
UpdateScalingPlanResponse' {_usprsResponseStatus = pResponseStatus_}
usprsResponseStatus :: Lens' UpdateScalingPlanResponse Int
usprsResponseStatus = lens _usprsResponseStatus (\ s a -> s{_usprsResponseStatus = a})
instance NFData UpdateScalingPlanResponse where