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 Prelude

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
$c== :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
== :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$c/= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
/= :: 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
$ccompare :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Ordering
compare :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Ordering
$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
>= :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes -> Bool
$cmax :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
max :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
$cmin :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
min :: GetIdentityVerificationAttributes
-> GetIdentityVerificationAttributes
-> 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
$cshowsPrec :: Int -> GetIdentityVerificationAttributes -> ShowS
showsPrec :: Int -> GetIdentityVerificationAttributes -> ShowS
$cshow :: GetIdentityVerificationAttributes -> String
show :: GetIdentityVerificationAttributes -> String
$cshowList :: [GetIdentityVerificationAttributes] -> ShowS
showList :: [GetIdentityVerificationAttributes] -> ShowS
Show, Typeable)


-- | ServiceConfiguration: 'SesConfiguration'
instance SignQuery GetIdentityVerificationAttributes where
    type ServiceConfiguration GetIdentityVerificationAttributes = SesConfiguration
    signQuery :: forall queryType.
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
$c== :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
== :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c/= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
/= :: 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
$ccompare :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Ordering
compare :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Ordering
$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
>= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$cmax :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
max :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
$cmin :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> IdentityVerificationAttributes
min :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> 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
$cshowsPrec :: Int -> IdentityVerificationAttributes -> ShowS
showsPrec :: Int -> IdentityVerificationAttributes -> ShowS
$cshow :: IdentityVerificationAttributes -> String
show :: IdentityVerificationAttributes -> String
$cshowList :: [IdentityVerificationAttributes] -> ShowS
showList :: [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
$c== :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
== :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$c/= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
/= :: 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
$ccompare :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Ordering
compare :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Ordering
$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
>= :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse -> Bool
$cmax :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
max :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
$cmin :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
min :: GetIdentityVerificationAttributesResponse
-> GetIdentityVerificationAttributesResponse
-> 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
$cshowsPrec :: Int -> GetIdentityVerificationAttributesResponse -> ShowS
showsPrec :: Int -> GetIdentityVerificationAttributesResponse -> ShowS
$cshow :: GetIdentityVerificationAttributesResponse -> String
show :: GetIdentityVerificationAttributesResponse -> String
$cshowList :: [GetIdentityVerificationAttributesResponse] -> ShowS
showList :: [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 a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return IdentityVerificationAttributes {Maybe Text
Text
ivIdentity :: Text
ivVerificationStatus :: Text
ivVerificationToken :: Maybe Text
ivIdentity :: Text
ivVerificationStatus :: Text
ivVerificationToken :: Maybe Text
..}
         [IdentityVerificationAttributes]
attributes <- [Response SesMetadata IdentityVerificationAttributes]
-> Response SesMetadata [IdentityVerificationAttributes]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
forall (m :: * -> *) a. Monad m => [m a] -> m [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 a. a -> Response SesMetadata a
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)
GetIdentityVerificationAttributesResponse
-> ResourceT IO GetIdentityVerificationAttributesResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return