Class: Fog::Compute::Fifo::Mock
- Inherits:
-
Object
- Object
- Fog::Compute::Fifo::Mock
- Defined in:
- lib/fog/fifo/compute.rb,
lib/fog/fifo/requests/compute/get_vm.rb,
lib/fog/fifo/requests/compute/stop_vm.rb,
lib/fog/fifo/requests/compute/list_vms.rb,
lib/fog/fifo/requests/compute/start_vm.rb,
lib/fog/fifo/requests/compute/create_vm.rb,
lib/fog/fifo/requests/compute/delete_vm.rb,
lib/fog/fifo/requests/compute/reboot_vm.rb,
lib/fog/fifo/requests/compute/get_dataset.rb,
lib/fog/fifo/requests/compute/get_iprange.rb,
lib/fog/fifo/requests/compute/get_network.rb,
lib/fog/fifo/requests/compute/get_package.rb,
lib/fog/fifo/requests/compute/list_datasets.rb,
lib/fog/fifo/requests/compute/list_ipranges.rb,
lib/fog/fifo/requests/compute/list_networks.rb,
lib/fog/fifo/requests/compute/list_packages.rb
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
- #delete_vm(uuid) ⇒ Object
- #get_dataset(id) ⇒ Object
- #get_iprange(id) ⇒ Object
- #get_network(id) ⇒ Object
- #get_package(id) ⇒ Object
- #get_vm(uuid) ⇒ Object
-
#initialize(options = {}) ⇒ Mock
constructor
A new instance of Mock.
- #list_datasets ⇒ Object
- #list_ipranges ⇒ Object
- #list_networks ⇒ Object
- #list_packages ⇒ Object
- #list_vm ⇒ Object
- #remoot_vm(uuid) ⇒ Object
- #request(opts) ⇒ Object
- #start_vm(uuid) ⇒ Object
- #stop_vm(uuid) ⇒ Object
Constructor Details
Class Method Details
.data ⇒ Object
61 62 63 64 65 |
# File 'lib/fog/fifo/compute.rb', line 61 def self.data @data ||= Hash.new do |hash, key| hash[key] = {} end end |
Instance Method Details
#data ⇒ Object
67 68 69 |
# File 'lib/fog/fifo/compute.rb', line 67 def data self.class.data end |
#delete_vm(uuid) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# 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) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# 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) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# 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) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# 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) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# 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) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# 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 ⇒ Object
6 7 8 9 10 11 |
# 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 ⇒ Object
6 7 8 9 10 11 |
# 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 ⇒ Object
6 7 8 9 10 11 |
# 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 ⇒ Object
6 7 8 9 10 11 |
# 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 ⇒ Object
6 7 8 9 10 11 |
# 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) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# 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) ⇒ Object
76 77 78 |
# File 'lib/fog/fifo/compute.rb', line 76 def request(opts) raise "Not Implemented" end |
#start_vm(uuid) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/fifo/requests/compute/start_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) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# 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 |