1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/compute/models/brightbox/load_balancer.rb

50 lines
1 KiB
Ruby

require 'fog/core/model'
module Fog
module Compute
class Brightbox
class LoadBalancer < Fog::Model
identity :id
attribute :url
attribute :name
attribute :status
attribute :resource_type
attribute :nodes
attribute :policy
attribute :healthcheck
attribute :listeners
attribute :account
def ready?
status == 'active'
end
def save
requires :nodes, :listeners, :healthcheck
options = {
:nodes => nodes,
:listeners => listeners,
:healthcheck => healthcheck,
:policy => policy,
:name => name
}.delete_if {|k,v| v.nil? || v == "" }
data = connection.create_load_balancer(options)
merge_attributes(data)
true
end
def destroy
requires :identity
connection.destroy_load_balancer(identity)
true
end
end
end
end
end