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

[bluebox] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:29:33 +00:00
parent e4dd7c85b8
commit b98428b08b
10 changed files with 34 additions and 34 deletions

View file

@ -10,12 +10,12 @@ module Fog
model Fog::Compute::Bluebox::Flavor
def all
data = connection.get_products.body
data = service.get_products.body
load(data)
end
def get(product_id)
response = connection.get_product(product_id)
response = service.get_product(product_id)
new(response.body)
rescue Fog::Compute::Bluebox::NotFound
nil

View file

@ -7,26 +7,26 @@ module Fog
class Image < Fog::Model
identity :id
attribute :block_id
attribute :description
attribute :public
attribute :created_at, :aliases => 'created'
def save
requires :block_id
data = connection.create_template(block_id, attributes)
data = service.create_template(block_id, attributes)
true
end
def destroy
requires :id
data = connection.destroy_template(id)
data = service.destroy_template(id)
true
end
end
end

View file

@ -10,12 +10,12 @@ module Fog
model Fog::Compute::Bluebox::Image
def all
data = connection.get_templates.body
data = service.get_templates.body
load(data)
end
def get(template_id)
response = connection.get_template(template_id)
response = service.get_template(template_id)
new(response.body)
rescue Fog::Compute::Bluebox::NotFound
nil

View file

@ -10,12 +10,12 @@ module Fog
model Fog::Compute::Bluebox::Location
def all
data = connection.get_locations.body
data = service.get_locations.body
load(data)
end
def get(location_id)
response = connection.get_location(location_id)
response = service.get_location(location_id)
new(response.body)
rescue Fog::Compute::Bluebox::NotFound
nil

View file

@ -33,23 +33,23 @@ module Fog
def destroy
requires :id
connection.destroy_block(id)
service.destroy_block(id)
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 location
requires :location_id
connection.locations.get(location_id)
service.locations.get(location_id)
end
def private_ip_address
@ -66,7 +66,7 @@ module Fog
def reboot(type = 'SOFT')
requires :id
connection.reboot_block(id, type)
service.reboot_block(id, type)
true
end
@ -88,10 +88,10 @@ module Fog
elsif @lb_applications
options['lb_applications'] = lb_applications
end
options['username'] = username
options['hostname'] = hostname if @hostname
data = connection.create_block(flavor_id, image_id, location_id, options)
data = service.create_block(flavor_id, image_id, location_id, options)
merge_attributes(data.body)
true
end

View file

@ -10,7 +10,7 @@ module Fog
model Fog::Compute::Bluebox::Server
def all
data = connection.get_blocks.body
data = service.get_blocks.body
load(data)
end
@ -22,7 +22,7 @@ module Fog
end
def get(server_id)
if server_id && server = connection.get_block(server_id).body
if server_id && server = service.get_block(server_id).body
new(server)
end
rescue Fog::Compute::Bluebox::NotFound

View file

@ -23,7 +23,7 @@ module Fog
def destroy
requires :identity
connection.delete_record(@zone.identity, identity)
service.delete_record(@zone.identity, identity)
true
end
@ -34,9 +34,9 @@ module Fog
def save
requires :zone, :type, :name, :value
data = unless identity
connection.create_record(zone.identity, type, name, value)
service.create_record(zone.identity, type, name, value)
else
connection.update_record(zone.identity, identity, {:type => type, :name => name, :content => value})
service.update_record(zone.identity, identity, {:type => type, :name => name, :content => value})
end
merge_attributes(data.body)
true

View file

@ -13,12 +13,12 @@ module Fog
def all
requires :zone
data = connection.get_records(zone.identity).body['records']
data = service.get_records(zone.identity).body['records']
load(data)
end
def get(record_id)
data = connection.get_record(zone.identity, record_id).body
data = service.get_record(zone.identity, record_id).body
new(data)
rescue Fog::Service::NotFound
nil

View file

@ -31,7 +31,7 @@ module Fog
@records ||= begin
Fog::DNS::Bluebox::Records.new(
:zone => self,
:connection => connection
:service => service
)
end
end
@ -46,7 +46,7 @@ module Fog
def destroy
requires :identity
connection.delete_zone(identity)
service.delete_zone(identity)
true
end
@ -54,7 +54,7 @@ module Fog
requires :domain, :ttl
options = attributes.dup
options[:name] = options.delete(:domain)
data = identity.nil? ? connection.create_zone(options) : connection.update_zone(identity, options)
data = identity.nil? ? service.create_zone(options) : service.update_zone(identity, options)
merge_attributes(data.body)
true
end

View file

@ -10,12 +10,12 @@ module Fog
model Fog::DNS::Bluebox::Zone
def all
data = connection.get_zones.body['zones']
data = service.get_zones.body['zones']
load(data)
end
def get(zone_id)
data = connection.get_zone(zone_id).body
data = service.get_zone(zone_id).body
new(data)
rescue Fog::Service::NotFound
nil