Class: Fog::Network::OpenStack::Router

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

Overview

The Layer-3 Networking Extensions (router)

A logical entity for forwarding packets across internal subnets and NATting them on external networks through an appropriate external gateway.

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Router

Returns a new instance of Router.



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

def initialize(attributes)
  # Old 'connection' is renamed as service and should be used instead
  prepare_service_value(attributes)
  super
end

Instance Method Details

#createObject



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

def create
  requires :name

  response = service.create_router(self.name, options)
  merge_attributes(response.body['router'])

  self
end

#destroyObject



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

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

#saveObject



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

def save
  requires :name
  identity ? update : create
end

#updateObject



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

def update
  requires :id
  response = service.update_router(self.id, options)
  merge_attributes(response.body['router'])
  self
end