From beb91525c06ba27b151c000a96d53aad72bcee27 Mon Sep 17 00:00:00 2001 From: Daniel Schweighoefer Date: Mon, 19 Dec 2011 16:07:37 +0100 Subject: [PATCH] fix for free choice of region --- lib/fog/aws/emr.rb | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/fog/aws/emr.rb b/lib/fog/aws/emr.rb index 771a9b301..cfcce8f24 100644 --- a/lib/fog/aws/emr.rb +++ b/lib/fog/aws/emr.rb @@ -26,10 +26,10 @@ module Fog # collection :snapshots # model :parameter_group # collection :parameter_groups - # + # # model :parameter # collection :parameters - # + # # model :security_group # collection :security_groups @@ -68,7 +68,24 @@ module Fog @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) options[:region] ||= 'us-east-1' - @host = options[:host] || 'elasticmapreduce.amazonaws.com' + @host = options[:host] || case options[:region] + when 'ap-northeast-1' + 'elasticmapreduce.ap-northeast-1.amazonaws.com' + when 'ap-southeast-1' + 'elasticmapreduce.ap-southeast-1.amazonaws.com' + when 'eu-west-1' + 'elasticmapreduce.eu-west-1.amazonaws.com' + when 'us-east-1' + 'elasticmapreduce.us-east-1.amazonaws.com' + when 'us-west-1' + 'elasticmapreduce.us-west-1.amazonaws.com' + when 'us-west-2' + 'elasticmapreduce.us-west-2.amazonaws.com' + when 'sa-east-1' + 'elasticmapreduce.sa-east-1.amazonaws.com' + else + raise ArgumentError, "Unknown region: #{options[:region].inspect}" + end @path = options[:path] || '/' @persistent = options[:persistent] || false @port = options[:port] || 443