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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #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, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



49
50
51
52
53
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 49

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

#ready?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 30

def ready?
  status == 'active'
end

#saveObject

Raises:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 34

def save
  raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
  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