Class: Fog::Brightbox::Compute::LoadBalancer

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/models/brightbox/load_balancer.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



40
41
42
43
44
# File 'lib/fog/compute/models/brightbox/load_balancer.rb', line 40

def destroy
  requires :identity
  connection.destroy_load_balancer(identity)
  true
end

#ready?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/fog/compute/models/brightbox/load_balancer.rb', line 22

def ready?
  status == 'active'
end

#saveObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/compute/models/brightbox/load_balancer.rb', line 26

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