Class: Fog::HP::Network::Router

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #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

This class inherits a constructor from Fog::Model

Instance Method Details

#add_interface(subnet_id = nil, port_id = nil, options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/fog/hp/models/network/router.rb', line 22

def add_interface(subnet_id=nil, port_id=nil, options={})
  requires :id
  begin
    service.add_router_interface(id, subnet_id, port_id, options).body['router']
    true
  rescue ArgumentError, Fog::HP::Network::NotFound
    false
  end
end

#destroyObject



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

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

#ready?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/fog/hp/models/network/router.rb', line 42

def ready?
  self.status == 'ACTIVE'
end

#remove_interface(subnet_id = nil, port_id = nil, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/fog/hp/models/network/router.rb', line 32

def remove_interface(subnet_id=nil, port_id=nil, options={})
  requires :id
  begin
    service.remove_router_interface(id, subnet_id, port_id, options)
    true
  rescue ArgumentError, Fog::HP::Network::NotFound
    false
  end
end

#saveObject



46
47
48
# File 'lib/fog/hp/models/network/router.rb', line 46

def save
  identity ? update : create
end