Last active
March 6, 2018 23:32
-
-
Save v0d1ch/9f0b27d24032e7bfcc677dc2534ea370 to your computer and use it in GitHub Desktop.
aws ses list identities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Helper.Aws | |
(listAllEmails | |
) where | |
import Control.Lens ((&), (.~)) | |
import Control.Monad.Trans.AWS (Error, runAWST, trying, _Error) | |
import Data.ByteString (ByteString) | |
import Network.AWS (Region (NorthVirginia), newEnv, runResourceT, send, within) | |
import Network.AWS.Auth (AccessKey (..), Credentials (FromKeys), SecretKey (..)) | |
import Network.AWS.SES (IdentityType (..)) | |
import Network.AWS.SES.ListIdentities (ListIdentitiesResponse, liIdentityType, | |
listIdentities) | |
import Prelude (Either (..), IO, Maybe (..), ($), (.)) | |
awsAccessKey :: ByteString | |
awsAccessKey = "************" | |
awsSecretKey :: ByteString | |
awsSecretKey = "************" | |
listAllEmails :: IO (Either Error ListIdentitiesResponse) | |
listAllEmails = do | |
env <- newEnv $ FromKeys (AccessKey awsAccessKey) (SecretKey awsSecretKey) | |
trying _Error (runResourceT . runAWST env . within NorthVirginia $ | |
send (listIdentities & liIdentityType .~ (Just EmailAddress) )) :: IO (Either Error ListIdentitiesResponse) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment