Class: Fog::Network::OpenStack::LbMember

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

Returns a new instance of LbMember.



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

def initialize(attributes)
  prepare_service_value(attributes)
  super
end

Instance Method Details

#createObject



27
28
29
30
31
32
33
34
35
# File 'lib/fog/openstack/models/network/lb_member.rb', line 27

def create
  requires :pool_id, :address, :protocol_port, :weight
  merge_attributes(service.create_lb_member(self.pool_id,
                                            self.address,
                                            self.protocol_port,
                                            self.weight,
                                            self.attributes).body['member'])
  self
end

#destroyObject



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

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

#saveObject



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

def save
  requires :pool_id, :address, :protocol_port, :weight
  identity ? update : create
end

#updateObject



37
38
39
40
41
42
# File 'lib/fog/openstack/models/network/lb_member.rb', line 37

def update
  requires :id, :pool_id, :address, :protocol_port, :weight
  merge_attributes(service.update_lb_member(self.id,
                                            self.attributes).body['member'])
  self
end