Class: Fog::OpenStack::Network::FloatingIp

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

Instance Attribute Summary

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from Model

#save

Constructor Details

#initialize(attributes) ⇒ FloatingIp

Returns a new instance of FloatingIp.



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

def initialize(attributes)
  @connection = attributes[:connection]
  super
end

Instance Method Details

#associate(port_id, fixed_ip_address = nil) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/fog/openstack/network/models/floating_ip.rb', line 39

def associate(port_id, fixed_ip_address = nil)
  requires :id
  merge_attributes(service.associate_floating_ip(
    id,
    port_id,
    options(fixed_ip_address)
  ).body['floatingip'])
end

#createObject



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

def create
  requires :floating_network_id
  merge_attributes(service.create_floating_ip(floating_network_id,

                                              attributes).body['floatingip'])
  self
end

#destroyObject



33
34
35
36
37
# File 'lib/fog/openstack/network/models/floating_ip.rb', line 33

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

#disassociate(fixed_ip_address = nil) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/fog/openstack/network/models/floating_ip.rb', line 48

def disassociate(fixed_ip_address = nil)
  requires :id
  merge_attributes(service.disassociate_floating_ip(
    id,
    options(fixed_ip_address)
  ).body['floatingip'])
end

#updateObject



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

def update
  self
end