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

[bluebox|blb] lb_service collection implementation

This commit is contained in:
Josh Yotty 2013-02-18 17:09:51 -08:00
parent 4ad8a92073
commit d3c0dc2195
3 changed files with 14 additions and 9 deletions

View file

@ -10,13 +10,13 @@ module Fog
attribute :name
attribute :ip_v4
attribute :ip_v6
attribute :services
attribute :description
attribute :created, :aliases => 'created_at'
def services
requires :id
service.get_lb_services(id).body
def lb_services
Fog::Bluebox::BLB::LbServices.new({
:lb_application => self
})
end
end

View file

@ -19,6 +19,10 @@ module Fog
end
def lb_application
collection.lb_application
end
end
end
end

View file

@ -7,15 +7,16 @@ module Fog
class LbServices < Fog::Collection
model Fog::Bluebox::BLB::LbService
attr_accessor :data, :lb_application
def all
data = service.get_lb_services.body
data = service.get_lb_services(lb_application.id).body
load(data)
end
def get(application_id, service_id)
if service_id && service = service.get_lb_services(service_id).body
new(server)
end
def get(lb_service_id)
lb_service = service.get_lb_service(lb_application.id, lb_service_id).body
new(lb_service)
rescue Fog::Bluebox::BLB::NotFound
nil
end