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

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

Instance Method Summary collapse

Instance Method Details

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



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

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



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

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

#ready?Boolean

Returns:

  • (Boolean)


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

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

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



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

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



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

def save
  identity ? update : create
end