Skip to content

Instantly share code, notes, and snippets.

@v0d1ch
Last active March 6, 2018 23:32
Show Gist options
  • Save v0d1ch/9f0b27d24032e7bfcc677dc2534ea370 to your computer and use it in GitHub Desktop.
Save v0d1ch/9f0b27d24032e7bfcc677dc2534ea370 to your computer and use it in GitHub Desktop.
aws ses list identities
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