Class: DeltacloudVM::Client::Address

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

Instance Attribute Summary collapse

Attributes inherited from Base

#description, #name, #obj_id, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Methods::Address

#address, #addresses, #associate_address, #create_address, #destroy_address, #disassociate_address

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

#instance_idObject (readonly)

Returns the value of attribute instance_id.



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

def instance_id
  @instance_id
end

#ipObject (readonly)

Custom attributes:



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

def ip
  @ip
end

Class Method Details

.parse(xml_body) ⇒ Object

Parse the Address entity from XML body

  • xml_body -> DeltacloudVM API XML representation of the address



50
51
52
53
54
55
# File 'lib/deltacloud_vm/client/models/address.rb', line 50

def self.parse(xml_body)
  {
    :ip => xml_body.text_at(:ip),
    :instance_id => xml_body.attr_at('instance', :id)
  }
end

Instance Method Details

#associate(instance_id) ⇒ Object

Associate the IP address to the Instance



32
33
34
# File 'lib/deltacloud_vm/client/models/address.rb', line 32

def associate(instance_id)
  associate_address(_id, instance_id)
end

#destroy!Object



42
43
44
# File 'lib/deltacloud_vm/client/models/address.rb', line 42

def destroy!
  destroy_address(_id)
end

#disassociateObject

Disassociate the IP address from Instance



38
39
40
# File 'lib/deltacloud_vm/client/models/address.rb', line 38

def disassociate
  disassociate_address(_id)
end