Module: Fog::Rackspace

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

Defined Under Namespace

Modules: Files, Servers

Class Method Summary collapse

Class Method Details

.authenticate(options) ⇒ Object


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

def self.authenticate(options)
  unless @rackspace_api_key = options[:rackspace_api_key]
    raise ArgumentError.new('rackspace_api_key is required to access rackspace')
  end
  unless @rackspace_username = options[:rackspace_username]
    raise ArgumentError.new('rackspace_username is required to access rackspace')
  end
  connection = Fog::Connection.new("https://auth.api.rackspacecloud.com")
  response = connection.request({
    :expects  => 204,
    :headers  => {
      'X-Auth-Key'  => @rackspace_api_key,
      'X-Auth-User' => @rackspace_username
    },
    :host     => 'auth.api.rackspacecloud.com',
    :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