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

address methods for rackspace servers

This commit is contained in:
Wesley Beary 2009-11-01 23:34:21 -08:00
parent 5ae5837ab8
commit 6184d2c54d
8 changed files with 169 additions and 2 deletions

View file

@ -6,6 +6,9 @@ unless Fog.mocking?
# Get details about a server
#
# ==== Parameters
# * server_id<~Integer> - Id of server to get details for
#
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
@ -21,11 +24,11 @@ unless Fog.mocking?
# * 'name<~String> - Name of server
# * 'progress'<~Integer> - Progress through current status
# * 'status'<~String> - Current server status
def get_server_details(id)
def get_server_details(server_id)
request(
:expects => 200,
:method => 'GET',
:path => "servers/#{id}.json"
:path => "servers/#{server_id}.json"
)
end

View file

@ -0,0 +1,43 @@
unless Fog.mocking?
module Fog
module Rackspace
class Servers
# List all server addresses
#
# ==== Parameters
# * server_id<~Integer> - Id of server to list addresses for
#
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * 'addresses'<~Array>:
# * 'public'<~Array> - Public ip addresses
# * 'private'<~Array> - Private ip addresses
def list_addresses
request(
:expects => [200, 203],
:method => 'GET',
:path => "servers/#{server_id}/ips.json"
)
end
end
end
end
else
module Fog
module Rackspace
class Servers
def list_addresses
end
end
end
end
end

View file

@ -0,0 +1,41 @@
unless Fog.mocking?
module Fog
module Rackspace
class Servers
# List private server addresses
#
# ==== Parameters
# * server_id<~Integer> - Id of server to list addresses for
#
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * 'private'<~Array> - Public ip addresses
def list_private_addresses
request(
:expects => [200, 203],
:method => 'GET',
:path => "servers/#{server_id}/ips/private.json"
)
end
end
end
end
else
module Fog
module Rackspace
class Servers
def list_private_addresses
end
end
end
end
end

View file

@ -0,0 +1,41 @@
unless Fog.mocking?
module Fog
module Rackspace
class Servers
# List public server addresses
#
# ==== Parameters
# * server_id<~Integer> - Id of server to list addresses for
#
# ==== Returns
# * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * 'public'<~Array> - Public ip addresses
def list_public_addresses
request(
:expects => [200, 203],
:method => 'GET',
:path => "servers/#{server_id}/ips/public.json"
)
end
end
end
end
else
module Fog
module Rackspace
class Servers
def list_public_addresses
end
end
end
end
end

View file

@ -11,6 +11,9 @@ module Fog
load "fog/rackspace/requests/servers/delete_image.rb"
load "fog/rackspace/requests/servers/delete_server.rb"
load "fog/rackspace/requests/servers/get_server_details.rb"
load "fog/rackspace/requests/servers/list_addresses.rb"
load "fog/rackspace/requests/servers/list_private_addresses.rb"
load "fog/rackspace/requests/servers/list_public_addresses.rb"
load "fog/rackspace/requests/servers/list_flavors.rb"
load "fog/rackspace/requests/servers/list_images.rb"
load "fog/rackspace/requests/servers/list_images_detail.rb"

View file

@ -0,0 +1,12 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Servers.list_addresses' do
describe 'success' do
it "should return proper attributes" do
pending
p servers.list_addresses(server_id)
end
end
end

View file

@ -0,0 +1,12 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Servers.list_private_addresses' do
describe 'success' do
it "should return proper attributes" do
pending
p servers.list_private_addresses(server_id)
end
end
end

View file

@ -0,0 +1,12 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Servers.list_public_addresses' do
describe 'success' do
it "should return proper attributes" do
pending
p servers.list_public_addresses(server_id)
end
end
end