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

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

Instance Method Summary collapse

Instance Method Details

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


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

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

#destroyObject


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

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

#disassociate_port(options = {}) ⇒ Object


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

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

#saveObject

Raises:

  • (Fog::Errors::Error)

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

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