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

[ninefold|compute] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:24:54 +00:00
parent fbc5c52194
commit 6aefe10ccc
8 changed files with 27 additions and 27 deletions

View file

@ -35,19 +35,19 @@ module Fog
def destroy
requires :identity
self.jobid = extract_job_id(connection.disassociate_ip_address(:id => identity))
self.jobid = extract_job_id(service.disassociate_ip_address(:id => identity))
true
end
def enable_static_nat(server)
server.kind_of?(Integer) ? serverid = server : serverid = server.identity
res = connection.enable_static_nat(:virtualmachineid => serverid, :ipaddressid => identity)
res = service.enable_static_nat(:virtualmachineid => serverid, :ipaddressid => identity)
reload
to_boolean(res['success'])
end
def disable_static_nat()
self.jobid = extract_job_id(connection.disable_static_nat(:ipaddressid => identity))
self.jobid = extract_job_id(service.disable_static_nat(:ipaddressid => identity))
true
end
@ -59,7 +59,7 @@ module Fog
end
def ready?
if jobid && connection.query_async_job_result(:jobid => jobid)['jobstatus'] == 0
if jobid && service.query_async_job_result(:jobid => jobid)['jobstatus'] == 0
false
else # No running job, we are ready. Refresh data.
reload
@ -77,7 +77,7 @@ module Fog
:account => account,
:domainid => domainid
}.delete_if {|k,v| v.nil? || v == "" }
data = connection.associate_ip_address(options)
data = service.associate_ip_address(options)
merge_attributes(data)
true
end

View file

@ -10,13 +10,13 @@ module Fog
model Fog::Compute::Ninefold::Address
def all
data = connection.list_public_ip_addresses
data = service.list_public_ip_addresses
load(data)
end
def get(identifier)
return nil if identifier.nil? || identifier == ""
data = connection.list_public_ip_addresses(:id => identifier)
data = service.list_public_ip_addresses(:id => identifier)
if data.empty?
nil
else

View file

@ -10,12 +10,12 @@ module Fog
model Fog::Compute::Ninefold::Flavor
def all
data = connection.list_service_offerings
data = service.list_service_offerings
load(data)
end
def get(identifier)
data = connection.list_service_offerings(:id => identifier)
data = service.list_service_offerings(:id => identifier)
if data.empty?
nil
else

View file

@ -10,12 +10,12 @@ module Fog
model Fog::Compute::Ninefold::Image
def all(offering = 'executable')
data = connection.list_templates(:templatefilter => offering)
data = service.list_templates(:templatefilter => offering)
load(data)
end
def get(identifier, offering = 'executable')
data = connection.list_templates(:templatefilter => offering, :id => identifier)
data = service.list_templates(:templatefilter => offering, :id => identifier)
if data.empty?
nil
else

View file

@ -25,12 +25,12 @@ module Fog
def destroy
requires :identity
self.jobid = extract_job_id(connection.delete_ip_forwarding_rule(:id => identity))
self.jobid = extract_job_id(service.delete_ip_forwarding_rule(:id => identity))
true
end
def ready?
if jobid && connection.query_async_job_result(:jobid => jobid)['jobstatus'] == 0
if jobid && service.query_async_job_result(:jobid => jobid)['jobstatus'] == 0
false
else # No running job, we are ready. Refresh data.
reload
@ -58,7 +58,7 @@ module Fog
:startport => startport,
:endport => endport
}.delete_if {|k,v| v.nil? || v == "" }
data = connection.create_ip_forwarding_rule(options)
data = service.create_ip_forwarding_rule(options)
merge_attributes(data)
true
end

View file

@ -10,13 +10,13 @@ module Fog
model Fog::Compute::Ninefold::IpForwardingRule
def all
data = connection.list_ip_forwarding_rules
data = service.list_ip_forwarding_rules
load(data)
end
def get(identifier)
return nil if identifier.nil? || identifier == ""
data = connection.list_ip_forwarding_rules(:id => identifier)
data = service.list_ip_forwarding_rules(:id => identifier)
if data.empty?
nil
else

View file

@ -82,43 +82,43 @@ module Fog
def reboot
requires :identity
self.jobid = extract_job_id(connection.reboot_virtual_machine(:id => identity))
self.jobid = extract_job_id(service.reboot_virtual_machine(:id => identity))
puts "jobid: " + jobid.to_s
true
end
def start
requires :identity
self.jobid = extract_job_id(connection.start_virtual_machine(:id => identity))
self.jobid = extract_job_id(service.start_virtual_machine(:id => identity))
true
end
def stop
requires :identity
self.jobid = extract_job_id(connection.stop_virtual_machine(:id => identity))
self.jobid = extract_job_id(service.stop_virtual_machine(:id => identity))
true
end
def destroy
requires :identity
self.jobid = extract_job_id(connection.destroy_virtual_machine(:id => identity))
self.jobid = extract_job_id(service.destroy_virtual_machine(:id => identity))
true
end
def flavor
requires :flavor_id
connection.flavors.get(flavor_id)
service.flavors.get(flavor_id)
end
def image
requires :image_id
connection.images.get(image_id)
service.images.get(image_id)
end
def ready?
if jobid
# we do this by polling the last job id status.
res = connection.query_async_job_result(:jobid => jobid)
res = service.query_async_job_result(:jobid => jobid)
if res['jobstatus'] == 0
false
else
@ -138,7 +138,7 @@ module Fog
unless networkids
# No network specified, use first in this zone.
networks = connection.list_networks(:zoneid => zoneid)
networks = service.list_networks(:zoneid => zoneid)
if networks.empty?
raise "No networks. Please create one, or specify a network ID"
else
@ -164,7 +164,7 @@ module Fog
:size => size,
:userdata => userdata
}.delete_if {|k,v| v.nil? || v == "" }
data = connection.deploy_virtual_machine(options)
data = service.deploy_virtual_machine(options)
merge_attributes(data)
true
end

View file

@ -10,13 +10,13 @@ module Fog
model Fog::Compute::Ninefold::Server
def all
data = connection.list_virtual_machines
data = service.list_virtual_machines
load(data)
end
def get(identifier)
return nil if identifier.nil? || identifier == ""
data = connection.list_virtual_machines(:id => identifier)
data = service.list_virtual_machines(:id => identifier)
if data.empty?
nil
else