Class: Fog::HP::Network::FloatingIp

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/hp/models/network/floating_ip.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

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 Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#associate_port(port_id, options = {}) ⇒ Object



23
24
25
26
27
# File 'lib/fog/hp/models/network/floating_ip.rb', line 23

def associate_port(port_id, options={})
  requires :id
  merge_attributes(service.associate_floating_ip(id, port_id, options).body['floatingip'])
  true
end

#destroyObject



17
18
19
20
21
# File 'lib/fog/hp/models/network/floating_ip.rb', line 17

def destroy
  requires :id
  service.delete_floating_ip(id)
  true
end

#disassociate_port(options = {}) ⇒ Object



29
30
31
32
33
# File 'lib/fog/hp/models/network/floating_ip.rb', line 29

def disassociate_port(options={})
  requires :id
  merge_attributes(service.disassociate_floating_ip(id, options).body['floatingip'])
  true
end

#saveObject

Raises:



35
36
37
38
39
40
# File 'lib/fog/hp/models/network/floating_ip.rb', line 35

def save
  requires :floating_network_id
  raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
  merge_attributes(service.create_floating_ip(floating_network_id, attributes).body['floatingip'])
  true
end