module Aws.Ses.Commands.ListIdentities
( ListIdentities(..)
, ListIdentitiesResponse(..)
, IdentityType(..)
) where
import Data.Text (Text)
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (catMaybes)
import Control.Applicative ((<$>))
import Data.Text.Encoding as T (encodeUtf8)
import Data.Typeable
import Text.XML.Cursor (($//), (&/), laxElement)
import Aws.Core
import Aws.Ses.Core
data ListIdentities =
ListIdentities
{ ListIdentities -> Maybe IdentityType
liIdentityType :: Maybe IdentityType
, ListIdentities -> Maybe Int
liMaxItems :: Maybe Int
, ListIdentities -> Maybe Text
liNextToken :: Maybe Text
}
deriving (ListIdentities -> ListIdentities -> Bool
(ListIdentities -> ListIdentities -> Bool)
-> (ListIdentities -> ListIdentities -> Bool) -> Eq ListIdentities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListIdentities -> ListIdentities -> Bool
$c/= :: ListIdentities -> ListIdentities -> Bool
== :: ListIdentities -> ListIdentities -> Bool
$c== :: ListIdentities -> ListIdentities -> Bool
Eq, Eq ListIdentities
Eq ListIdentities
-> (ListIdentities -> ListIdentities -> Ordering)
-> (ListIdentities -> ListIdentities -> Bool)
-> (ListIdentities -> ListIdentities -> Bool)
-> (ListIdentities -> ListIdentities -> Bool)
-> (ListIdentities -> ListIdentities -> Bool)
-> (ListIdentities -> ListIdentities -> ListIdentities)
-> (ListIdentities -> ListIdentities -> ListIdentities)
-> Ord ListIdentities
ListIdentities -> ListIdentities -> Bool
ListIdentities -> ListIdentities -> Ordering
ListIdentities -> ListIdentities -> ListIdentities
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 :: ListIdentities -> ListIdentities -> ListIdentities
$cmin :: ListIdentities -> ListIdentities -> ListIdentities
max :: ListIdentities -> ListIdentities -> ListIdentities
$cmax :: ListIdentities -> ListIdentities -> ListIdentities
>= :: ListIdentities -> ListIdentities -> Bool
$c>= :: ListIdentities -> ListIdentities -> Bool
> :: ListIdentities -> ListIdentities -> Bool
$c> :: ListIdentities -> ListIdentities -> Bool
<= :: ListIdentities -> ListIdentities -> Bool
$c<= :: ListIdentities -> ListIdentities -> Bool
< :: ListIdentities -> ListIdentities -> Bool
$c< :: ListIdentities -> ListIdentities -> Bool
compare :: ListIdentities -> ListIdentities -> Ordering
$ccompare :: ListIdentities -> ListIdentities -> Ordering
$cp1Ord :: Eq ListIdentities
Ord, Int -> ListIdentities -> ShowS
[ListIdentities] -> ShowS
ListIdentities -> String
(Int -> ListIdentities -> ShowS)
-> (ListIdentities -> String)
-> ([ListIdentities] -> ShowS)
-> Show ListIdentities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListIdentities] -> ShowS
$cshowList :: [ListIdentities] -> ShowS
show :: ListIdentities -> String
$cshow :: ListIdentities -> String
showsPrec :: Int -> ListIdentities -> ShowS
$cshowsPrec :: Int -> ListIdentities -> ShowS
Show, Typeable)
data IdentityType = EmailAddress | Domain
deriving (IdentityType -> IdentityType -> Bool
(IdentityType -> IdentityType -> Bool)
-> (IdentityType -> IdentityType -> Bool) -> Eq IdentityType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityType -> IdentityType -> Bool
$c/= :: IdentityType -> IdentityType -> Bool
== :: IdentityType -> IdentityType -> Bool
$c== :: IdentityType -> IdentityType -> Bool
Eq, Eq IdentityType
Eq IdentityType
-> (IdentityType -> IdentityType -> Ordering)
-> (IdentityType -> IdentityType -> Bool)
-> (IdentityType -> IdentityType -> Bool)
-> (IdentityType -> IdentityType -> Bool)
-> (IdentityType -> IdentityType -> Bool)
-> (IdentityType -> IdentityType -> IdentityType)
-> (IdentityType -> IdentityType -> IdentityType)
-> Ord IdentityType
IdentityType -> IdentityType -> Bool
IdentityType -> IdentityType -> Ordering
IdentityType -> IdentityType -> IdentityType
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 :: IdentityType -> IdentityType -> IdentityType
$cmin :: IdentityType -> IdentityType -> IdentityType
max :: IdentityType -> IdentityType -> IdentityType
$cmax :: IdentityType -> IdentityType -> IdentityType
>= :: IdentityType -> IdentityType -> Bool
$c>= :: IdentityType -> IdentityType -> Bool
> :: IdentityType -> IdentityType -> Bool
$c> :: IdentityType -> IdentityType -> Bool
<= :: IdentityType -> IdentityType -> Bool
$c<= :: IdentityType -> IdentityType -> Bool
< :: IdentityType -> IdentityType -> Bool
$c< :: IdentityType -> IdentityType -> Bool
compare :: IdentityType -> IdentityType -> Ordering
$ccompare :: IdentityType -> IdentityType -> Ordering
$cp1Ord :: Eq IdentityType
Ord, Int -> IdentityType -> ShowS
[IdentityType] -> ShowS
IdentityType -> String
(Int -> IdentityType -> ShowS)
-> (IdentityType -> String)
-> ([IdentityType] -> ShowS)
-> Show IdentityType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityType] -> ShowS
$cshowList :: [IdentityType] -> ShowS
show :: IdentityType -> String
$cshow :: IdentityType -> String
showsPrec :: Int -> IdentityType -> ShowS
$cshowsPrec :: Int -> IdentityType -> ShowS
Show, Typeable)
instance SignQuery ListIdentities where
type ServiceConfiguration ListIdentities = SesConfiguration
signQuery :: ListIdentities
-> ServiceConfiguration ListIdentities queryType
-> SignatureData
-> SignedQuery
signQuery ListIdentities {Maybe Int
Maybe Text
Maybe IdentityType
liNextToken :: Maybe Text
liMaxItems :: Maybe Int
liIdentityType :: Maybe IdentityType
liNextToken :: ListIdentities -> Maybe Text
liMaxItems :: ListIdentities -> Maybe Int
liIdentityType :: ListIdentities -> Maybe IdentityType
..} =
let it :: Maybe ByteString
it = case Maybe IdentityType
liIdentityType of
Just IdentityType
EmailAddress -> ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
"EmailAddress"
Just IdentityType
Domain -> ByteString -> Maybe ByteString
forall a. a -> Maybe a
Just ByteString
"Domain"
Maybe IdentityType
Nothing -> Maybe ByteString
forall a. Maybe a
Nothing
in [(ByteString, ByteString)]
-> SesConfiguration queryType -> SignatureData -> SignedQuery
forall qt.
[(ByteString, ByteString)]
-> SesConfiguration qt -> SignatureData -> SignedQuery
sesSignQuery ([(ByteString, ByteString)]
-> SesConfiguration queryType -> SignatureData -> SignedQuery)
-> [(ByteString, ByteString)]
-> SesConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$ (ByteString
"Action", ByteString
"ListIdentities")
(ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. a -> [a] -> [a]
: [Maybe (ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. [Maybe a] -> [a]
catMaybes
[ (ByteString
"IdentityType",) (ByteString -> (ByteString, ByteString))
-> Maybe ByteString -> Maybe (ByteString, ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe ByteString
it
, (ByteString
"MaxItems",) (ByteString -> (ByteString, ByteString))
-> (Int -> ByteString) -> Int -> (ByteString, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
BS.pack (String -> ByteString) -> (Int -> String) -> Int -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall a. Show a => a -> String
show (Int -> (ByteString, ByteString))
-> Maybe Int -> Maybe (ByteString, ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Int
liMaxItems
, (ByteString
"NextToken",) (ByteString -> (ByteString, ByteString))
-> (Text -> ByteString) -> Text -> (ByteString, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
T.encodeUtf8 (Text -> (ByteString, ByteString))
-> Maybe Text -> Maybe (ByteString, ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
liNextToken
]
data ListIdentitiesResponse = ListIdentitiesResponse [Text]
deriving (ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
(ListIdentitiesResponse -> ListIdentitiesResponse -> Bool)
-> (ListIdentitiesResponse -> ListIdentitiesResponse -> Bool)
-> Eq ListIdentitiesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
$c/= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
== :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
$c== :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
Eq, Eq ListIdentitiesResponse
Eq ListIdentitiesResponse
-> (ListIdentitiesResponse -> ListIdentitiesResponse -> Ordering)
-> (ListIdentitiesResponse -> ListIdentitiesResponse -> Bool)
-> (ListIdentitiesResponse -> ListIdentitiesResponse -> Bool)
-> (ListIdentitiesResponse -> ListIdentitiesResponse -> Bool)
-> (ListIdentitiesResponse -> ListIdentitiesResponse -> Bool)
-> (ListIdentitiesResponse
-> ListIdentitiesResponse -> ListIdentitiesResponse)
-> (ListIdentitiesResponse
-> ListIdentitiesResponse -> ListIdentitiesResponse)
-> Ord ListIdentitiesResponse
ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
ListIdentitiesResponse -> ListIdentitiesResponse -> Ordering
ListIdentitiesResponse
-> ListIdentitiesResponse -> ListIdentitiesResponse
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 :: ListIdentitiesResponse
-> ListIdentitiesResponse -> ListIdentitiesResponse
$cmin :: ListIdentitiesResponse
-> ListIdentitiesResponse -> ListIdentitiesResponse
max :: ListIdentitiesResponse
-> ListIdentitiesResponse -> ListIdentitiesResponse
$cmax :: ListIdentitiesResponse
-> ListIdentitiesResponse -> ListIdentitiesResponse
>= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
$c>= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
> :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
$c> :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
<= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
$c<= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
< :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
$c< :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
compare :: ListIdentitiesResponse -> ListIdentitiesResponse -> Ordering
$ccompare :: ListIdentitiesResponse -> ListIdentitiesResponse -> Ordering
$cp1Ord :: Eq ListIdentitiesResponse
Ord, Int -> ListIdentitiesResponse -> ShowS
[ListIdentitiesResponse] -> ShowS
ListIdentitiesResponse -> String
(Int -> ListIdentitiesResponse -> ShowS)
-> (ListIdentitiesResponse -> String)
-> ([ListIdentitiesResponse] -> ShowS)
-> Show ListIdentitiesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListIdentitiesResponse] -> ShowS
$cshowList :: [ListIdentitiesResponse] -> ShowS
show :: ListIdentitiesResponse -> String
$cshow :: ListIdentitiesResponse -> String
showsPrec :: Int -> ListIdentitiesResponse -> ShowS
$cshowsPrec :: Int -> ListIdentitiesResponse -> ShowS
Show, Typeable)
instance ResponseConsumer ListIdentities ListIdentitiesResponse where
type ResponseMetadata ListIdentitiesResponse = SesMetadata
responseConsumer :: Request
-> ListIdentities
-> IORef (ResponseMetadata ListIdentitiesResponse)
-> HTTPResponseConsumer ListIdentitiesResponse
responseConsumer Request
_ ListIdentities
_ =
(Cursor -> Response SesMetadata ListIdentitiesResponse)
-> IORef SesMetadata -> HTTPResponseConsumer ListIdentitiesResponse
forall a.
(Cursor -> Response SesMetadata a)
-> IORef SesMetadata -> HTTPResponseConsumer a
sesResponseConsumer ((Cursor -> Response SesMetadata ListIdentitiesResponse)
-> IORef SesMetadata
-> HTTPResponseConsumer ListIdentitiesResponse)
-> (Cursor -> Response SesMetadata ListIdentitiesResponse)
-> IORef SesMetadata
-> HTTPResponseConsumer ListIdentitiesResponse
forall a b. (a -> b) -> a -> b
$ \Cursor
cursor -> do
let ids :: [Text]
ids = Cursor
cursor Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
laxElement Text
"Identities" Axis -> (Cursor -> [Text]) -> Cursor -> [Text]
forall node a.
Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]
&/ Text -> Cursor -> [Text]
elContent Text
"member"
ListIdentitiesResponse
-> Response SesMetadata ListIdentitiesResponse
forall (m :: * -> *) a. Monad m => a -> m a
return (ListIdentitiesResponse
-> Response SesMetadata ListIdentitiesResponse)
-> ListIdentitiesResponse
-> Response SesMetadata ListIdentitiesResponse
forall a b. (a -> b) -> a -> b
$ [Text] -> ListIdentitiesResponse
ListIdentitiesResponse [Text]
ids
instance Transaction ListIdentities ListIdentitiesResponse where
instance AsMemoryResponse ListIdentitiesResponse where
type MemoryResponse ListIdentitiesResponse = ListIdentitiesResponse
loadToMemory :: ListIdentitiesResponse
-> ResourceT IO (MemoryResponse ListIdentitiesResponse)
loadToMemory = ListIdentitiesResponse
-> ResourceT IO (MemoryResponse ListIdentitiesResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return