Class: Fog::Compute::CloudAtCost::Mock
- Inherits:
-
Object
- Object
- Fog::Compute::CloudAtCost::Mock
- Defined in:
- lib/fog/cloudatcost/requests/list_tasks.rb,
lib/fog/cloudatcost/compute.rb,
lib/fog/cloudatcost/requests/reset.rb,
lib/fog/cloudatcost/requests/console.rb,
lib/fog/cloudatcost/requests/power_on.rb,
lib/fog/cloudatcost/requests/run_mode.rb,
lib/fog/cloudatcost/requests/power_off.rb,
lib/fog/cloudatcost/requests/reverse_dns.rb,
lib/fog/cloudatcost/requests/list_servers.rb,
lib/fog/cloudatcost/requests/create_server.rb,
lib/fog/cloudatcost/requests/delete_server.rb,
lib/fog/cloudatcost/requests/rename_server.rb,
lib/fog/cloudatcost/requests/list_templates.rb
Overview
noinspection RubyStringKeysInHashInspection
Instance Method Summary collapse
- #console(id, hostname) ⇒ Object
- #create_server(cpu, ram, storage, template_id) ⇒ Object
- #delete_server(id) ⇒ Object
-
#initialize(options = {}) ⇒ Mock
constructor
A new instance of Mock.
- #list_servers ⇒ Object
- #list_tasks ⇒ Object
- #list_templates ⇒ Object
- #power_off(id) ⇒ Object
- #power_on(id) ⇒ Object
- #rename_server(id, name) ⇒ Object
- #reset(id) ⇒ Object
- #reverse_dns(id, hostname) ⇒ Object
- #run_mode(id, action) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Mock
Returns a new instance of Mock.
33 34 35 36 |
# File 'lib/fog/cloudatcost/compute.rb', line 33 def initialize(={}) @api_key = [:api_key] @email = [:email] end |
Instance Method Details
#console(id, hostname) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/cloudatcost/requests/console.rb', line 17 def console(id, hostname) response = Excon::Response.new response.status = 200 response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => 'v1', 'status' => 'ok', 'console' => 'http:\/\/panel.cloudatcost.com:12345\/console.html?servername=123456&hostname=1.1.1.1&sshkey=123456&sha1hash=aBcDeFgG', 'time' => 12312323, } response end |
#create_server(cpu, ram, storage, template_id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/cloudatcost/requests/create_server.rb', line 17 def create_server(cpu, ram, storage, template_id) response = Excon::Response.new response.status = 200 response.body = { 'result' => 'successful', 'api' => 'v1', 'action' => 'build', 'status' => 'ok', 'taskid' => 123123123123, 'time' => 12312323, } response end |
#delete_server(id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/cloudatcost/requests/delete_server.rb', line 17 def delete_server(id) response = Excon::Response.new response.status = 200 response.body = { 'result' => 'successful', 'api' => 'v1', 'action' => 'delete', 'status' => 'ok', 'taskid' => 123123123123, 'time' => 12312323, } response end |
#list_servers ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/cloudatcost/requests/list_servers.rb', line 16 def list_servers response = Excon::Response.new response.status = 200 response.body = { 'status' => 'OK', 'servers' => self.data[:data] } response end |
#list_tasks ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/cloudatcost/requests/list_tasks.rb', line 16 def list_tasks response = Excon::Response.new response.status = 200 response.body = { 'status' => 'OK', 'servers' => self.data[:data] } response end |
#list_templates ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/cloudatcost/requests/list_templates.rb', line 16 def list_templates response = Excon::Response.new response.status = 200 response.body = { 'status' => 'OK', 'servers' => self.data[:data] } response end |
#power_off(id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/cloudatcost/requests/power_off.rb', line 17 def power_off(id) response = Excon::Response.new response.status = 200 response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => 'v1', 'status' => 'ok', 'result' => 'successful', 'action' => 'poweroff', 'time' => 12312323, 'taskid' => 123123123123 } response end |
#power_on(id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/cloudatcost/requests/power_on.rb', line 17 def power_on(id) response = Excon::Response.new response.status = 200 response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => 'v1', 'status' => 'ok', 'result' => 'successful', 'action' => 'poweron', 'time' => 12312323, 'taskid' => 123123123123 } response end |
#rename_server(id, name) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/cloudatcost/requests/rename_server.rb', line 17 def rename_server(id, name) response = Excon::Response.new response.status = 200 response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => "v1", 'status' => "ok", 'result' => "successful", 'time' => 12312323, } response end |
#reset(id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/cloudatcost/requests/reset.rb', line 17 def reset(id) response = Excon::Response.new response.status = 200 response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => 'v1', 'status' => 'ok', 'result' => 'successful', 'action' => 'reset', 'time' => 12312323, 'taskid' => 123123123123 } response end |
#reverse_dns(id, hostname) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/cloudatcost/requests/reverse_dns.rb', line 17 def reverse_dns(id, hostname) response = Excon::Response.new response.status = 200 response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => 'v1', 'status' => 'ok', 'result' => 'successful', 'time' => 12312323, } response end |
#run_mode(id, action) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/cloudatcost/requests/run_mode.rb', line 17 def run_mode(id, action) response = Excon::Response.new response.status = 200 response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => 'v1', 'status' => 'ok', 'result' => 'successful', 'time' => 12312323, } response end |