mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[bluebox|blb] atone for additional sins in the lb service and backend models
This commit is contained in:
parent
fa526b947e
commit
d6cc6090e2
3 changed files with 24 additions and 19 deletions
|
@ -4,11 +4,11 @@ module Fog
|
|||
module Bluebox
|
||||
class BLB
|
||||
|
||||
class Backend < Fog::Model
|
||||
class LbBackend < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :name
|
||||
attribute :machines
|
||||
attribute :lb_machines
|
||||
attribute :monitoring_url
|
||||
attribute :monitoring_url_hostname
|
||||
attribute :acl_name
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/blb/lb_backend'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Applications < Fog::Collection
|
||||
class LbBackends < Fog::Collection
|
||||
|
||||
model Fog::Bluebox::BLB::LbBackend
|
||||
|
||||
attr_accessor :lb_service
|
||||
|
||||
def all
|
||||
data = service.get_blocks.body
|
||||
data = service.get_lb_backends(lb_service.id).body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def bootstrap(new_attributes = {})
|
||||
server = create(new_attributes)
|
||||
server.wait_for { ready? }
|
||||
server.setup(:key_data => [server.private_key])
|
||||
server
|
||||
end
|
||||
|
||||
def get(server_id)
|
||||
if server_id && server = service.get_block(server_id).body
|
||||
new(server)
|
||||
def get(lb_backend_id)
|
||||
if lb_backend = service.get_lb_backend(lb_service.id, lb_backend_id).body
|
||||
new(lb_backend)
|
||||
end
|
||||
rescue Fog::Compute::Bluebox::NotFound
|
||||
nil
|
||||
|
|
|
@ -9,7 +9,7 @@ module Fog
|
|||
|
||||
attribute :name
|
||||
attribute :port
|
||||
attribute :backends
|
||||
attribute :service_type
|
||||
attribute :private
|
||||
|
||||
attribute :status_url
|
||||
|
@ -17,12 +17,19 @@ module Fog
|
|||
attribute :status_password
|
||||
attribute :created, :aliases => 'created_at'
|
||||
|
||||
end
|
||||
|
||||
def lb_application
|
||||
collection.lb_application
|
||||
end
|
||||
def lb_application
|
||||
collection.lb_application
|
||||
end
|
||||
|
||||
def lb_backends
|
||||
Fog::Bluebox::BLB::LbBackends.new({
|
||||
:service => service,
|
||||
:lb_service => self
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue