Closed fridgerator closed 7 years ago
I'm curious if this is something you've tried or how it can be achieved, I keep getting error code 400 - BAD REQUEST
I'm able to use this similar code to retrieve private files from S3
Here is what i'm currently doing:
SES_REGION = "us-west-2" SES_HOST = "email.#{SES_REGION}.amazonaws.com" KEY = ENV["AWS_ACCESS_KEY"] SECRET = ENV["AWS_SECRET_KEY"] private def creds Awscr::Signer::Credentials.new(KEY, SECRET) end private def ses_scope Awscr::Signer::Scope.new(SES_REGION, "ses") end url = String.build do |io| HTTP::Params.from_hash({ "Action" => "SendEmail", "Source" => "test@test.com", "Destination.ToAddresses.member.1" => "test@test.com", "Message.Subject.Data" => "test", "Message.Body.Text.Data" => "test", }).to_s(io) end client = HTTP::Client.new(SES_HOST, 443, true) client.before_request do |request| request.headers["Host"] = SES_HOST signer = Awscr::Signer::V4.new(request, ses_scope, creds) signer.sign end resp = client.get(url)
ugh, url just needs to be the full url: url = "https://#{SES_HOST}/?#{params}"
url
url = "https://#{SES_HOST}/?#{params}"
its working
I'm curious if this is something you've tried or how it can be achieved, I keep getting error code 400 - BAD REQUEST
I'm able to use this similar code to retrieve private files from S3
Here is what i'm currently doing: