{-# 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.DescribeSubscribersForNotification
(
describeSubscribersForNotification
, DescribeSubscribersForNotification
, dsfnNextToken
, dsfnMaxResults
, dsfnAccountId
, dsfnBudgetName
, dsfnNotification
, describeSubscribersForNotificationResponse
, DescribeSubscribersForNotificationResponse
, dsfnrsNextToken
, dsfnrsSubscribers
, dsfnrsResponseStatus
) 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 DescribeSubscribersForNotification = DescribeSubscribersForNotification'
{ _dsfnNextToken :: !(Maybe Text)
, _dsfnMaxResults :: !(Maybe Nat)
, _dsfnAccountId :: !Text
, _dsfnBudgetName :: !Text
, _dsfnNotification :: !Notification
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeSubscribersForNotification
:: Text
-> Text
-> Notification
-> DescribeSubscribersForNotification
describeSubscribersForNotification pAccountId_ pBudgetName_ pNotification_ =
DescribeSubscribersForNotification'
{ _dsfnNextToken = Nothing
, _dsfnMaxResults = Nothing
, _dsfnAccountId = pAccountId_
, _dsfnBudgetName = pBudgetName_
, _dsfnNotification = pNotification_
}
dsfnNextToken :: Lens' DescribeSubscribersForNotification (Maybe Text)
dsfnNextToken = lens _dsfnNextToken (\ s a -> s{_dsfnNextToken = a})
dsfnMaxResults :: Lens' DescribeSubscribersForNotification (Maybe Natural)
dsfnMaxResults = lens _dsfnMaxResults (\ s a -> s{_dsfnMaxResults = a}) . mapping _Nat
dsfnAccountId :: Lens' DescribeSubscribersForNotification Text
dsfnAccountId = lens _dsfnAccountId (\ s a -> s{_dsfnAccountId = a})
dsfnBudgetName :: Lens' DescribeSubscribersForNotification Text
dsfnBudgetName = lens _dsfnBudgetName (\ s a -> s{_dsfnBudgetName = a})
dsfnNotification :: Lens' DescribeSubscribersForNotification Notification
dsfnNotification = lens _dsfnNotification (\ s a -> s{_dsfnNotification = a})
instance AWSRequest
DescribeSubscribersForNotification
where
type Rs DescribeSubscribersForNotification =
DescribeSubscribersForNotificationResponse
request = postJSON budgets
response
= receiveJSON
(\ s h x ->
DescribeSubscribersForNotificationResponse' <$>
(x .?> "NextToken") <*> (x .?> "Subscribers") <*>
(pure (fromEnum s)))
instance Hashable DescribeSubscribersForNotification
where
instance NFData DescribeSubscribersForNotification
where
instance ToHeaders DescribeSubscribersForNotification
where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSBudgetServiceGateway.DescribeSubscribersForNotification"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeSubscribersForNotification
where
toJSON DescribeSubscribersForNotification'{..}
= object
(catMaybes
[("NextToken" .=) <$> _dsfnNextToken,
("MaxResults" .=) <$> _dsfnMaxResults,
Just ("AccountId" .= _dsfnAccountId),
Just ("BudgetName" .= _dsfnBudgetName),
Just ("Notification" .= _dsfnNotification)])
instance ToPath DescribeSubscribersForNotification
where
toPath = const "/"
instance ToQuery DescribeSubscribersForNotification
where
toQuery = const mempty
data DescribeSubscribersForNotificationResponse = DescribeSubscribersForNotificationResponse'
{ _dsfnrsNextToken :: !(Maybe Text)
, _dsfnrsSubscribers :: !(Maybe (List1 Subscriber))
, _dsfnrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeSubscribersForNotificationResponse
:: Int
-> DescribeSubscribersForNotificationResponse
describeSubscribersForNotificationResponse pResponseStatus_ =
DescribeSubscribersForNotificationResponse'
{ _dsfnrsNextToken = Nothing
, _dsfnrsSubscribers = Nothing
, _dsfnrsResponseStatus = pResponseStatus_
}
dsfnrsNextToken :: Lens' DescribeSubscribersForNotificationResponse (Maybe Text)
dsfnrsNextToken = lens _dsfnrsNextToken (\ s a -> s{_dsfnrsNextToken = a})
dsfnrsSubscribers :: Lens' DescribeSubscribersForNotificationResponse (Maybe (NonEmpty Subscriber))
dsfnrsSubscribers = lens _dsfnrsSubscribers (\ s a -> s{_dsfnrsSubscribers = a}) . mapping _List1
dsfnrsResponseStatus :: Lens' DescribeSubscribersForNotificationResponse Int
dsfnrsResponseStatus = lens _dsfnrsResponseStatus (\ s a -> s{_dsfnrsResponseStatus = a})
instance NFData
DescribeSubscribersForNotificationResponse
where