1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[eucalyptus] clean up some stuff to allow eucalyptus to use AWS::Compute

This commit is contained in:
geemus 2010-09-29 17:53:32 -07:00
parent dfd30e521f
commit fe480bbaa3
5 changed files with 37 additions and 14 deletions

View file

@ -37,7 +37,7 @@ module Fog
body << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')}&"
end
end
string_to_sign = "POST\n#{options[:host]}\n/\n" << body.chop
string_to_sign = "POST\n#{options[:host]}\n#{options[:path]}\n" << body.chop
signed_string = options[:hmac].sign(string_to_sign)
body << "Signature=#{CGI.escape(Base64.encode64(signed_string).chomp!).gsub(/\+/, '%20')}"

View file

@ -153,8 +153,15 @@ module Fog
@aws_access_key_id = options[:aws_access_key_id]
@aws_secret_access_key = options[:aws_secret_access_key]
@hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
options[:region] ||= 'us-east-1'
@host = options[:host] || case options[:region]
if @endpoint = options[:endpoint]
endpoint = URI.parse(@endpoint)
@host = endpoint.host
@path = endpoint.path
@port = endpoint.port
@scheme = endpoint.scheme
else
options[:region] ||= 'us-east-1'
@host = options[:host] || case options[:region]
when 'ap-southeast-1'
'ec2.ap-southeast-1.amazonaws.com'
when 'eu-west-1'
@ -166,9 +173,11 @@ module Fog
else
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
end
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
@path = options[:path] || '/'
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
end
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent])
end
def reload
@ -187,6 +196,7 @@ module Fog
:aws_access_key_id => @aws_access_key_id,
:hmac => @hmac,
:host => @host,
:path => @path,
:version => '2010-08-31'
}
)

View file

@ -59,9 +59,10 @@ module Fog
else
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
end
@path = options[:path] || '/'
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent])
end
def reload
@ -80,6 +81,7 @@ module Fog
:aws_access_key_id => @aws_access_key_id,
:hmac => @hmac,
:host => @host,
:path => @path,
:version => '2009-11-25'
}
)

View file

@ -63,9 +63,10 @@ module Fog
@hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
@host = options[:host] || 'sdb.amazonaws.com'
@nil_string = options[:nil_string]|| 'nil'
@path = options[:path] || '/'
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent])
end
private
@ -137,6 +138,7 @@ module Fog
:aws_access_key_id => @aws_access_key_id,
:hmac => @hmac,
:host => @host,
:path => @path,
:version => '2009-04-15'
}
)

View file

@ -138,8 +138,15 @@ module Fog
@aws_access_key_id = options[:aws_access_key_id]
@aws_secret_access_key = options[:aws_secret_access_key]
@hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
options[:region] ||= 'us-east-1'
@host = options[:host] || case options[:region]
if @endpoint = options[:endpoint]
endpoint = URI.parse(@endpoint)
@host = endpoint.host
@path = endpoint.path
@port = endpoint.port
@scheme = endpoint.scheme
else
options[:region] ||= 'us-east-1'
@host = options[:host] || case options[:region]
when 'eu-west-1'
's3-eu-west-1.amazonaws.com'
when 'us-east-1'
@ -151,9 +158,11 @@ module Fog
else
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
end
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent] || true)
@path = options[:path] || '/'
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
end
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent] || true)
end
def reload
@ -213,7 +222,7 @@ DATA
subdomain = nil
end
canonical_resource = "/"
canonical_resource = @path
unless subdomain.nil? || subdomain == @host
canonical_resource << "#{CGI.escape(subdomain).downcase}/"
end