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 model Fog::Compute::Bluebox::Flavor
def all def all
data = connection.get_products.body data = service.get_products.body
load(data) load(data)
end end
def get(product_id) def get(product_id)
response = connection.get_product(product_id) response = service.get_product(product_id)
new(response.body) new(response.body)
rescue Fog::Compute::Bluebox::NotFound rescue Fog::Compute::Bluebox::NotFound
nil nil

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@ module Fog
model Fog::Compute::Bluebox::Server model Fog::Compute::Bluebox::Server
def all def all
data = connection.get_blocks.body data = service.get_blocks.body
load(data) load(data)
end end
@ -22,7 +22,7 @@ module Fog
end end
def get(server_id) 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) new(server)
end end
rescue Fog::Compute::Bluebox::NotFound rescue Fog::Compute::Bluebox::NotFound

View file

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

View file

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

View file

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

View file

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