module Aws.Ses.Commands.SetIdentityNotificationTopic
( SetIdentityNotificationTopic(..)
, SetIdentityNotificationTopicResponse(..)
, NotificationType(..)
) where
import Data.Text (Text)
import Control.Applicative ((<$>))
import Data.Maybe (maybeToList)
import Data.Text.Encoding as T (encodeUtf8)
import Data.Typeable
import Aws.Core
import Aws.Ses.Core
data NotificationType = Bounce | Complaint
deriving (Eq, Ord, Show, Typeable)
data SetIdentityNotificationTopic =
SetIdentityNotificationTopic
{ sntIdentity :: Text
, sntNotificationType :: NotificationType
, sntSnsTopic :: Maybe Text
}
deriving (Eq, Ord, Show, Typeable)
instance SignQuery SetIdentityNotificationTopic where
type ServiceConfiguration SetIdentityNotificationTopic = SesConfiguration
signQuery SetIdentityNotificationTopic{..} =
let notificationType = case sntNotificationType of
Bounce -> "Bounce"
Complaint -> "Complaint"
snsTopic = ("SnsTopic",) . T.encodeUtf8 <$> sntSnsTopic
in sesSignQuery $ [ ("Action", "SetIdentityNotificationTopic")
, ("Identity", T.encodeUtf8 sntIdentity)
, ("NotificationType", notificationType)
] ++ maybeToList snsTopic
data SetIdentityNotificationTopicResponse = SetIdentityNotificationTopicResponse
deriving (Eq, Ord, Show, Typeable)
instance ResponseConsumer SetIdentityNotificationTopic SetIdentityNotificationTopicResponse where
type ResponseMetadata SetIdentityNotificationTopicResponse = SesMetadata
responseConsumer _ _
= sesResponseConsumer $ \_ -> return SetIdentityNotificationTopicResponse
instance Transaction SetIdentityNotificationTopic SetIdentityNotificationTopicResponse
instance AsMemoryResponse SetIdentityNotificationTopicResponse where
type MemoryResponse SetIdentityNotificationTopicResponse = SetIdentityNotificationTopicResponse
loadToMemory = return