module Aws.Ses.Commands.GetIdentityNotificationAttributes
( GetIdentityNotificationAttributes(..)
, GetIdentityNotificationAttributesResponse(..)
, IdentityNotificationAttributes(..)
) where
import Data.Text (Text)
import qualified Data.ByteString.Char8 as BS
import Control.Applicative
import Data.Text.Encoding as T (encodeUtf8)
import Data.Text as T (toCaseFold)
import Data.Typeable
import Text.XML.Cursor (($//), ($/), (&|), laxElement)
import Prelude
import Aws.Core
import Aws.Ses.Core
data GetIdentityNotificationAttributes = GetIdentityNotificationAttributes [Text]
deriving (GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c/= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
== :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c== :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
Eq, Eq GetIdentityNotificationAttributes
GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Ordering
GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
$cmin :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
max :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
$cmax :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes
>= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c>= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
> :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c> :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
<= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c<= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
< :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c< :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
compare :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Ordering
$ccompare :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Ordering
Ord, Int -> GetIdentityNotificationAttributes -> ShowS
[GetIdentityNotificationAttributes] -> ShowS
GetIdentityNotificationAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityNotificationAttributes] -> ShowS
$cshowList :: [GetIdentityNotificationAttributes] -> ShowS
show :: GetIdentityNotificationAttributes -> String
$cshow :: GetIdentityNotificationAttributes -> String
showsPrec :: Int -> GetIdentityNotificationAttributes -> ShowS
$cshowsPrec :: Int -> GetIdentityNotificationAttributes -> ShowS
Show, Typeable)
instance SignQuery GetIdentityNotificationAttributes where
type ServiceConfiguration GetIdentityNotificationAttributes = SesConfiguration
signQuery :: forall queryType.
GetIdentityNotificationAttributes
-> ServiceConfiguration GetIdentityNotificationAttributes queryType
-> SignatureData
-> SignedQuery
signQuery (GetIdentityNotificationAttributes [Text]
identities) =
forall qt.
[(ByteString, ByteString)]
-> SesConfiguration qt -> SignatureData -> SignedQuery
sesSignQuery forall a b. (a -> b) -> a -> b
$ (ByteString
"Action", ByteString
"GetIdentityNotificationAttributes")
forall a. a -> [a] -> [a]
: forall a b. [a] -> [b] -> [(a, b)]
zip (Int -> ByteString
enumMember forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Int
1..]) (Text -> ByteString
T.encodeUtf8 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text]
identities)
where enumMember :: Int -> ByteString
enumMember (Int
n :: Int) = ByteString -> ByteString -> ByteString
BS.append ByteString
"Identities.member." (String -> ByteString
BS.pack forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> String
show Int
n)
data IdentityNotificationAttributes = IdentityNotificationAttributes
{ IdentityNotificationAttributes -> Text
inIdentity :: Text
, IdentityNotificationAttributes -> Maybe Text
inBounceTopic :: Maybe Text
, IdentityNotificationAttributes -> Maybe Text
inComplaintTopic :: Maybe Text
, IdentityNotificationAttributes -> Bool
inForwardingEnabled :: Bool
}
deriving (IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
$c/= :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
== :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
$c== :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
Eq, Eq IdentityNotificationAttributes
IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Ordering
IdentityNotificationAttributes
-> IdentityNotificationAttributes -> IdentityNotificationAttributes
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> IdentityNotificationAttributes
$cmin :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> IdentityNotificationAttributes
max :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> IdentityNotificationAttributes
$cmax :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> IdentityNotificationAttributes
>= :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
$c>= :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
> :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
$c> :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
<= :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
$c<= :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
< :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
$c< :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Bool
compare :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Ordering
$ccompare :: IdentityNotificationAttributes
-> IdentityNotificationAttributes -> Ordering
Ord, Int -> IdentityNotificationAttributes -> ShowS
[IdentityNotificationAttributes] -> ShowS
IdentityNotificationAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityNotificationAttributes] -> ShowS
$cshowList :: [IdentityNotificationAttributes] -> ShowS
show :: IdentityNotificationAttributes -> String
$cshow :: IdentityNotificationAttributes -> String
showsPrec :: Int -> IdentityNotificationAttributes -> ShowS
$cshowsPrec :: Int -> IdentityNotificationAttributes -> ShowS
Show, Typeable)
data GetIdentityNotificationAttributesResponse =
GetIdentityNotificationAttributesResponse [IdentityNotificationAttributes]
deriving (GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c/= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
== :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c== :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
Eq, Eq GetIdentityNotificationAttributesResponse
GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Ordering
GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
$cmin :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
max :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
$cmax :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse
>= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c>= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
> :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c> :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
<= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c<= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
< :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c< :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
compare :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Ordering
$ccompare :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Ordering
Ord, Int -> GetIdentityNotificationAttributesResponse -> ShowS
[GetIdentityNotificationAttributesResponse] -> ShowS
GetIdentityNotificationAttributesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityNotificationAttributesResponse] -> ShowS
$cshowList :: [GetIdentityNotificationAttributesResponse] -> ShowS
show :: GetIdentityNotificationAttributesResponse -> String
$cshow :: GetIdentityNotificationAttributesResponse -> String
showsPrec :: Int -> GetIdentityNotificationAttributesResponse -> ShowS
$cshowsPrec :: Int -> GetIdentityNotificationAttributesResponse -> ShowS
Show, Typeable)
instance ResponseConsumer GetIdentityNotificationAttributes GetIdentityNotificationAttributesResponse where
type ResponseMetadata GetIdentityNotificationAttributesResponse = SesMetadata
responseConsumer :: Request
-> GetIdentityNotificationAttributes
-> IORef
(ResponseMetadata GetIdentityNotificationAttributesResponse)
-> HTTPResponseConsumer GetIdentityNotificationAttributesResponse
responseConsumer Request
_ GetIdentityNotificationAttributes
_ = forall a.
(Cursor -> Response SesMetadata a)
-> IORef SesMetadata -> HTTPResponseConsumer a
sesResponseConsumer forall a b. (a -> b) -> a -> b
$ \Cursor
cursor -> do
let buildAttr :: Cursor -> m IdentityNotificationAttributes
buildAttr Cursor
e = do
Text
inIdentity <- forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Key" forall a b. (a -> b) -> a -> b
$ Cursor
e forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Text -> Cursor -> [Text]
elContent Text
"key"
Text
fwdText <- forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing ForwardingEnabled" forall a b. (a -> b) -> a -> b
$ Cursor
e forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [Text]
elContent Text
"ForwardingEnabled"
let inBounceTopic :: Maybe Text
inBounceTopic = forall {a}. [a] -> Maybe a
headOrNothing (Cursor
e forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [Text]
elContent Text
"BounceTopic")
inComplaintTopic :: Maybe Text
inComplaintTopic = forall {a}. [a] -> Maybe a
headOrNothing (Cursor
e forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [Text]
elContent Text
"ComplaintTopic")
inForwardingEnabled :: Bool
inForwardingEnabled = Text -> Text
T.toCaseFold Text
fwdText forall a. Eq a => a -> a -> Bool
== Text -> Text
T.toCaseFold Text
"true"
forall (m :: * -> *) a. Monad m => a -> m a
return IdentityNotificationAttributes{Bool
Maybe Text
Text
inForwardingEnabled :: Bool
inComplaintTopic :: Maybe Text
inBounceTopic :: Maybe Text
inIdentity :: Text
inForwardingEnabled :: Bool
inComplaintTopic :: Maybe Text
inBounceTopic :: Maybe Text
inIdentity :: Text
..}
[IdentityNotificationAttributes]
attributes <- forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence forall a b. (a -> b) -> a -> b
$ Cursor
cursor forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
laxElement Text
"entry" forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| forall {m :: * -> *}.
MonadThrow m =>
Cursor -> m IdentityNotificationAttributes
buildAttr
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ [IdentityNotificationAttributes]
-> GetIdentityNotificationAttributesResponse
GetIdentityNotificationAttributesResponse [IdentityNotificationAttributes]
attributes
where
headOrNothing :: [a] -> Maybe a
headOrNothing (a
x:[a]
_) = forall a. a -> Maybe a
Just a
x
headOrNothing [a]
_ = forall a. Maybe a
Nothing
instance Transaction GetIdentityNotificationAttributes GetIdentityNotificationAttributesResponse where
instance AsMemoryResponse GetIdentityNotificationAttributesResponse where
type MemoryResponse GetIdentityNotificationAttributesResponse = GetIdentityNotificationAttributesResponse
loadToMemory :: GetIdentityNotificationAttributesResponse
-> ResourceT
IO (MemoryResponse GetIdentityNotificationAttributesResponse)
loadToMemory = forall (m :: * -> *) a. Monad m => a -> m a
return