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:
parent
4ad8a92073
commit
d3c0dc2195
3 changed files with 14 additions and 9 deletions
|
@ -10,13 +10,13 @@ module Fog
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :ip_v4
|
attribute :ip_v4
|
||||||
attribute :ip_v6
|
attribute :ip_v6
|
||||||
attribute :services
|
|
||||||
attribute :description
|
attribute :description
|
||||||
attribute :created, :aliases => 'created_at'
|
attribute :created, :aliases => 'created_at'
|
||||||
|
|
||||||
def services
|
def lb_services
|
||||||
requires :id
|
Fog::Bluebox::BLB::LbServices.new({
|
||||||
service.get_lb_services(id).body
|
:lb_application => self
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,6 +19,10 @@ module Fog
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def lb_application
|
||||||
|
collection.lb_application
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,15 +7,16 @@ module Fog
|
||||||
class LbServices < Fog::Collection
|
class LbServices < Fog::Collection
|
||||||
model Fog::Bluebox::BLB::LbService
|
model Fog::Bluebox::BLB::LbService
|
||||||
|
|
||||||
|
attr_accessor :data, :lb_application
|
||||||
|
|
||||||
def all
|
def all
|
||||||
data = service.get_lb_services.body
|
data = service.get_lb_services(lb_application.id).body
|
||||||
load(data)
|
load(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(application_id, service_id)
|
def get(lb_service_id)
|
||||||
if service_id && service = service.get_lb_services(service_id).body
|
lb_service = service.get_lb_service(lb_application.id, lb_service_id).body
|
||||||
new(server)
|
new(lb_service)
|
||||||
end
|
|
||||||
rescue Fog::Bluebox::BLB::NotFound
|
rescue Fog::Bluebox::BLB::NotFound
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue