module Aws.Ses.Commands.GetIdentityVerificationAttributes
    ( GetIdentityVerificationAttributes(..)
    , GetIdentityVerificationAttributesResponse(..)
    , IdentityVerificationAttributes(..)
    ) where

import Data.Text (Text)
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (listToMaybe)
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

-- | Get verification status for a list of email addresses and/or domains
data GetIdentityVerificationAttributes = GetIdentityVerificationAttributes [Text]
    deriving (GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
(GetIdentityVerificationAttributes
 -> GetIdentityVerificationAttributes -> Bool)
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes -> Bool)
-> Eq GetIdentityVerificationAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$c/= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
== :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$c== :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
Eq, Eq GetIdentityVerificationAttributes
Eq GetIdentityVerificationAttributes
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes -> Ordering)
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes -> Bool)
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes -> Bool)
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes -> Bool)
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes -> Bool)
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes)
-> (GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes
    -> GetIdentityVerificationAttributes)
-> Ord GetIdentityVerificationAttributes
GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Ordering
GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
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 :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
$cmin :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
max :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
$cmax :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
>= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$c>= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
> :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$c> :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
<= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$c<= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
< :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$c< :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
compare :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Ordering
$ccompare :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Ordering
$cp1Ord :: Eq GetIdentityVerificationAttributes
Ord, Int -> GetIdentityVerificationAttributes -> ShowS
[GetIdentityVerificationAttributes] -> ShowS
GetIdentityVerificationAttributes -> String
(Int -> GetIdentityVerificationAttributes -> ShowS)
-> (GetIdentityVerificationAttributes -> String)
-> ([GetIdentityVerificationAttributes] -> ShowS)
-> Show GetIdentityVerificationAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityVerificationAttributes] -> ShowS
$cshowList :: [GetIdentityVerificationAttributes] -> ShowS
show :: GetIdentityVerificationAttributes -> String
$cshow :: GetIdentityVerificationAttributes -> String
showsPrec :: Int -> GetIdentityVerificationAttributes -> ShowS
$cshowsPrec :: Int -> GetIdentityVerificationAttributes -> ShowS
Show, Typeable)


-- | ServiceConfiguration: 'SesConfiguration'
instance SignQuery GetIdentityVerificationAttributes where
    type ServiceConfiguration GetIdentityVerificationAttributes = SesConfiguration
    signQuery :: GetIdentityVerificationAttributes
-> ServiceConfiguration GetIdentityVerificationAttributes queryType
-> SignatureData
-> SignedQuery
signQuery (GetIdentityVerificationAttributes [Text]
identities) =
        [(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
"GetIdentityVerificationAttributes")
                     (ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. a -> [a] -> [a]
: [ByteString] -> [ByteString] -> [(ByteString, ByteString)]
forall a b. [a] -> [b] -> [(a, b)]
zip (Int -> ByteString
enumMember (Int -> ByteString) -> [Int] -> [ByteString]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Int
1..]) (Text -> ByteString
T.encodeUtf8 (Text -> ByteString) -> [Text] -> [ByteString]
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 (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show Int
n)

data IdentityVerificationAttributes = IdentityVerificationAttributes
    { IdentityVerificationAttributes -> Text
ivIdentity :: Text
    , IdentityVerificationAttributes -> Text
ivVerificationStatus :: Text
    , IdentityVerificationAttributes -> Maybe Text
ivVerificationToken :: Maybe Text
    }
    deriving (IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
(IdentityVerificationAttributes
 -> IdentityVerificationAttributes -> Bool)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes -> Bool)
-> Eq IdentityVerificationAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c/= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
== :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c== :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
Eq, Eq IdentityVerificationAttributes
Eq IdentityVerificationAttributes
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes -> Ordering)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes -> Bool)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes -> Bool)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes -> Bool)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes -> Bool)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes
    -> IdentityVerificationAttributes)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes
    -> IdentityVerificationAttributes)
-> Ord IdentityVerificationAttributes
IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Ordering
IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
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 :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
$cmin :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
max :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
$cmax :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
>= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c>= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
> :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c> :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
<= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c<= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
< :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c< :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
compare :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Ordering
$ccompare :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Ordering
$cp1Ord :: Eq IdentityVerificationAttributes
Ord, Int -> IdentityVerificationAttributes -> ShowS
[IdentityVerificationAttributes] -> ShowS
IdentityVerificationAttributes -> String
(Int -> IdentityVerificationAttributes -> ShowS)
-> (IdentityVerificationAttributes -> String)
-> ([IdentityVerificationAttributes] -> ShowS)
-> Show IdentityVerificationAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityVerificationAttributes] -> ShowS
$cshowList :: [IdentityVerificationAttributes] -> ShowS
show :: IdentityVerificationAttributes -> String
$cshow :: IdentityVerificationAttributes -> String
showsPrec :: Int -> IdentityVerificationAttributes -> ShowS
$cshowsPrec :: Int -> IdentityVerificationAttributes -> ShowS
Show, Typeable)


-- | The response sent back by Amazon SES after a
-- 'GetIdentityVerificationAttributes' command.
data GetIdentityVerificationAttributesResponse =
    GetIdentityVerificationAttributesResponse [IdentityVerificationAttributes]
    deriving (GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
(GetIdentityVerificationAttributesResponse
 -> GetIdentityVerificationAttributesResponse -> Bool)
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse -> Bool)
-> Eq GetIdentityVerificationAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$c/= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
== :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$c== :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
Eq, Eq GetIdentityVerificationAttributesResponse
Eq GetIdentityVerificationAttributesResponse
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse -> Ordering)
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse -> Bool)
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse -> Bool)
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse -> Bool)
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse -> Bool)
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse)
-> (GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse
    -> GetIdentityVerificationAttributesResponse)
-> Ord GetIdentityVerificationAttributesResponse
GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Ordering
GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
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 :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
$cmin :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
max :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
$cmax :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
>= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$c>= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
> :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$c> :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
<= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$c<= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
< :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$c< :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
compare :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Ordering
$ccompare :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Ordering
$cp1Ord :: Eq GetIdentityVerificationAttributesResponse
Ord, Int -> GetIdentityVerificationAttributesResponse -> ShowS
[GetIdentityVerificationAttributesResponse] -> ShowS
GetIdentityVerificationAttributesResponse -> String
(Int -> GetIdentityVerificationAttributesResponse -> ShowS)
-> (GetIdentityVerificationAttributesResponse -> String)
-> ([GetIdentityVerificationAttributesResponse] -> ShowS)
-> Show GetIdentityVerificationAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityVerificationAttributesResponse] -> ShowS
$cshowList :: [GetIdentityVerificationAttributesResponse] -> ShowS
show :: GetIdentityVerificationAttributesResponse -> String
$cshow :: GetIdentityVerificationAttributesResponse -> String
showsPrec :: Int -> GetIdentityVerificationAttributesResponse -> ShowS
$cshowsPrec :: Int -> GetIdentityVerificationAttributesResponse -> ShowS
Show, Typeable)


instance ResponseConsumer GetIdentityVerificationAttributes GetIdentityVerificationAttributesResponse where
    type ResponseMetadata GetIdentityVerificationAttributesResponse = SesMetadata
    responseConsumer :: Request
-> GetIdentityVerificationAttributes
-> IORef
     (ResponseMetadata GetIdentityVerificationAttributesResponse)
-> HTTPResponseConsumer GetIdentityVerificationAttributesResponse
responseConsumer Request
_ GetIdentityVerificationAttributes
_ =
      (Cursor
 -> Response SesMetadata GetIdentityVerificationAttributesResponse)
-> IORef SesMetadata
-> HTTPResponseConsumer GetIdentityVerificationAttributesResponse
forall a.
(Cursor -> Response SesMetadata a)
-> IORef SesMetadata -> HTTPResponseConsumer a
sesResponseConsumer ((Cursor
  -> Response SesMetadata GetIdentityVerificationAttributesResponse)
 -> IORef SesMetadata
 -> HTTPResponseConsumer GetIdentityVerificationAttributesResponse)
-> (Cursor
    -> Response SesMetadata GetIdentityVerificationAttributesResponse)
-> IORef SesMetadata
-> HTTPResponseConsumer GetIdentityVerificationAttributesResponse
forall a b. (a -> b) -> a -> b
$ \Cursor
cursor -> do
         let buildAttr :: Cursor -> m IdentityVerificationAttributes
buildAttr Cursor
e = do
               Text
ivIdentity <- String -> [Text] -> m Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Key" ([Text] -> m Text) -> [Text] -> m Text
forall a b. (a -> b) -> a -> b
$ Cursor
e Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$/ Text -> Cursor -> [Text]
elContent Text
"key"
               Text
ivVerificationStatus <- String -> [Text] -> m Text
forall (m :: * -> *) a. MonadThrow m => String -> [a] -> m a
force String
"Missing Verification Status" ([Text] -> m Text) -> [Text] -> m Text
forall a b. (a -> b) -> a -> b
$ Cursor
e
                   Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [Text]
elContent Text
"VerificationStatus"
               let ivVerificationToken :: Maybe Text
ivVerificationToken = [Text] -> Maybe Text
forall a. [a] -> Maybe a
listToMaybe ([Text] -> Maybe Text) -> [Text] -> Maybe Text
forall a b. (a -> b) -> a -> b
$ Cursor
e Cursor -> (Cursor -> [Text]) -> [Text]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Cursor -> [Text]
elContent Text
"VerificationToken"
               IdentityVerificationAttributes -> m IdentityVerificationAttributes
forall (m :: * -> *) a. Monad m => a -> m a
return IdentityVerificationAttributes :: Text -> Text -> Maybe Text -> IdentityVerificationAttributes
IdentityVerificationAttributes {Maybe Text
Text
ivVerificationToken :: Maybe Text
ivVerificationStatus :: Text
ivIdentity :: Text
ivVerificationToken :: Maybe Text
ivVerificationStatus :: Text
ivIdentity :: Text
..}
         [IdentityVerificationAttributes]
attributes <- [Response SesMetadata IdentityVerificationAttributes]
-> Response SesMetadata [IdentityVerificationAttributes]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence ([Response SesMetadata IdentityVerificationAttributes]
 -> Response SesMetadata [IdentityVerificationAttributes])
-> [Response SesMetadata IdentityVerificationAttributes]
-> Response SesMetadata [IdentityVerificationAttributes]
forall a b. (a -> b) -> a -> b
$ Cursor
cursor Cursor
-> (Cursor
    -> [Response SesMetadata IdentityVerificationAttributes])
-> [Response SesMetadata IdentityVerificationAttributes]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
laxElement Text
"entry" Axis
-> (Cursor -> Response SesMetadata IdentityVerificationAttributes)
-> Cursor
-> [Response SesMetadata IdentityVerificationAttributes]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Cursor -> Response SesMetadata IdentityVerificationAttributes
forall (m :: * -> *).
MonadThrow m =>
Cursor -> m IdentityVerificationAttributes
buildAttr
         GetIdentityVerificationAttributesResponse
-> Response SesMetadata GetIdentityVerificationAttributesResponse
forall (m :: * -> *) a. Monad m => a -> m a
return (GetIdentityVerificationAttributesResponse
 -> Response SesMetadata GetIdentityVerificationAttributesResponse)
-> GetIdentityVerificationAttributesResponse
-> Response SesMetadata GetIdentityVerificationAttributesResponse
forall a b. (a -> b) -> a -> b
$ [IdentityVerificationAttributes]
-> GetIdentityVerificationAttributesResponse
GetIdentityVerificationAttributesResponse [IdentityVerificationAttributes]
attributes


instance Transaction GetIdentityVerificationAttributes GetIdentityVerificationAttributesResponse where

instance AsMemoryResponse GetIdentityVerificationAttributesResponse where
    type MemoryResponse GetIdentityVerificationAttributesResponse = GetIdentityVerificationAttributesResponse
    loadToMemory :: GetIdentityVerificationAttributesResponse
-> ResourceT
     IO (MemoryResponse GetIdentityVerificationAttributesResponse)
loadToMemory = GetIdentityVerificationAttributesResponse
-> ResourceT
     IO (MemoryResponse GetIdentityVerificationAttributesResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return