Module: CloudstackClient::Router
- Defined in:
- lib/cloudstack-client/commands/router.rb
Instance Method Summary collapse
-
#destroy_router(id, async = false) ⇒ Object
Destroy virtual router.
-
#list_routers(args = {:account => nil, :zone => nil, :projectid => nil, :status => nil, :name => nil}) ⇒ Object
Lists all virtual routers.
-
#start_router(id, async = false) ⇒ Object
Start virtual router.
-
#stop_router(id, async = false) ⇒ Object
Stop virtual router.
Instance Method Details
#destroy_router(id, async = false) ⇒ Object
Destroy virtual router.
42 43 44 45 46 47 48 |
# File 'lib/cloudstack-client/commands/router.rb', line 42 def destroy_router(id, async = false) params = { 'command' => 'destroyRouter', 'id' => id } async ? send_async_request(params) : send_request(params) end |
#list_routers(args = {:account => nil, :zone => nil, :projectid => nil, :status => nil, :name => nil}) ⇒ Object
Lists all virtual routers.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cloudstack-client/commands/router.rb', line 8 def list_routers(args = {:account => nil, :zone => nil, :projectid => nil, :status => nil, :name => nil}) params = { 'command' => 'listRouters', 'listall' => 'true', 'isrecursive' => 'true' } if args[:zone] zone = get_zone(args[:zone]) unless zone puts "Error: Zone #{args[:zone]} not found" exit 1 end params['zoneid'] = zone['id'] end params['projectid'] = args[:projectid] if args[:projectid] params['state'] = args[:status] if args[:status] params['name'] = args[:name] if args[:name] if args[:account] account = list_accounts({name: args[:account]}).first unless account puts "Error: Account #{args[:account]} not found." exit 1 end params['domainid'] = account["domainid"] params['account'] = args[:account] end json = send_request(params) json['router'] || [] end |
#start_router(id, async = false) ⇒ Object
Start virtual router.
53 54 55 56 57 58 59 |
# File 'lib/cloudstack-client/commands/router.rb', line 53 def start_router(id, async = false) params = { 'command' => 'startRouter', 'id' => id } async ? send_async_request(params) : send_request(params) end |
#stop_router(id, async = false) ⇒ Object
Stop virtual router.
64 65 66 67 68 69 70 |
# File 'lib/cloudstack-client/commands/router.rb', line 64 def stop_router(id, async = false) params = { 'command' => 'stopRouter', 'id' => id } async ? send_async_request(params) : send_request(params) end |