class Fog::OpenStack::Network::Router

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.

@see docs.openstack.org/api/openstack-network/2.0/content/router_ext.html

Public Instance Methods

create() click to toggle source
# File lib/fog/openstack/network/models/router.rb, line 22
def create
  requires :name

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

  self
end
destroy() click to toggle source
# File lib/fog/openstack/network/models/router.rb, line 38
def destroy
  requires :id
  service.delete_router(id)
  true
end
update() click to toggle source
# File lib/fog/openstack/network/models/router.rb, line 31
def update
  requires :id
  response = service.update_router(id, options)
  merge_attributes(response.body['router'])
  self
end

Private Instance Methods

options() click to toggle source
# File lib/fog/openstack/network/models/router.rb, line 46
def options
  options = attributes.dup

  if options[:external_gateway_info]
    if options[:external_gateway_info].kind_of?(Fog::OpenStack::Network::Network)
      options[:external_gateway_info] = {:network_id => options[:external_gateway_info].id}
    else
      options[:external_gateway_info] = {:network_id => options[:external_gateway_info]}
    end
  end
  options
end