{-# 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.CreateScalingPlan
(
createScalingPlan
, CreateScalingPlan
, cspScalingPlanName
, cspApplicationSource
, cspScalingInstructions
, createScalingPlanResponse
, CreateScalingPlanResponse
, csprsResponseStatus
, csprsScalingPlanVersion
) 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 CreateScalingPlan = CreateScalingPlan'
{ _cspScalingPlanName :: !Text
, _cspApplicationSource :: !ApplicationSource
, _cspScalingInstructions :: ![ScalingInstruction]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createScalingPlan
:: Text
-> ApplicationSource
-> CreateScalingPlan
createScalingPlan pScalingPlanName_ pApplicationSource_ =
CreateScalingPlan'
{ _cspScalingPlanName = pScalingPlanName_
, _cspApplicationSource = pApplicationSource_
, _cspScalingInstructions = mempty
}
cspScalingPlanName :: Lens' CreateScalingPlan Text
cspScalingPlanName = lens _cspScalingPlanName (\ s a -> s{_cspScalingPlanName = a})
cspApplicationSource :: Lens' CreateScalingPlan ApplicationSource
cspApplicationSource = lens _cspApplicationSource (\ s a -> s{_cspApplicationSource = a})
cspScalingInstructions :: Lens' CreateScalingPlan [ScalingInstruction]
cspScalingInstructions = lens _cspScalingInstructions (\ s a -> s{_cspScalingInstructions = a}) . _Coerce
instance AWSRequest CreateScalingPlan where
type Rs CreateScalingPlan = CreateScalingPlanResponse
request = postJSON autoScalingPlans
response
= receiveJSON
(\ s h x ->
CreateScalingPlanResponse' <$>
(pure (fromEnum s)) <*> (x .:> "ScalingPlanVersion"))
instance Hashable CreateScalingPlan where
instance NFData CreateScalingPlan where
instance ToHeaders CreateScalingPlan where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AnyScaleScalingPlannerFrontendService.CreateScalingPlan"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateScalingPlan where
toJSON CreateScalingPlan'{..}
= object
(catMaybes
[Just ("ScalingPlanName" .= _cspScalingPlanName),
Just ("ApplicationSource" .= _cspApplicationSource),
Just
("ScalingInstructions" .= _cspScalingInstructions)])
instance ToPath CreateScalingPlan where
toPath = const "/"
instance ToQuery CreateScalingPlan where
toQuery = const mempty
data CreateScalingPlanResponse = CreateScalingPlanResponse'
{ _csprsResponseStatus :: !Int
, _csprsScalingPlanVersion :: !Integer
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createScalingPlanResponse
:: Int
-> Integer
-> CreateScalingPlanResponse
createScalingPlanResponse pResponseStatus_ pScalingPlanVersion_ =
CreateScalingPlanResponse'
{ _csprsResponseStatus = pResponseStatus_
, _csprsScalingPlanVersion = pScalingPlanVersion_
}
csprsResponseStatus :: Lens' CreateScalingPlanResponse Int
csprsResponseStatus = lens _csprsResponseStatus (\ s a -> s{_csprsResponseStatus = a})
csprsScalingPlanVersion :: Lens' CreateScalingPlanResponse Integer
csprsScalingPlanVersion = lens _csprsScalingPlanVersion (\ s a -> s{_csprsScalingPlanVersion = a})
instance NFData CreateScalingPlanResponse where