2009-10-10 22:05:17 -04:00
|
|
|
module Fog
|
|
|
|
module Rackspace
|
|
|
|
|
|
|
|
def self.reload
|
2009-10-11 16:37:25 -04:00
|
|
|
load 'fog/rackspace/files.rb'
|
2009-10-10 22:05:17 -04:00
|
|
|
load 'fog/rackspace/servers.rb'
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.authenticate(options)
|
|
|
|
connection = Fog::Connection.new("https://auth.api.rackspacecloud.com")
|
|
|
|
response = connection.request({
|
|
|
|
:expects => 204,
|
|
|
|
:headers => {
|
|
|
|
'X-Auth-Key' => options[:rackspace_api_key],
|
|
|
|
'X-Auth-User' => options[:rackspace_username]
|
|
|
|
},
|
|
|
|
:host => 'auth.api.rackspacecloud.com',
|
|
|
|
:method => 'GET',
|
2009-10-15 18:06:50 -04:00
|
|
|
:path => 'v1.0'
|
2009-10-10 22:05:17 -04:00
|
|
|
})
|
|
|
|
response.headers.reject do |key, value|
|
|
|
|
!['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Fog::Rackspace.reload
|