Class: Fog::Network::OpenStack::LbVip

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/openstack/models/network/lb_vip.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) ⇒ LbVip

Returns a new instance of LbVip.



23
24
25
26
# File 'lib/fog/openstack/models/network/lb_vip.rb', line 23

def initialize(attributes)
  prepare_service_value(attributes)
  super
end

Instance Method Details

#createObject



33
34
35
36
37
38
39
40
41
# File 'lib/fog/openstack/models/network/lb_vip.rb', line 33

def create
  requires :subnet_id, :pool_id, :protocol, :protocol_port
  merge_attributes(service.create_lb_vip(self.subnet_id,
                                         self.pool_id,
                                         self.protocol,
                                         self.protocol_port,
                                         self.attributes).body['vip'])
  self
end

#destroyObject



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

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

#saveObject



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

def save
  requires :subnet_id, :pool_id, :protocol, :protocol_port
  identity ? update : create
end

#updateObject



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

def update
  requires :id, :subnet_id, :pool_id, :protocol, :protocol_port
  merge_attributes(service.update_lb_vip(self.id,
                                         self.attributes).body['vip'])
  self
end