{-# 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.Budgets.UpdateBudget
(
updateBudget
, UpdateBudget
, ubAccountId
, ubNewBudget
, updateBudgetResponse
, UpdateBudgetResponse
, ubrsResponseStatus
) where
import Network.AWS.Budgets.Types
import Network.AWS.Budgets.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateBudget = UpdateBudget'
{ _ubAccountId :: !Text
, _ubNewBudget :: !Budget
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateBudget
:: Text
-> Budget
-> UpdateBudget
updateBudget pAccountId_ pNewBudget_ =
UpdateBudget' {_ubAccountId = pAccountId_, _ubNewBudget = pNewBudget_}
ubAccountId :: Lens' UpdateBudget Text
ubAccountId = lens _ubAccountId (\ s a -> s{_ubAccountId = a})
ubNewBudget :: Lens' UpdateBudget Budget
ubNewBudget = lens _ubNewBudget (\ s a -> s{_ubNewBudget = a})
instance AWSRequest UpdateBudget where
type Rs UpdateBudget = UpdateBudgetResponse
request = postJSON budgets
response
= receiveEmpty
(\ s h x ->
UpdateBudgetResponse' <$> (pure (fromEnum s)))
instance Hashable UpdateBudget where
instance NFData UpdateBudget where
instance ToHeaders UpdateBudget where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSBudgetServiceGateway.UpdateBudget" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateBudget where
toJSON UpdateBudget'{..}
= object
(catMaybes
[Just ("AccountId" .= _ubAccountId),
Just ("NewBudget" .= _ubNewBudget)])
instance ToPath UpdateBudget where
toPath = const "/"
instance ToQuery UpdateBudget where
toQuery = const mempty
newtype UpdateBudgetResponse = UpdateBudgetResponse'
{ _ubrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateBudgetResponse
:: Int
-> UpdateBudgetResponse
updateBudgetResponse pResponseStatus_ =
UpdateBudgetResponse' {_ubrsResponseStatus = pResponseStatus_}
ubrsResponseStatus :: Lens' UpdateBudgetResponse Int
ubrsResponseStatus = lens _ubrsResponseStatus (\ s a -> s{_ubrsResponseStatus = a})
instance NFData UpdateBudgetResponse where