From f6af5582b25bebc80fca622c1e8fc4616bced039 Mon Sep 17 00:00:00 2001 From: Paul Thornthwaite Date: Sat, 22 Dec 2012 23:25:50 +0000 Subject: [PATCH] [joyent|compute] Updates reference to service --- lib/fog/joyent/models/compute/flavors.rb | 4 ++-- lib/fog/joyent/models/compute/images.rb | 4 ++-- lib/fog/joyent/models/compute/key.rb | 2 +- lib/fog/joyent/models/compute/keys.rb | 6 ++--- lib/fog/joyent/models/compute/server.rb | 26 +++++++++++----------- lib/fog/joyent/models/compute/servers.rb | 6 ++--- lib/fog/joyent/models/compute/snapshot.rb | 8 +++---- lib/fog/joyent/models/compute/snapshots.rb | 6 ++--- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/fog/joyent/models/compute/flavors.rb b/lib/fog/joyent/models/compute/flavors.rb index 3e6946672..782a3513b 100644 --- a/lib/fog/joyent/models/compute/flavors.rb +++ b/lib/fog/joyent/models/compute/flavors.rb @@ -10,11 +10,11 @@ module Fog model Fog::Compute::Joyent::Flavor def all - load(connection.list_packages().body) + load(service.list_packages().body) end def get(id) - data = connection.get_package(id).body + data = service.get_package(id).body new(data) end diff --git a/lib/fog/joyent/models/compute/images.rb b/lib/fog/joyent/models/compute/images.rb index 8aead5ac6..3cd5137ee 100644 --- a/lib/fog/joyent/models/compute/images.rb +++ b/lib/fog/joyent/models/compute/images.rb @@ -10,11 +10,11 @@ module Fog model Fog::Compute::Joyent::Image def all - load(connection.list_datasets().body) + load(service.list_datasets().body) end def get(id) - data = connection.get_dataset(id).body + data = service.get_dataset(id).body new(data) end diff --git a/lib/fog/joyent/models/compute/key.rb b/lib/fog/joyent/models/compute/key.rb index 0cdf7ce6d..eac59ab5c 100644 --- a/lib/fog/joyent/models/compute/key.rb +++ b/lib/fog/joyent/models/compute/key.rb @@ -11,7 +11,7 @@ module Fog def destroy requires :name - self.connection.delete_key(name) + service.delete_key(name) end end end diff --git a/lib/fog/joyent/models/compute/keys.rb b/lib/fog/joyent/models/compute/keys.rb index 7ab1d9dfb..c9a0ed10d 100644 --- a/lib/fog/joyent/models/compute/keys.rb +++ b/lib/fog/joyent/models/compute/keys.rb @@ -8,12 +8,12 @@ module Fog model Fog::Compute::Joyent::Key def all - data = connection.list_keys.body + data = service.list_keys.body load(data) end def get(keyname) - data = connection.get_key(keyname).body + data = service.get_key(keyname).body if data new(data) else @@ -25,7 +25,7 @@ module Fog raise ArgumentError, "option [name] required" unless params.key?(:name) raise ArgumentError, "option [key] required" unless params.key?(:key) - self.connection.create_key(params) + service.create_key(params) end end diff --git a/lib/fog/joyent/models/compute/server.rb b/lib/fog/joyent/models/compute/server.rb index af6a48b6a..69bcb1012 100644 --- a/lib/fog/joyent/models/compute/server.rb +++ b/lib/fog/joyent/models/compute/server.rb @@ -33,44 +33,44 @@ module Fog def destroy requires :id - self.connection.delete_machine(id) + service.delete_machine(id) true end def start requires :id - self.connection.start_machine(id) + service.start_machine(id) self.wait_for { ready? } true end def stop requires :id - self.connection.stop_machine(id) + service.stop_machine(id) self.wait_for { stopped? } true end def resize(flavor) requires :id - self.connection.resize_machine(id, flavor) + service.resize_machine(id, flavor) true end def reboot requires :id - self.connection.reboot_machine(id) + service.reboot_machine(id) true end def snapshots requires :id - self.connection.snapshots.all(id) + service.snapshots.all(id) end def update_metadata(data = {}) requires :id - self.connection.update_machine_metadata(self.id, data) + service.update_machine_metadata(self.id, data) self.reload true end @@ -79,38 +79,38 @@ module Fog raise ArgumentError, "Must provide a key name to delete" if keyname.nil? || keyname.empty? requires :id - self.connection.delete_machine_metadata(self.id, keyname) + service.delete_machine_metadata(self.id, keyname) true end def delete_all_metadata requires :id - self.connection.delete_all_machine_metadata(self.id) + service.delete_all_machine_metadata(self.id) true end def tags requires :id - self.connection.list_machine_tags(id).body + service.list_machine_tags(id).body end def add_tags(tags_hash = {}) requires :id - self.connection.add_machine_tags(self.id, tags_hash).body + service.add_machine_tags(self.id, tags_hash).body end def delete_tag(tagname) requires :id raise ArgumentError, "Must provide a tag name to delete" if tagname.nil? || tagname.empty? - self.connection.delete_machine_tag(self.id, tagname) + service.delete_machine_tag(self.id, tagname) true end def delete_all_tags requires :id - self.connection.delete_all_machine_tags(self.id) + service.delete_all_machine_tags(self.id) true end diff --git a/lib/fog/joyent/models/compute/servers.rb b/lib/fog/joyent/models/compute/servers.rb index 46a2c4568..5bed4f8f9 100644 --- a/lib/fog/joyent/models/compute/servers.rb +++ b/lib/fog/joyent/models/compute/servers.rb @@ -9,11 +9,11 @@ module Fog model Fog::Compute::Joyent::Server def all - load(self.connection.list_machines().body) + load(service.list_machines().body) end def create(params = {}) - data = self.connection.create_machine(params).body + data = service.create_machine(params).body server = new(data) server end @@ -25,7 +25,7 @@ module Fog end def get(machine_id) - data = self.connection.get_machine(machine_id).body + data = service.get_machine(machine_id).body new(data) end diff --git a/lib/fog/joyent/models/compute/snapshot.rb b/lib/fog/joyent/models/compute/snapshot.rb index 068a0f3b2..be2717d96 100644 --- a/lib/fog/joyent/models/compute/snapshot.rb +++ b/lib/fog/joyent/models/compute/snapshot.rb @@ -14,14 +14,14 @@ module Fog requires :name requires :machine_id - self.connection.snapshots.get(self.machine_id, self.name) + service.snapshots.get(self.machine_id, self.name) end def start requires :name requires :machine_id - self.connection.start_machine_from_snapshot(self.machine_id, self.name) + service.start_machine_from_snapshot(self.machine_id, self.name) true end @@ -29,14 +29,14 @@ module Fog requires :name requires :machine_id - self.connection.delete_machine_snapshot(self.machine_id, self.name) + service.delete_machine_snapshot(self.machine_id, self.name) true end def machine requires :machine_id - self.connection.servers.get(self.machine_id) + service.servers.get(self.machine_id) end end diff --git a/lib/fog/joyent/models/compute/snapshots.rb b/lib/fog/joyent/models/compute/snapshots.rb index d371c559a..946ce0b57 100644 --- a/lib/fog/joyent/models/compute/snapshots.rb +++ b/lib/fog/joyent/models/compute/snapshots.rb @@ -8,13 +8,13 @@ module Fog model Fog::Compute::Joyent::Snapshot def create(machine_id, snapshot_name) - data = self.connection.create_machine_snapshot(machine_id, snapshot_name).body + data = self.service.create_machine_snapshot(machine_id, snapshot_name).body data['machine_id'] = machine_id new(data) end def all(machine_id) - data = self.connection.list_machine_snapshots(machine_id).body.map do |m| + data = service.list_machine_snapshots(machine_id).body.map do |m| m["machine_id"] = machine_id m end @@ -22,7 +22,7 @@ module Fog end def get(machine_id, snapshot_name) - data = self.connection.get_machine_snapshot(machine_id, snapshot_name).body + data = service.get_machine_snapshot(machine_id, snapshot_name).body if data data["machine_id"] = machine_id new(data)