Class: DeltacloudVM::Client::LoadBalancer

Inherits:
Base
  • Object
show all
Includes:
Methods::LoadBalancer
Defined in:
lib/deltacloud_vm/client/models/load_balancer.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#description, #name, #obj_id, #url

Class Method Summary collapse

Methods included from Methods::LoadBalancer

#create_load_balancer, #destroy_load_balancer, #load_balancer, #load_balancers, #register_instance, #unregister_instance

Methods inherited from Base

#client, #connection, convert, #entrypoint, from_collection, #id, #initialize, #original_body, #to_s, #update_instance_variables!, validate_attrs!

Methods included from Helpers::XmlHelper

#extract_xml_body

Methods included from Methods::Api

#api_uri, #current_driver, #current_provider, #feature?, #features, #must_support!, #path, #support?, #supported_collections, #version

Methods included from Helpers::Model

#error, #from_collection, #from_resource, #model

Constructor Details

This class inherits a constructor from DeltacloudVM::Client::Base

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



24
25
26
# File 'lib/deltacloud_vm/client/models/load_balancer.rb', line 24

def actions
  @actions
end

#created_atObject (readonly)

Returns the value of attribute created_at.



21
22
23
# File 'lib/deltacloud_vm/client/models/load_balancer.rb', line 21

def created_at
  @created_at
end

#instancesObject (readonly)

Returns the value of attribute instances.



26
27
28
# File 'lib/deltacloud_vm/client/models/load_balancer.rb', line 26

def instances
  @instances
end

#listenersObject (readonly)

Returns the value of attribute listeners.



25
26
27
# File 'lib/deltacloud_vm/client/models/load_balancer.rb', line 25

def listeners
  @listeners
end

#public_addressesObject (readonly)

Returns the value of attribute public_addresses.



23
24
25
# File 'lib/deltacloud_vm/client/models/load_balancer.rb', line 23

def public_addresses
  @public_addresses
end

#realm_idObject (readonly)

Returns the value of attribute realm_id.



22
23
24
# File 'lib/deltacloud_vm/client/models/load_balancer.rb', line 22

def realm_id
  @realm_id
end

Class Method Details

.parse(xml_body) ⇒ Object

Parse the LoadBalancer entity from XML body

  • xml_body -> DeltacloudVM API XML representation of the load_balancer



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/deltacloud_vm/client/models/load_balancer.rb', line 38

def self.parse(xml_body)
  {
    :created_at => xml_body.text_at(:created_at),
    :realm_id => xml_body.attr_at('realm', :id),
    :actions => xml_body.xpath('actions/link').map { |a| a['rel'].to_sym },
    :public_addresses => xml_body.xpath('public_addresses/address').map { |a| a.text.strip },
    :listeners => xml_body.xpath('listeners/listener').map { |l|
      {
        :protocol => l[:protocol],
        :load_balancer_port => l.text_at(:load_balancer_port),
        :instance_port => l.text_at(:instance_port)
      }
    },
    :instances => xml_body.xpath('instances/instance').map { |i| i[:id] }
  }
end