class Fog::Compute::Fifo::Mock
Public Class Methods
data()
click to toggle source
# File lib/fog/fifo/compute.rb, line 61 def self.data @data ||= Hash.new do |hash, key| hash[key] = {} end end
new(options = {})
click to toggle source
# File lib/fog/fifo/compute.rb, line 71 def initialize(options = {}) @fifo_username = options[:fifo_username] || Fog.credentials[:fifo_username] @fifo_password = options[:fifo_password] || Fog.credentials[:fifo_password] end
Public Instance Methods
data()
click to toggle source
# File lib/fog/fifo/compute.rb, line 67 def data self.class.data end
delete_vm(uuid)
click to toggle source
# File lib/fog/fifo/requests/compute/delete_vm.rb, line 6 def delete_vm(uuid) if vm = self.data[:vms][uuid] res = Excon::Response.new res.status = 200 res else raise Excon::Errors::NotFound, "Not Found" end end
get_dataset(id)
click to toggle source
# File lib/fog/fifo/requests/compute/get_dataset.rb, line 6 def get_dataset(id) if ds = self.data[:datasets][id] res = Excon::Response.new res.status = 200 res.body = ds else raise Excon::Errors::NotFound end end
get_iprange(id)
click to toggle source
# File lib/fog/fifo/requests/compute/get_iprange.rb, line 6 def get_iprange(id) if pkg = self.data[:iprange][id] response = Excon::Response.new response.body = pkg response.status = 200 response else raise Excon::Errors::NotFound end end
get_network(id)
click to toggle source
# File lib/fog/fifo/requests/compute/get_network.rb, line 6 def get_network(id) if pkg = self.data[:networks][id] response = Excon::Response.new response.body = pkg response.status = 200 response else raise Excon::Errors::NotFound end end
get_package(id)
click to toggle source
# File lib/fog/fifo/requests/compute/get_package.rb, line 6 def get_package(id) if pkg = self.data[:packages][id] response = Excon::Response.new response.body = pkg response.status = 200 response else raise Excon::Errors::NotFound end end
get_vm(uuid)
click to toggle source
# File lib/fog/fifo/requests/compute/get_vm.rb, line 6 def get_vm(uuid) if vm = self.data[:vms][uuid] res = Excon::Response.new res.status = 200 res.body = vm res else raise Excon::Errors::NotFound, "Not Found" end end
list_datasets()
click to toggle source
# File lib/fog/fifo/requests/compute/list_datasets.rb, line 6 def list_datasets res = Excon::Response.new res.status = 200 res.body = self.data[:datasets].values res end
list_ipranges()
click to toggle source
# File lib/fog/fifo/requests/compute/list_ipranges.rb, line 6 def list_ipranges res = Excon::Response.new res.status = 200 res.body = self.data[:ipranges].values res end
list_networks()
click to toggle source
# File lib/fog/fifo/requests/compute/list_networks.rb, line 6 def list_networks res = Excon::Response.new res.status = 200 res.body = self.data[:networks].values res end
list_packages()
click to toggle source
# File lib/fog/fifo/requests/compute/list_packages.rb, line 6 def list_packages response = Excon::Response.new() response.status = 200 response.body = self.data[:packages].values response end
list_vm()
click to toggle source
# File lib/fog/fifo/requests/compute/list_vms.rb, line 6 def list_vm res = Excon::Response.new res.status = 200 res.body = self.data[:machines].values res end
remoot_vm(uuid)
click to toggle source
# File lib/fog/fifo/requests/compute/reboot_vm.rb, line 6 def remoot_vm(uuid) if vm = self.data[:vms][uuid] res = Excon::Response.new res.status = 200 res else raise Excon::Errors::NotFound, "Not Found" end end
request(opts)
click to toggle source
# File lib/fog/fifo/compute.rb, line 76 def request(opts) raise "Not Implemented" end
start_vm(uuid)
click to toggle source
# File lib/fog/fifo/requests/compute/create_vm.rb, line 6 def start_vm(uuid) if vm = self.data[:vms][uuid] res = Excon::Response.new res.status = 200 res.body = vm res else raise Excon::Errors::NotFound, "Not Found" end end
stop_vm(uuid)
click to toggle source
# File lib/fog/fifo/requests/compute/stop_vm.rb, line 6 def stop_vm(uuid) if vm = self.data[:vms][uuid] res = Excon::Response.new res.status = 200 res.body = vm res else raise Excon::Errors::NotFound, "Not Found" end end