    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 Prelude

    import Aws.Core
    import Aws.Ses.Core

    -- | List email addresses and/or domains
    data ListIdentities =
        ListIdentities
          { ListIdentities -> Maybe IdentityType
    liIdentityType :: Maybe IdentityType
          , ListIdentities -> Maybe Int
    liMaxItems :: Maybe Int -- valid range is 1..100
          , 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
    $c== :: ListIdentities -> ListIdentities -> Bool
    == :: ListIdentities -> ListIdentities -> Bool
    $c/= :: ListIdentities -> ListIdentities -> Bool
    /= :: 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
    $ccompare :: ListIdentities -> ListIdentities -> Ordering
    compare :: ListIdentities -> ListIdentities -> Ordering
    $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
    >= :: ListIdentities -> ListIdentities -> Bool
    $cmax :: ListIdentities -> ListIdentities -> ListIdentities
    max :: ListIdentities -> ListIdentities -> ListIdentities
    $cmin :: ListIdentities -> ListIdentities -> ListIdentities
    min :: ListIdentities -> ListIdentities -> 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
    $cshowsPrec :: Int -> ListIdentities -> ShowS
    showsPrec :: Int -> ListIdentities -> ShowS
    $cshow :: ListIdentities -> String
    show :: ListIdentities -> String
    $cshowList :: [ListIdentities] -> ShowS
    showList :: [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
    $c== :: IdentityType -> IdentityType -> Bool
    == :: IdentityType -> IdentityType -> Bool
    $c/= :: IdentityType -> IdentityType -> Bool
    /= :: 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
    $ccompare :: IdentityType -> IdentityType -> Ordering
    compare :: IdentityType -> IdentityType -> Ordering
    $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
    >= :: IdentityType -> IdentityType -> Bool
    $cmax :: IdentityType -> IdentityType -> IdentityType
    max :: IdentityType -> IdentityType -> IdentityType
    $cmin :: IdentityType -> IdentityType -> IdentityType
    min :: IdentityType -> IdentityType -> 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
    $cshowsPrec :: Int -> IdentityType -> ShowS
    showsPrec :: Int -> IdentityType -> ShowS
    $cshow :: IdentityType -> String
    show :: IdentityType -> String
    $cshowList :: [IdentityType] -> ShowS
    showList :: [IdentityType] -> ShowS
    Show, Typeable)

    -- | ServiceConfiguration: 'SesConfiguration'
    instance SignQuery ListIdentities where
        type ServiceConfiguration ListIdentities = SesConfiguration
        signQuery :: forall queryType.
    ListIdentities
    -> ServiceConfiguration ListIdentities queryType
    -> SignatureData
    -> SignedQuery
    signQuery ListIdentities {Maybe Int
    Maybe Text
    Maybe IdentityType
    liIdentityType :: ListIdentities -> Maybe IdentityType
    liMaxItems :: ListIdentities -> Maybe Int
    liNextToken :: ListIdentities -> Maybe Text
    liIdentityType :: Maybe IdentityType
    liMaxItems :: Maybe Int
    liNextToken :: Maybe Text
    ..} =
            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
                              ]

    -- | The response sent back by Amazon SES after a
    -- 'ListIdentities' command.
    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
    $c== :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
    == :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
    $c/= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
    /= :: 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
    $ccompare :: ListIdentitiesResponse -> ListIdentitiesResponse -> Ordering
    compare :: ListIdentitiesResponse -> ListIdentitiesResponse -> Ordering
    $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
    >= :: ListIdentitiesResponse -> ListIdentitiesResponse -> Bool
    $cmax :: ListIdentitiesResponse
    -> ListIdentitiesResponse -> ListIdentitiesResponse
    max :: ListIdentitiesResponse
    -> ListIdentitiesResponse -> ListIdentitiesResponse
    $cmin :: ListIdentitiesResponse
    -> ListIdentitiesResponse -> ListIdentitiesResponse
    min :: ListIdentitiesResponse
    -> ListIdentitiesResponse -> 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
    $cshowsPrec :: Int -> ListIdentitiesResponse -> ShowS
    showsPrec :: Int -> ListIdentitiesResponse -> ShowS
    $cshow :: ListIdentitiesResponse -> String
    show :: ListIdentitiesResponse -> String
    $cshowList :: [ListIdentitiesResponse] -> ShowS
    showList :: [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 a. a -> Response SesMetadata a
    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)
    ListIdentitiesResponse -> ResourceT IO ListIdentitiesResponse
    forall a. a -> ResourceT IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return