diff --git a/lib/fog/storm_on_demand/compute.rb b/lib/fog/storm_on_demand/compute.rb index 1ab28f5c1..5a4fbefde 100644 --- a/lib/fog/storm_on_demand/compute.rb +++ b/lib/fog/storm_on_demand/compute.rb @@ -35,18 +35,32 @@ module Fog request :get_server request :create_server request :resize_server + request :remove_balancer_node request :add_balancer_node + request :add_balancer_service + request :remove_balancer_service + request :check_balancer_available + request :create_balancer + request :delete_balancer + request :update_balancer + request :get_balancer_details request :list_balancers + request :get_balancer_possible_nodes + request :get_balancer_strategies + request :list_configs request :get_config_details + request :list_templates + request :list_images request :create_image request :delete_image request :get_image_details request :update_image request :restore_image + request :get_stats request :list_private_ips diff --git a/lib/fog/storm_on_demand/models/compute/balancer.rb b/lib/fog/storm_on_demand/models/compute/balancer.rb index 64bb35a3e..623964b26 100644 --- a/lib/fog/storm_on_demand/models/compute/balancer.rb +++ b/lib/fog/storm_on_demand/models/compute/balancer.rb @@ -8,14 +8,16 @@ module Fog identity :uniq_id - attribute :vip - attribute :price + attribute :capabilities attribute :name + attribute :nodes + attribute :region_id + attribute :services attribute :session_persistence + attribute :ssl_includes attribute :ssl_termination attribute :strategy - attribute :nodes - attribute :services + attribute :vip def initialize(attributes={}) super @@ -31,8 +33,28 @@ module Fog service.remove_balancer_node({:uniq_id => identity}.merge!(options)) end + def add_service(options) + requires :identity + service.add_balancer_service({:uniq_id => identity}.merge!(options)) end + def remove_service(options) + requires :identity + service.remove_balancer_service({:uniq_id => identity}.merge!(options)) + end + + def destroy + requires :identity + service.delete_balancer({:uniq_id => identity}) + end + + def update(options) + requires :identity + service.update_balancer({:uniq_id => identity}.merge!(options)) + end + + end + end end end diff --git a/lib/fog/storm_on_demand/models/compute/balancers.rb b/lib/fog/storm_on_demand/models/compute/balancers.rb index 9a8d6f510..d558a18ae 100644 --- a/lib/fog/storm_on_demand/models/compute/balancers.rb +++ b/lib/fog/storm_on_demand/models/compute/balancers.rb @@ -9,11 +9,34 @@ module Fog model Fog::Compute::StormOnDemand::Balancer - def all - data = service.list_balancers.body['items'] + def all(options={}) + data = service.list_balancers(options).body['items'] load(data) end + def available(name) + avail = service.check_balancer_available(:name => name).body + avail[:available].to_i == 1 ? true : false + end + + def create(options) + balancer = service.create_balancer(options).body + new(balancer) + end + + def get(uniq_id) + balancer = service.get_balancer_details(:uniq_id => uniq_id).body + new(balancer) + end + + def possible_nodes(options={}) + service.get_balancer_possible_nodes(options).body[:items] + end + + def strategies + service.get_balancer_strategies.body[:strategies] + end + end end diff --git a/lib/fog/storm_on_demand/requests/compute/add_balancer_node.rb b/lib/fog/storm_on_demand/requests/compute/add_balancer_node.rb index 450dbbd14..c1a197ba8 100644 --- a/lib/fog/storm_on_demand/requests/compute/add_balancer_node.rb +++ b/lib/fog/storm_on_demand/requests/compute/add_balancer_node.rb @@ -5,7 +5,7 @@ module Fog def add_balancer_node(options = {}) request( - :path => "/network/loadbalancer/addnode", + :path => "/Network/LoadBalancer/addNode", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/add_balancer_service.rb b/lib/fog/storm_on_demand/requests/compute/add_balancer_service.rb new file mode 100644 index 000000000..d8ef30165 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/add_balancer_service.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def add_balancer_service(options={}) + request( + :path => '/Network/LoadBalancer/addService', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/check_balancer_available.rb b/lib/fog/storm_on_demand/requests/compute/check_balancer_available.rb new file mode 100644 index 000000000..14832a6ac --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/check_balancer_available.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def check_balancer_available(options={}) + request( + :path => '/Network/LoadBalancer/available', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/create_balancer.rb b/lib/fog/storm_on_demand/requests/compute/create_balancer.rb new file mode 100644 index 000000000..8fb9903b1 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/create_balancer.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def create_balancer(options={}) + request( + :path => '/Network/LoadBalancer/create', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/delete_balancer.rb b/lib/fog/storm_on_demand/requests/compute/delete_balancer.rb new file mode 100644 index 000000000..5f85cfc1f --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/delete_balancer.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def delete_balancer(options={}) + request( + :path => '/Network/LoadBalancer/delete', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/get_balancer_details.rb b/lib/fog/storm_on_demand/requests/compute/get_balancer_details.rb new file mode 100644 index 000000000..e85f146ee --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/get_balancer_details.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def get_balancer_details(options={}) + request( + :path => '/Network/LoadBalancer/details', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/get_balancer_possible_nodes.rb b/lib/fog/storm_on_demand/requests/compute/get_balancer_possible_nodes.rb new file mode 100644 index 000000000..3d360a35f --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/get_balancer_possible_nodes.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def get_balancer_possible_nodes(options={}) + request( + :path => '/Network/LoadBalancer/possibleNodes', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/get_balancer_strategies.rb b/lib/fog/storm_on_demand/requests/compute/get_balancer_strategies.rb new file mode 100644 index 000000000..a8fdbd8b7 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/get_balancer_strategies.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def get_balancer_strategies(options={}) + request( + :path => '/Network/LoadBalancer/strategies', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/list_balancers.rb b/lib/fog/storm_on_demand/requests/compute/list_balancers.rb index e692dcdad..8f1497eb5 100644 --- a/lib/fog/storm_on_demand/requests/compute/list_balancers.rb +++ b/lib/fog/storm_on_demand/requests/compute/list_balancers.rb @@ -5,7 +5,7 @@ module Fog def list_balancers(options = {}) request( - :path => "/network/loadbalancer/list", + :path => "/Network/LoadBalancer/list", :body => Fog::JSON.encode(options) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/remove_balancer_node.rb b/lib/fog/storm_on_demand/requests/compute/remove_balancer_node.rb index 571198344..a080e9f4a 100644 --- a/lib/fog/storm_on_demand/requests/compute/remove_balancer_node.rb +++ b/lib/fog/storm_on_demand/requests/compute/remove_balancer_node.rb @@ -5,7 +5,7 @@ module Fog def remove_balancer_node(options = {}) request( - :path => "/network/loadbalancer/removenode", + :path => "/Network/LoadBalancer/removeNode", :body => Fog::JSON.encode({:params => options}) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/remove_balancer_service.rb b/lib/fog/storm_on_demand/requests/compute/remove_balancer_service.rb new file mode 100644 index 000000000..8bda56422 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/remove_balancer_service.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def remove_balancer_service(options={}) + request( + :path => '/Network/LoadBalancer/removeService', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/update_balancer.rb b/lib/fog/storm_on_demand/requests/compute/update_balancer.rb new file mode 100644 index 000000000..e05f84987 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/update_balancer.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def update_balancer(options={}) + request( + :path => '/Network/LoadBalancer/update', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end