{-# 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.CreateBudget
(
createBudget
, CreateBudget
, cbNotificationsWithSubscribers
, cbAccountId
, cbBudget
, createBudgetResponse
, CreateBudgetResponse
, cbrsResponseStatus
) 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 CreateBudget = CreateBudget'
{ _cbNotificationsWithSubscribers :: !(Maybe [NotificationWithSubscribers])
, _cbAccountId :: !Text
, _cbBudget :: !Budget
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createBudget
:: Text
-> Budget
-> CreateBudget
createBudget pAccountId_ pBudget_ =
CreateBudget'
{ _cbNotificationsWithSubscribers = Nothing
, _cbAccountId = pAccountId_
, _cbBudget = pBudget_
}
cbNotificationsWithSubscribers :: Lens' CreateBudget [NotificationWithSubscribers]
cbNotificationsWithSubscribers = lens _cbNotificationsWithSubscribers (\ s a -> s{_cbNotificationsWithSubscribers = a}) . _Default . _Coerce
cbAccountId :: Lens' CreateBudget Text
cbAccountId = lens _cbAccountId (\ s a -> s{_cbAccountId = a})
cbBudget :: Lens' CreateBudget Budget
cbBudget = lens _cbBudget (\ s a -> s{_cbBudget = a})
instance AWSRequest CreateBudget where
type Rs CreateBudget = CreateBudgetResponse
request = postJSON budgets
response
= receiveEmpty
(\ s h x ->
CreateBudgetResponse' <$> (pure (fromEnum s)))
instance Hashable CreateBudget where
instance NFData CreateBudget where
instance ToHeaders CreateBudget where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSBudgetServiceGateway.CreateBudget" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateBudget where
toJSON CreateBudget'{..}
= object
(catMaybes
[("NotificationsWithSubscribers" .=) <$>
_cbNotificationsWithSubscribers,
Just ("AccountId" .= _cbAccountId),
Just ("Budget" .= _cbBudget)])
instance ToPath CreateBudget where
toPath = const "/"
instance ToQuery CreateBudget where
toQuery = const mempty
newtype CreateBudgetResponse = CreateBudgetResponse'
{ _cbrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createBudgetResponse
:: Int
-> CreateBudgetResponse
createBudgetResponse pResponseStatus_ =
CreateBudgetResponse' {_cbrsResponseStatus = pResponseStatus_}
cbrsResponseStatus :: Lens' CreateBudgetResponse Int
cbrsResponseStatus = lens _cbrsResponseStatus (\ s a -> s{_cbrsResponseStatus = a})
instance NFData CreateBudgetResponse where