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:
parent
734fbfaf43
commit
f2f5b68645
5 changed files with 92 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
29
lib/fog/brightbox/requests/compute/update_load_balancer.rb
Normal file
29
lib/fog/brightbox/requests/compute/update_load_balancer.rb
Normal 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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue