module Network.AWS.SES.Types
(
SES
, RESTError
, ns
, Destination
, destination
, dBccAddresses
, dCcAddresses
, dToAddresses
, IdentityDkimAttributes
, identityDkimAttributes
, idaDkimEnabled
, idaDkimTokens
, idaDkimVerificationStatus
, Body
, body
, bHtml
, bText
, IdentityVerificationAttributes
, identityVerificationAttributes
, ivaVerificationStatus
, ivaVerificationToken
, SendDataPoint
, sendDataPoint
, sdpBounces
, sdpComplaints
, sdpDeliveryAttempts
, sdpRejects
, sdpTimestamp
, IdentityType (..)
, Content
, content
, cCharset
, cData
, IdentityNotificationAttributes
, identityNotificationAttributes
, inaBounceTopic
, inaComplaintTopic
, inaDeliveryTopic
, inaForwardingEnabled
, RawMessage
, rawMessage
, rmData
, NotificationType (..)
, VerificationStatus (..)
, Message
, message
, mBody
, mSubject
) where
import Network.AWS.Error
import Network.AWS.Prelude
import Network.AWS.Signing.V4
import qualified GHC.Exts
data SES
instance AWSService SES where
type Sg SES = V4
type Er SES = RESTError
service = Service
{ _svcEndpoint = regional
, _svcAbbrev = "SES"
, _svcPrefix = "email"
, _svcVersion = "2010-12-01"
, _svcTargetPrefix = Nothing
, _svcJSONVersion = Nothing
}
handle = restError statusSuccess
ns :: Text
ns = "http://ses.amazonaws.com/doc/2010-12-01/"
data Destination = Destination
{ _dBccAddresses :: List "ToAddresses" Text
, _dCcAddresses :: List "ToAddresses" Text
, _dToAddresses :: List "ToAddresses" Text
} deriving (Eq, Ord, Show)
destination :: Destination
destination = Destination
{ _dToAddresses = mempty
, _dCcAddresses = mempty
, _dBccAddresses = mempty
}
dBccAddresses :: Lens' Destination [Text]
dBccAddresses = lens _dBccAddresses (\s a -> s { _dBccAddresses = a }) . _List
dCcAddresses :: Lens' Destination [Text]
dCcAddresses = lens _dCcAddresses (\s a -> s { _dCcAddresses = a }) . _List
dToAddresses :: Lens' Destination [Text]
dToAddresses = lens _dToAddresses (\s a -> s { _dToAddresses = a }) . _List
instance FromXML Destination where
parseXML x = Destination
<$> x .@ "BccAddresses"
<*> x .@ "CcAddresses"
<*> x .@ "ToAddresses"
instance ToQuery Destination where
toQuery Destination{..} = mconcat
[ "BccAddresses" =? _dBccAddresses
, "CcAddresses" =? _dCcAddresses
, "ToAddresses" =? _dToAddresses
]
data IdentityDkimAttributes = IdentityDkimAttributes
{ _idaDkimEnabled :: Bool
, _idaDkimTokens :: List "DkimTokens" Text
, _idaDkimVerificationStatus :: VerificationStatus
} deriving (Eq, Show)
identityDkimAttributes :: Bool
-> VerificationStatus
-> IdentityDkimAttributes
identityDkimAttributes p1 p2 = IdentityDkimAttributes
{ _idaDkimEnabled = p1
, _idaDkimVerificationStatus = p2
, _idaDkimTokens = mempty
}
idaDkimEnabled :: Lens' IdentityDkimAttributes Bool
idaDkimEnabled = lens _idaDkimEnabled (\s a -> s { _idaDkimEnabled = a })
idaDkimTokens :: Lens' IdentityDkimAttributes [Text]
idaDkimTokens = lens _idaDkimTokens (\s a -> s { _idaDkimTokens = a }) . _List
idaDkimVerificationStatus :: Lens' IdentityDkimAttributes VerificationStatus
idaDkimVerificationStatus =
lens _idaDkimVerificationStatus
(\s a -> s { _idaDkimVerificationStatus = a })
instance FromXML IdentityDkimAttributes where
parseXML x = IdentityDkimAttributes
<$> x .@ "DkimEnabled"
<*> x .@ "DkimTokens"
<*> x .@ "DkimVerificationStatus"
instance ToQuery IdentityDkimAttributes where
toQuery IdentityDkimAttributes{..} = mconcat
[ "DkimEnabled" =? _idaDkimEnabled
, "DkimTokens" =? _idaDkimTokens
, "DkimVerificationStatus" =? _idaDkimVerificationStatus
]
data Body = Body
{ _bHtml :: Maybe Content
, _bText :: Maybe Content
} deriving (Eq, Show)
body :: Body
body = Body
{ _bText = Nothing
, _bHtml = Nothing
}
bHtml :: Lens' Body (Maybe Content)
bHtml = lens _bHtml (\s a -> s { _bHtml = a })
bText :: Lens' Body (Maybe Content)
bText = lens _bText (\s a -> s { _bText = a })
instance FromXML Body where
parseXML x = Body
<$> x .@? "Html"
<*> x .@? "Text"
instance ToQuery Body where
toQuery Body{..} = mconcat
[ "Html" =? _bHtml
, "Text" =? _bText
]
data IdentityVerificationAttributes = IdentityVerificationAttributes
{ _ivaVerificationStatus :: VerificationStatus
, _ivaVerificationToken :: Maybe Text
} deriving (Eq, Show)
identityVerificationAttributes :: VerificationStatus
-> IdentityVerificationAttributes
identityVerificationAttributes p1 = IdentityVerificationAttributes
{ _ivaVerificationStatus = p1
, _ivaVerificationToken = Nothing
}
ivaVerificationStatus :: Lens' IdentityVerificationAttributes VerificationStatus
ivaVerificationStatus =
lens _ivaVerificationStatus (\s a -> s { _ivaVerificationStatus = a })
ivaVerificationToken :: Lens' IdentityVerificationAttributes (Maybe Text)
ivaVerificationToken =
lens _ivaVerificationToken (\s a -> s { _ivaVerificationToken = a })
instance FromXML IdentityVerificationAttributes where
parseXML x = IdentityVerificationAttributes
<$> x .@ "VerificationStatus"
<*> x .@? "VerificationToken"
instance ToQuery IdentityVerificationAttributes where
toQuery IdentityVerificationAttributes{..} = mconcat
[ "VerificationStatus" =? _ivaVerificationStatus
, "VerificationToken" =? _ivaVerificationToken
]
data SendDataPoint = SendDataPoint
{ _sdpBounces :: Maybe Integer
, _sdpComplaints :: Maybe Integer
, _sdpDeliveryAttempts :: Maybe Integer
, _sdpRejects :: Maybe Integer
, _sdpTimestamp :: Maybe ISO8601
} deriving (Eq, Ord, Show)
sendDataPoint :: SendDataPoint
sendDataPoint = SendDataPoint
{ _sdpTimestamp = Nothing
, _sdpDeliveryAttempts = Nothing
, _sdpBounces = Nothing
, _sdpComplaints = Nothing
, _sdpRejects = Nothing
}
sdpBounces :: Lens' SendDataPoint (Maybe Integer)
sdpBounces = lens _sdpBounces (\s a -> s { _sdpBounces = a })
sdpComplaints :: Lens' SendDataPoint (Maybe Integer)
sdpComplaints = lens _sdpComplaints (\s a -> s { _sdpComplaints = a })
sdpDeliveryAttempts :: Lens' SendDataPoint (Maybe Integer)
sdpDeliveryAttempts =
lens _sdpDeliveryAttempts (\s a -> s { _sdpDeliveryAttempts = a })
sdpRejects :: Lens' SendDataPoint (Maybe Integer)
sdpRejects = lens _sdpRejects (\s a -> s { _sdpRejects = a })
sdpTimestamp :: Lens' SendDataPoint (Maybe UTCTime)
sdpTimestamp = lens _sdpTimestamp (\s a -> s { _sdpTimestamp = a }) . mapping _Time
instance FromXML SendDataPoint where
parseXML x = SendDataPoint
<$> x .@? "Bounces"
<*> x .@? "Complaints"
<*> x .@? "DeliveryAttempts"
<*> x .@? "Rejects"
<*> x .@? "Timestamp"
instance ToQuery SendDataPoint where
toQuery SendDataPoint{..} = mconcat
[ "Bounces" =? _sdpBounces
, "Complaints" =? _sdpComplaints
, "DeliveryAttempts" =? _sdpDeliveryAttempts
, "Rejects" =? _sdpRejects
, "Timestamp" =? _sdpTimestamp
]
data IdentityType
= ITDomain
| ITEmailAddress
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable IdentityType
instance FromText IdentityType where
parser = takeText >>= \case
"Domain" -> pure ITDomain
"EmailAddress" -> pure ITEmailAddress
e -> fail $
"Failure parsing IdentityType from " ++ show e
instance ToText IdentityType where
toText = \case
ITDomain -> "Domain"
ITEmailAddress -> "EmailAddress"
instance ToByteString IdentityType
instance ToHeader IdentityType
instance ToQuery IdentityType
instance FromXML IdentityType where
parseXML = parseXMLText "IdentityType"
data Content = Content
{ _cCharset :: Maybe Text
, _cData :: Text
} deriving (Eq, Ord, Show)
content :: Text
-> Content
content p1 = Content
{ _cData = p1
, _cCharset = Nothing
}
cCharset :: Lens' Content (Maybe Text)
cCharset = lens _cCharset (\s a -> s { _cCharset = a })
cData :: Lens' Content Text
cData = lens _cData (\s a -> s { _cData = a })
instance FromXML Content where
parseXML x = Content
<$> x .@? "Charset"
<*> x .@ "Data"
instance ToQuery Content where
toQuery Content{..} = mconcat
[ "Charset" =? _cCharset
, "Data" =? _cData
]
data IdentityNotificationAttributes = IdentityNotificationAttributes
{ _inaBounceTopic :: Text
, _inaComplaintTopic :: Text
, _inaDeliveryTopic :: Text
, _inaForwardingEnabled :: Bool
} deriving (Eq, Ord, Show)
identityNotificationAttributes :: Text
-> Text
-> Text
-> Bool
-> IdentityNotificationAttributes
identityNotificationAttributes p1 p2 p3 p4 = IdentityNotificationAttributes
{ _inaBounceTopic = p1
, _inaComplaintTopic = p2
, _inaDeliveryTopic = p3
, _inaForwardingEnabled = p4
}
inaBounceTopic :: Lens' IdentityNotificationAttributes Text
inaBounceTopic = lens _inaBounceTopic (\s a -> s { _inaBounceTopic = a })
inaComplaintTopic :: Lens' IdentityNotificationAttributes Text
inaComplaintTopic =
lens _inaComplaintTopic (\s a -> s { _inaComplaintTopic = a })
inaDeliveryTopic :: Lens' IdentityNotificationAttributes Text
inaDeliveryTopic = lens _inaDeliveryTopic (\s a -> s { _inaDeliveryTopic = a })
inaForwardingEnabled :: Lens' IdentityNotificationAttributes Bool
inaForwardingEnabled =
lens _inaForwardingEnabled (\s a -> s { _inaForwardingEnabled = a })
instance FromXML IdentityNotificationAttributes where
parseXML x = IdentityNotificationAttributes
<$> x .@ "BounceTopic"
<*> x .@ "ComplaintTopic"
<*> x .@ "DeliveryTopic"
<*> x .@ "ForwardingEnabled"
instance ToQuery IdentityNotificationAttributes where
toQuery IdentityNotificationAttributes{..} = mconcat
[ "BounceTopic" =? _inaBounceTopic
, "ComplaintTopic" =? _inaComplaintTopic
, "DeliveryTopic" =? _inaDeliveryTopic
, "ForwardingEnabled" =? _inaForwardingEnabled
]
newtype RawMessage = RawMessage
{ _rmData :: Base64
} deriving (Eq, Show)
rawMessage :: Base64
-> RawMessage
rawMessage p1 = RawMessage
{ _rmData = p1
}
rmData :: Lens' RawMessage Base64
rmData = lens _rmData (\s a -> s { _rmData = a })
instance FromXML RawMessage where
parseXML x = RawMessage
<$> x .@ "Data"
instance ToQuery RawMessage where
toQuery RawMessage{..} = mconcat
[ "Data" =? _rmData
]
data NotificationType
= Bounce
| Complaint
| Delivery
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable NotificationType
instance FromText NotificationType where
parser = takeText >>= \case
"Bounce" -> pure Bounce
"Complaint" -> pure Complaint
"Delivery" -> pure Delivery
e -> fail $
"Failure parsing NotificationType from " ++ show e
instance ToText NotificationType where
toText = \case
Bounce -> "Bounce"
Complaint -> "Complaint"
Delivery -> "Delivery"
instance ToByteString NotificationType
instance ToHeader NotificationType
instance ToQuery NotificationType
instance FromXML NotificationType where
parseXML = parseXMLText "NotificationType"
data VerificationStatus
= Failed
| NotStarted
| Pending
| Success
| TemporaryFailure
deriving (Eq, Ord, Show, Generic, Enum)
instance Hashable VerificationStatus
instance FromText VerificationStatus where
parser = takeText >>= \case
"Failed" -> pure Failed
"NotStarted" -> pure NotStarted
"Pending" -> pure Pending
"Success" -> pure Success
"TemporaryFailure" -> pure TemporaryFailure
e -> fail $
"Failure parsing VerificationStatus from " ++ show e
instance ToText VerificationStatus where
toText = \case
Failed -> "Failed"
NotStarted -> "NotStarted"
Pending -> "Pending"
Success -> "Success"
TemporaryFailure -> "TemporaryFailure"
instance ToByteString VerificationStatus
instance ToHeader VerificationStatus
instance ToQuery VerificationStatus
instance FromXML VerificationStatus where
parseXML = parseXMLText "VerificationStatus"
data Message = Message
{ _mBody :: Body
, _mSubject :: Content
} deriving (Eq, Show)
message :: Content
-> Body
-> Message
message p1 p2 = Message
{ _mSubject = p1
, _mBody = p2
}
mBody :: Lens' Message Body
mBody = lens _mBody (\s a -> s { _mBody = a })
mSubject :: Lens' Message Content
mSubject = lens _mSubject (\s a -> s { _mSubject = a })
instance FromXML Message where
parseXML x = Message
<$> x .@ "Body"
<*> x .@ "Subject"
instance ToQuery Message where
toQuery Message{..} = mconcat
[ "Body" =? _mBody
, "Subject" =? _mSubject
]