mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[stormondemand|compute] Add all server APIs
This commit is contained in:
parent
a9a9ad49cd
commit
4e2a7aa453
15 changed files with 133 additions and 19 deletions
|
@ -35,6 +35,11 @@ module Fog
|
||||||
request :get_server
|
request :get_server
|
||||||
request :create_server
|
request :create_server
|
||||||
request :resize_server
|
request :resize_server
|
||||||
|
request :server_history
|
||||||
|
request :shutdown_server
|
||||||
|
request :start_server
|
||||||
|
request :server_status
|
||||||
|
request :update_server
|
||||||
|
|
||||||
request :remove_balancer_node
|
request :remove_balancer_node
|
||||||
request :add_balancer_node
|
request :add_balancer_node
|
||||||
|
|
|
@ -8,6 +8,7 @@ module Fog
|
||||||
identity :uniq_id
|
identity :uniq_id
|
||||||
|
|
||||||
attribute :accnt
|
attribute :accnt
|
||||||
|
attribute :active
|
||||||
attribute :backup_enabled
|
attribute :backup_enabled
|
||||||
attribute :backup_plan
|
attribute :backup_plan
|
||||||
attribute :backup_quota
|
attribute :backup_quota
|
||||||
|
@ -20,11 +21,10 @@ module Fog
|
||||||
attribute :ip
|
attribute :ip
|
||||||
attribute :ip_count
|
attribute :ip_count
|
||||||
attribute :manage_level
|
attribute :manage_level
|
||||||
attribute :subaccnt
|
|
||||||
attribute :template
|
attribute :template
|
||||||
attribute :template_description
|
attribute :template_description
|
||||||
|
attribute :type
|
||||||
attribute :zone
|
attribute :zone
|
||||||
attribute :active
|
|
||||||
|
|
||||||
attr_writer :password
|
attr_writer :password
|
||||||
|
|
||||||
|
@ -32,11 +32,6 @@ module Fog
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(options)
|
|
||||||
data = service.create_server(options).body['servers']
|
|
||||||
load(data)
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :identity
|
requires :identity
|
||||||
service.delete_server(:uniq_id => identity)
|
service.delete_server(:uniq_id => identity)
|
||||||
|
@ -47,9 +42,9 @@ module Fog
|
||||||
active == 1
|
active == 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def reboot
|
def reboot(options={})
|
||||||
requires :identity
|
requires :identity
|
||||||
service.reboot_server(:uniq_id => identity)
|
service.reboot_server({:uniq_id => identity}.merge!(options))
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,11 +53,40 @@ module Fog
|
||||||
service.clone_server({:uniq_id => identity}.merge!(options))
|
service.clone_server({:uniq_id => identity}.merge!(options))
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def resize(options)
|
def resize(options)
|
||||||
requires :identity
|
requires :identity
|
||||||
service.resize_server({:uniq_id => identity}.merge!(options))
|
service.resize_server({:uniq_id => identity}.merge!(options))
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def history(options={})
|
||||||
|
requires :identity
|
||||||
|
res = service.server_history({:uniq_id => identity}.merge!(options))
|
||||||
|
res[:items]
|
||||||
|
end
|
||||||
|
|
||||||
|
def shutdown(options={})
|
||||||
|
requires :identity
|
||||||
|
service.shutdown_server({:uniq_id => identity}.merge!(options))
|
||||||
|
end
|
||||||
|
|
||||||
|
def start
|
||||||
|
reqwuires :identity
|
||||||
|
service.start_server({:uniq_id => identity})
|
||||||
|
end
|
||||||
|
|
||||||
|
def status
|
||||||
|
requires :identity
|
||||||
|
service.server_status({:uniq_id => identity}).body
|
||||||
|
end
|
||||||
|
|
||||||
|
def update(options)
|
||||||
|
requires :identity
|
||||||
|
s = service.update_server({:uniq_id => identity}.merge!(options))
|
||||||
|
load(s)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,8 +9,8 @@ module Fog
|
||||||
|
|
||||||
model Fog::Compute::StormOnDemand::Server
|
model Fog::Compute::StormOnDemand::Server
|
||||||
|
|
||||||
def all
|
def all(options={})
|
||||||
data = service.list_servers.body['items']
|
data = service.list_servers(options).body['items']
|
||||||
load(data)
|
load(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,6 +19,11 @@ module Fog
|
||||||
new(server)
|
new(server)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create(options)
|
||||||
|
server = service.create_server(options).body
|
||||||
|
new(server)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def clone_server(options = {})
|
def clone_server(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/server/clone",
|
:path => "/Storm/Server/clone",
|
||||||
:body => Fog::JSON.encode({:params => options})
|
:body => Fog::JSON.encode({:params => options})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def create_server(options = {})
|
def create_server(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/server/create",
|
:path => "/Storm/Server/create",
|
||||||
:body => Fog::JSON.encode({:params => options})
|
:body => Fog::JSON.encode({:params => options})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def delete_server(options = {})
|
def delete_server(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/server/destroy",
|
:path => "/Storm/Server/destroy",
|
||||||
:body => Fog::JSON.encode({:params => options})
|
:body => Fog::JSON.encode({:params => options})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def get_server(options = {})
|
def get_server(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/server/details",
|
:path => "/Storm/Server/details",
|
||||||
:body => Fog::JSON.encode({:params => options})
|
:body => Fog::JSON.encode({:params => options})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,8 @@ module Fog
|
||||||
|
|
||||||
def list_servers(options = {})
|
def list_servers(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/server/list",
|
:path => "/Storm/Server/list",
|
||||||
:body => Fog::JSON.encode(options)
|
:body => Fog::JSON.encode(:params => options)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def reboot_server(options = {})
|
def reboot_server(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/server/reboot",
|
:path => "/Storm/Server/reboot",
|
||||||
:body => Fog::JSON.encode({:params => options})
|
:body => Fog::JSON.encode({:params => options})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
def resize_server(options = {})
|
def resize_server(options = {})
|
||||||
request(
|
request(
|
||||||
:path => "/storm/server/resize",
|
:path => "/Storm/Server/resize",
|
||||||
:body => Fog::JSON.encode({:params => options})
|
:body => Fog::JSON.encode({:params => options})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
16
lib/fog/storm_on_demand/requests/compute/server_history.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/server_history.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def server_history(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Storm/Server/history',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/fog/storm_on_demand/requests/compute/server_status.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/server_status.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def server_status(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Storm/Server/status',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/fog/storm_on_demand/requests/compute/shutdown_server.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/shutdown_server.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def shutdown_server(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Storm/Server/shutdown',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/fog/storm_on_demand/requests/compute/start_server.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/start_server.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def start_server(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Storm/Server/start',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/fog/storm_on_demand/requests/compute/update_server.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/update_server.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def update_server(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Storm/Server/update',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue