{-# 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.CreateNotification
(
createNotification
, CreateNotification
, cnAccountId
, cnBudgetName
, cnNotification
, cnSubscribers
, createNotificationResponse
, CreateNotificationResponse
, cnrsResponseStatus
) 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 CreateNotification = CreateNotification'
{ _cnAccountId :: !Text
, _cnBudgetName :: !Text
, _cnNotification :: !Notification
, _cnSubscribers :: !(List1 Subscriber)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createNotification
:: Text
-> Text
-> Notification
-> NonEmpty Subscriber
-> CreateNotification
createNotification pAccountId_ pBudgetName_ pNotification_ pSubscribers_ =
CreateNotification'
{ _cnAccountId = pAccountId_
, _cnBudgetName = pBudgetName_
, _cnNotification = pNotification_
, _cnSubscribers = _List1 # pSubscribers_
}
cnAccountId :: Lens' CreateNotification Text
cnAccountId = lens _cnAccountId (\ s a -> s{_cnAccountId = a})
cnBudgetName :: Lens' CreateNotification Text
cnBudgetName = lens _cnBudgetName (\ s a -> s{_cnBudgetName = a})
cnNotification :: Lens' CreateNotification Notification
cnNotification = lens _cnNotification (\ s a -> s{_cnNotification = a})
cnSubscribers :: Lens' CreateNotification (NonEmpty Subscriber)
cnSubscribers = lens _cnSubscribers (\ s a -> s{_cnSubscribers = a}) . _List1
instance AWSRequest CreateNotification where
type Rs CreateNotification =
CreateNotificationResponse
request = postJSON budgets
response
= receiveEmpty
(\ s h x ->
CreateNotificationResponse' <$> (pure (fromEnum s)))
instance Hashable CreateNotification where
instance NFData CreateNotification where
instance ToHeaders CreateNotification where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSBudgetServiceGateway.CreateNotification" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateNotification where
toJSON CreateNotification'{..}
= object
(catMaybes
[Just ("AccountId" .= _cnAccountId),
Just ("BudgetName" .= _cnBudgetName),
Just ("Notification" .= _cnNotification),
Just ("Subscribers" .= _cnSubscribers)])
instance ToPath CreateNotification where
toPath = const "/"
instance ToQuery CreateNotification where
toQuery = const mempty
newtype CreateNotificationResponse = CreateNotificationResponse'
{ _cnrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createNotificationResponse
:: Int
-> CreateNotificationResponse
createNotificationResponse pResponseStatus_ =
CreateNotificationResponse' {_cnrsResponseStatus = pResponseStatus_}
cnrsResponseStatus :: Lens' CreateNotificationResponse Int
cnrsResponseStatus = lens _cnrsResponseStatus (\ s a -> s{_cnrsResponseStatus = a})
instance NFData CreateNotificationResponse where