class Fog::Compute::CloudAtCost::Mock

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

Public Class Methods

new(options = {}) click to toggle source
# File lib/fog/cloudatcost/compute.rb, line 38
def initialize(options = {})
  @api_key = options[:api_key]
  @email = options[:email]
end

Public Instance Methods

console(_id, _hostname) click to toggle source
# File lib/fog/cloudatcost/requests/console.rb, line 19
def console(_id, _hostname)
  console_url =
    'http:\/\/panel.cloudatcost.com:12345\/console.html?servername=123456&hostname=1.1.1.1'\
    '&sshkey=123456&sha1hash=aBcDeFgG'
  response = Excon::Response.new
  response.status = 200
  response.body = {
    'server_id'  => Fog::Mock.random_numbers(1).to_i,
    'api'        => 'v1',
    'status'     => 'ok',
    'console'    => console_url,
    'time'       => 12_312_323
  }
  response
end
create_server(_cpu, _ram, _storage, _template_id) click to toggle source
# File lib/fog/cloudatcost/requests/create_server.rb, line 19
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'     => 123_123_123_123,
    'time'       => 12_312_323
  }
  response
end
delete_server(_id) click to toggle source
# File lib/fog/cloudatcost/requests/delete_server.rb, line 19
def delete_server(_id)
  response = Excon::Response.new
  response.status = 200
  response.body = {
    'result'     => 'successful',
    'api'        => 'v1',
    'action'     => 'delete',
    'status'     => 'ok',
    'taskid'     => 123_123_123_123,
    'time'       => 12_312_323
  }
  response
end
list_servers() click to toggle source
# File lib/fog/cloudatcost/requests/list_servers.rb, line 18
def list_servers
  response = Excon::Response.new
  response.status = 200
  response.body = {
    'status' => 'OK',
    'servers' => data[:data]
  }
  response
end
list_tasks() click to toggle source
# File lib/fog/cloudatcost/requests/list_tasks.rb, line 18
def list_tasks
  response = Excon::Response.new
  response.status = 200
  response.body = {
    'status' => 'OK',
    'servers' => data[:data]
  }
  response
end
list_templates() click to toggle source
# File lib/fog/cloudatcost/requests/list_templates.rb, line 18
def list_templates
  response = Excon::Response.new
  response.status = 200
  response.body = {
    'status' => 'OK',
    'servers' => data[:data]
  }
  response
end
power_off(_id) click to toggle source
# File lib/fog/cloudatcost/requests/power_off.rb, line 19
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'       => 12_312_323,
    'taskid'     => 123_123_123_123
  }
  response
end
power_on(_id) click to toggle source
# File lib/fog/cloudatcost/requests/power_on.rb, line 19
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'       => 12_312_323,
    'taskid'     => 123_123_123_123
  }
  response
end
rename_server(_id, _name) click to toggle source
# File lib/fog/cloudatcost/requests/rename_server.rb, line 19
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'       => 12_312_323
  }
  response
end
reset(_id) click to toggle source
# File lib/fog/cloudatcost/requests/reset.rb, line 19
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'       => 12_312_323,
    'taskid'     => 123_123_123_123
  }
  response
end
reverse_dns(_id, _hostname) click to toggle source
# File lib/fog/cloudatcost/requests/reverse_dns.rb, line 19
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'       => 12_312_323
  }
  response
end
run_mode(_id, _action) click to toggle source
# File lib/fog/cloudatcost/requests/run_mode.rb, line 19
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'       => 12_312_323
  }
  response
end