{-# 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.Redshift.CreateEventSubscription
(
createEventSubscription
, CreateEventSubscription
, cesEnabled
, cesSourceType
, cesSeverity
, cesEventCategories
, cesSourceIds
, cesTags
, cesSubscriptionName
, cesSNSTopicARN
, createEventSubscriptionResponse
, CreateEventSubscriptionResponse
, cesrsEventSubscription
, cesrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Redshift.Types
import Network.AWS.Redshift.Types.Product
import Network.AWS.Request
import Network.AWS.Response
data CreateEventSubscription = CreateEventSubscription'
{ _cesEnabled :: !(Maybe Bool)
, _cesSourceType :: !(Maybe Text)
, _cesSeverity :: !(Maybe Text)
, _cesEventCategories :: !(Maybe [Text])
, _cesSourceIds :: !(Maybe [Text])
, _cesTags :: !(Maybe [Tag])
, _cesSubscriptionName :: !Text
, _cesSNSTopicARN :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createEventSubscription
:: Text
-> Text
-> CreateEventSubscription
createEventSubscription pSubscriptionName_ pSNSTopicARN_ =
CreateEventSubscription'
{ _cesEnabled = Nothing
, _cesSourceType = Nothing
, _cesSeverity = Nothing
, _cesEventCategories = Nothing
, _cesSourceIds = Nothing
, _cesTags = Nothing
, _cesSubscriptionName = pSubscriptionName_
, _cesSNSTopicARN = pSNSTopicARN_
}
cesEnabled :: Lens' CreateEventSubscription (Maybe Bool)
cesEnabled = lens _cesEnabled (\ s a -> s{_cesEnabled = a});
cesSourceType :: Lens' CreateEventSubscription (Maybe Text)
cesSourceType = lens _cesSourceType (\ s a -> s{_cesSourceType = a});
cesSeverity :: Lens' CreateEventSubscription (Maybe Text)
cesSeverity = lens _cesSeverity (\ s a -> s{_cesSeverity = a});
cesEventCategories :: Lens' CreateEventSubscription [Text]
cesEventCategories = lens _cesEventCategories (\ s a -> s{_cesEventCategories = a}) . _Default . _Coerce;
cesSourceIds :: Lens' CreateEventSubscription [Text]
cesSourceIds = lens _cesSourceIds (\ s a -> s{_cesSourceIds = a}) . _Default . _Coerce;
cesTags :: Lens' CreateEventSubscription [Tag]
cesTags = lens _cesTags (\ s a -> s{_cesTags = a}) . _Default . _Coerce;
cesSubscriptionName :: Lens' CreateEventSubscription Text
cesSubscriptionName = lens _cesSubscriptionName (\ s a -> s{_cesSubscriptionName = a});
cesSNSTopicARN :: Lens' CreateEventSubscription Text
cesSNSTopicARN = lens _cesSNSTopicARN (\ s a -> s{_cesSNSTopicARN = a});
instance AWSRequest CreateEventSubscription where
type Rs CreateEventSubscription =
CreateEventSubscriptionResponse
request = postQuery redshift
response
= receiveXMLWrapper "CreateEventSubscriptionResult"
(\ s h x ->
CreateEventSubscriptionResponse' <$>
(x .@? "EventSubscription") <*> (pure (fromEnum s)))
instance Hashable CreateEventSubscription
instance NFData CreateEventSubscription
instance ToHeaders CreateEventSubscription where
toHeaders = const mempty
instance ToPath CreateEventSubscription where
toPath = const "/"
instance ToQuery CreateEventSubscription where
toQuery CreateEventSubscription'{..}
= mconcat
["Action" =:
("CreateEventSubscription" :: ByteString),
"Version" =: ("2012-12-01" :: ByteString),
"Enabled" =: _cesEnabled,
"SourceType" =: _cesSourceType,
"Severity" =: _cesSeverity,
"EventCategories" =:
toQuery
(toQueryList "EventCategory" <$>
_cesEventCategories),
"SourceIds" =:
toQuery (toQueryList "SourceId" <$> _cesSourceIds),
"Tags" =: toQuery (toQueryList "Tag" <$> _cesTags),
"SubscriptionName" =: _cesSubscriptionName,
"SnsTopicArn" =: _cesSNSTopicARN]
data CreateEventSubscriptionResponse = CreateEventSubscriptionResponse'
{ _cesrsEventSubscription :: !(Maybe EventSubscription)
, _cesrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createEventSubscriptionResponse
:: Int
-> CreateEventSubscriptionResponse
createEventSubscriptionResponse pResponseStatus_ =
CreateEventSubscriptionResponse'
{ _cesrsEventSubscription = Nothing
, _cesrsResponseStatus = pResponseStatus_
}
cesrsEventSubscription :: Lens' CreateEventSubscriptionResponse (Maybe EventSubscription)
cesrsEventSubscription = lens _cesrsEventSubscription (\ s a -> s{_cesrsEventSubscription = a});
cesrsResponseStatus :: Lens' CreateEventSubscriptionResponse Int
cesrsResponseStatus = lens _cesrsResponseStatus (\ s a -> s{_cesrsResponseStatus = a});
instance NFData CreateEventSubscriptionResponse