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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#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

#initialize(attributes) ⇒ FloatingIp

Returns a new instance of FloatingIp.



20
21
22
23
# File 'lib/fog/openstack/models/network/floating_ip.rb', line 20

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

Instance Method Details

#createObject



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

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


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

#destroyObject



43
44
45
46
47
# File 'lib/fog/openstack/models/network/floating_ip.rb', line 43

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

#saveObject



25
26
27
28
# File 'lib/fog/openstack/models/network/floating_ip.rb', line 25

def save
  requires :floating_network_id
  identity ? update : create
end

#updateObject



39
40
41
# File 'lib/fog/openstack/models/network/floating_ip.rb', line 39

def update
  self
end