{-# 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.CreateSubscriber
(
createSubscriber
, CreateSubscriber
, csAccountId
, csBudgetName
, csNotification
, csSubscriber
, createSubscriberResponse
, CreateSubscriberResponse
, csrsResponseStatus
) 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 CreateSubscriber = CreateSubscriber'
{ _csAccountId :: !Text
, _csBudgetName :: !Text
, _csNotification :: !Notification
, _csSubscriber :: !Subscriber
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createSubscriber
:: Text
-> Text
-> Notification
-> Subscriber
-> CreateSubscriber
createSubscriber pAccountId_ pBudgetName_ pNotification_ pSubscriber_ =
CreateSubscriber'
{ _csAccountId = pAccountId_
, _csBudgetName = pBudgetName_
, _csNotification = pNotification_
, _csSubscriber = pSubscriber_
}
csAccountId :: Lens' CreateSubscriber Text
csAccountId = lens _csAccountId (\ s a -> s{_csAccountId = a})
csBudgetName :: Lens' CreateSubscriber Text
csBudgetName = lens _csBudgetName (\ s a -> s{_csBudgetName = a})
csNotification :: Lens' CreateSubscriber Notification
csNotification = lens _csNotification (\ s a -> s{_csNotification = a})
csSubscriber :: Lens' CreateSubscriber Subscriber
csSubscriber = lens _csSubscriber (\ s a -> s{_csSubscriber = a})
instance AWSRequest CreateSubscriber where
type Rs CreateSubscriber = CreateSubscriberResponse
request = postJSON budgets
response
= receiveEmpty
(\ s h x ->
CreateSubscriberResponse' <$> (pure (fromEnum s)))
instance Hashable CreateSubscriber where
instance NFData CreateSubscriber where
instance ToHeaders CreateSubscriber where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSBudgetServiceGateway.CreateSubscriber" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateSubscriber where
toJSON CreateSubscriber'{..}
= object
(catMaybes
[Just ("AccountId" .= _csAccountId),
Just ("BudgetName" .= _csBudgetName),
Just ("Notification" .= _csNotification),
Just ("Subscriber" .= _csSubscriber)])
instance ToPath CreateSubscriber where
toPath = const "/"
instance ToQuery CreateSubscriber where
toQuery = const mempty
newtype CreateSubscriberResponse = CreateSubscriberResponse'
{ _csrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createSubscriberResponse
:: Int
-> CreateSubscriberResponse
createSubscriberResponse pResponseStatus_ =
CreateSubscriberResponse' {_csrsResponseStatus = pResponseStatus_}
csrsResponseStatus :: Lens' CreateSubscriberResponse Int
csrsResponseStatus = lens _csrsResponseStatus (\ s a -> s{_csrsResponseStatus = a})
instance NFData CreateSubscriberResponse where