Class: Yao::Resources::Router

Inherits:
Base
  • Object
show all
Includes:
ProjectAssociationable
Defined in:
lib/yao/resources/router.rb

Instance Attribute Summary

Attributes included from RestfullyAccessible

#service

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ProjectAssociationable

included, #project

Methods inherited from Base

#[], #[]=, add_instantiation_name_list, #destroy, friendly_attributes, #id, #initialize, instantiation?, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, map_attributes_to_time, #to_hash, #update

Methods included from RestfullyAccessible

#admin=, #api_version, #api_version=, #as_member, #client, #create, #destroy, extended, #find_by_name, #get, #get!, #list, #resources_path, #resources_path=, #return_single_on_querying, #return_single_on_querying=, #update

Constructor Details

This class inherits a constructor from Yao::Resources::Base

Class Method Details

.add_interface(id, param) ⇒ Hash

Parameters:

  • id (String)
  • param (Hash)

Returns:

  • (Hash)


38
39
40
# File 'lib/yao/resources/router.rb', line 38

def add_interface(id, param)
  PUT(['routers', id, 'add_router_interface.json'].join('/'), param.to_json)
end

.remove_interface(id, param) ⇒ Hash

Parameters:

  • id (String)
  • param (Hash)

Returns:

  • (Hash)


45
46
47
# File 'lib/yao/resources/router.rb', line 45

def remove_interface(id, param)
  PUT(['routers', id, 'remove_router_interface.json'].join('/'), param.to_json)
end

Instance Method Details

#enable_snatbool

Returns:

  • (bool)


13
14
15
# File 'lib/yao/resources/router.rb', line 13

def enable_snat
  external_gateway_info["enable_snat"]
end

#external_fixed_ipsArray<Hash>

Returns:

  • (Array<Hash>)


18
19
20
# File 'lib/yao/resources/router.rb', line 18

def external_fixed_ips
  external_gateway_info["external_fixed_ips"]
end

#external_networkYao::Resource::Network

Returns:

  • (Yao::Resource::Network)


23
24
25
26
27
# File 'lib/yao/resources/router.rb', line 23

def external_network
  @external_network ||= if network_id = external_gateway_info["network_id"]
                          Yao::Network.get(network_id)
                        end
end

#interfacesArray<Yao::Resources::Port>

Returns:



30
31
32
# File 'lib/yao/resources/router.rb', line 30

def interfaces
  Yao::Port.list(device_id: id)
end