Module: Fog::Rackspace

Extended by:
Provider
Defined in:
lib/fog/rackspace.rb,
lib/fog/rackspace/files.rb,
lib/fog/rackspace/compute.rb,
lib/fog/rackspace/servers.rb,
lib/fog/rackspace/storage.rb,
lib/fog/rackspace/models/storage/file.rb,
lib/fog/rackspace/models/compute/image.rb,
lib/fog/rackspace/models/storage/files.rb,
lib/fog/rackspace/models/compute/flavor.rb,
lib/fog/rackspace/models/compute/images.rb,
lib/fog/rackspace/models/compute/server.rb,
lib/fog/rackspace/models/compute/flavors.rb,
lib/fog/rackspace/models/compute/servers.rb,
lib/fog/rackspace/models/storage/directory.rb,
lib/fog/rackspace/models/storage/directories.rb,
lib/fog/rackspace/requests/storage/get_object.rb,
lib/fog/rackspace/requests/storage/put_object.rb,
lib/fog/rackspace/requests/compute/list_images.rb,
lib/fog/rackspace/requests/storage/head_object.rb,
lib/fog/rackspace/requests/compute/create_image.rb,
lib/fog/rackspace/requests/compute/delete_image.rb,
lib/fog/rackspace/requests/compute/list_flavors.rb,
lib/fog/rackspace/requests/compute/list_servers.rb,
lib/fog/rackspace/requests/compute/create_server.rb,
lib/fog/rackspace/requests/compute/delete_server.rb,
lib/fog/rackspace/requests/compute/reboot_server.rb,
lib/fog/rackspace/requests/compute/update_server.rb,
lib/fog/rackspace/requests/storage/delete_object.rb,
lib/fog/rackspace/requests/storage/get_container.rb,
lib/fog/rackspace/requests/storage/put_container.rb,
lib/fog/rackspace/requests/compute/list_addresses.rb,
lib/fog/rackspace/requests/storage/get_containers.rb,
lib/fog/rackspace/requests/storage/head_container.rb,
lib/fog/rackspace/requests/storage/head_containers.rb,
lib/fog/rackspace/requests/storage/delete_container.rb,
lib/fog/rackspace/requests/compute/get_image_details.rb,
lib/fog/rackspace/requests/compute/get_flavor_details.rb,
lib/fog/rackspace/requests/compute/get_server_details.rb,
lib/fog/rackspace/requests/compute/list_images_detail.rb,
lib/fog/rackspace/requests/compute/list_flavors_detail.rb,
lib/fog/rackspace/requests/compute/list_servers_detail.rb,
lib/fog/rackspace/requests/compute/list_public_addresses.rb,
lib/fog/rackspace/requests/compute/list_private_addresses.rb

Defined Under Namespace

Classes: Compute, Files, Servers, Storage

Class Method Summary collapse

Methods included from Provider

service, service_path, services

Class Method Details

.authenticate(options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/rackspace.rb', line 12

def self.authenticate(options)
  rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"
  connection = Fog::Connection.new("https://" + rackspace_auth_url)
  @rackspace_api_key  = options[:rackspace_api_key]
  @rackspace_username = options[:rackspace_username]
  response = connection.request({
    :expects  => 204,
    :headers  => {
      'X-Auth-Key'  => @rackspace_api_key,
      'X-Auth-User' => @rackspace_username
    },
    :host     => rackspace_auth_url,
    :method   => 'GET',
    :path     => 'v1.0'
  })
  response.headers.reject do |key, value|
    !['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
  end
end