1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[joyent|compute] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:25:50 +00:00
parent e41395674e
commit f6af5582b2
8 changed files with 31 additions and 31 deletions

View file

@ -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

View file

@ -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

View file

@ -11,7 +11,7 @@ module Fog
def destroy
requires :name
self.connection.delete_key(name)
service.delete_key(name)
end
end
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)