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

[brightbox] Extended LoadBalancer requests

This commit is contained in:
Paul Thornthwaite 2010-12-15 18:05:33 +00:00
parent 734fbfaf43
commit f2f5b68645
5 changed files with 92 additions and 1 deletions

View file

@ -25,6 +25,7 @@ module Fog
model :user
request_path 'fog/brightbox/requests/compute'
request :add_nodes_load_balancer
request :create_api_client
request :create_cloud_ip
request :create_image
@ -54,6 +55,7 @@ module Fog
request :list_users
request :list_zones
request :map_cloud_ip
request :remove_nodes_load_balancer
request :reset_ftp_password_account
request :resize_server
request :shutdown_server
@ -64,6 +66,7 @@ module Fog
request :update_account
request :update_api_client
request :update_image
request :update_load_balancer
request :update_server
request :update_user

View file

@ -0,0 +1,28 @@
module Fog
module Brightbox
class Compute
class Real
def add_nodes_load_balancer(identifier, options = {})
return nil if identifier.nil? || identifier == ""
request(
:expects => [202],
:method => 'POST',
:path => "/1.0/load_balancers/#{identifier}/add_nodes",
:headers => {"Content-Type" => "application/json"},
:body => options.to_json
)
end
end
class Mock
def add_nodes_load_balancer(identifier, options = {})
Fog::Mock.not_implemented
end
end
end
end
end

View file

@ -0,0 +1,28 @@
module Fog
module Brightbox
class Compute
class Real
def remove_nodes_load_balancer(identifier, options = {})
return nil if identifier.nil? || identifier == ""
request(
:expects => [202],
:method => 'POST',
:path => "/1.0/load_balancers/#{identifier}/remove_nodes",
:headers => {"Content-Type" => "application/json"},
:body => options.to_json
)
end
end
class Mock
def remove_nodes_load_balancer(identifier, options = {})
Fog::Mock.not_implemented
end
end
end
end
end

View file

@ -0,0 +1,29 @@
module Fog
module Brightbox
class Compute
class Real
def update_load_balancer(identifier, options = {})
return nil if identifier.nil? || identifier == ""
return nil if options.empty? || options.nil?
request(
:expects => [202],
:method => 'PUT',
:path => "/1.0/load_balancers/#{identifier}",
:headers => {"Content-Type" => "application/json"},
:body => options.to_json
)
end
end
class Mock
def update_load_balancer(identifier, options = {})
Fog::Mock.not_implemented
end
end
end
end
end

View file

@ -2,7 +2,8 @@ Shindo.tests('Brightbox::Compute | load balancer requests', ['brightbox']) do
tests('success') do
node_id = Brightbox[:compute].list_servers.first["id"]
@node = Brightbox[:compute].servers.create(:image_id => Brightbox::Compute::TestSupport::IMAGE_IDENTIFER)
node_id = @node.id
creation_args = {
:nodes => [{
@ -39,6 +40,8 @@ Shindo.tests('Brightbox::Compute | load balancer requests', ['brightbox']) do
Brightbox[:compute].destroy_load_balancer(@load_balancer_id)
end
@node.destroy
end
tests('failure') do