wakame-vdc-webui 10.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. data/INSTALL.txt +21 -0
  2. data/LICENSE +202 -0
  3. data/NOTICE +1 -0
  4. data/README +256 -0
  5. data/Rakefile +42 -0
  6. data/app/controllers/accounts_controller.rb +15 -0
  7. data/app/controllers/application_controller.rb +5 -0
  8. data/app/controllers/dialog_controller.rb +80 -0
  9. data/app/controllers/home_controller.rb +5 -0
  10. data/app/controllers/host_pools_controller.rb +26 -0
  11. data/app/controllers/images_controller.rb +28 -0
  12. data/app/controllers/information_controller.rb +10 -0
  13. data/app/controllers/instances_controller.rb +59 -0
  14. data/app/controllers/keypairs_controller.rb +64 -0
  15. data/app/controllers/security_groups_controller.rb +59 -0
  16. data/app/controllers/sessions_controller.rb +25 -0
  17. data/app/controllers/snapshots_controller.rb +48 -0
  18. data/app/controllers/storage_pools_controller.rb +27 -0
  19. data/app/controllers/users_controller.rb +3 -0
  20. data/app/controllers/volumes_controller.rb +86 -0
  21. data/app/helpers/accounts_helper.rb +2 -0
  22. data/app/helpers/application_helper.rb +23 -0
  23. data/app/helpers/dialog_helper.rb +2 -0
  24. data/app/helpers/home_helper.rb +2 -0
  25. data/app/helpers/host_pools_helper.rb +2 -0
  26. data/app/helpers/images_helper.rb +2 -0
  27. data/app/helpers/information_helper.rb +2 -0
  28. data/app/helpers/instances_helper.rb +2 -0
  29. data/app/helpers/keypairs_helper.rb +2 -0
  30. data/app/helpers/security_groups_helper.rb +2 -0
  31. data/app/helpers/sessions_helper.rb +2 -0
  32. data/app/helpers/snapshots_helper.rb +2 -0
  33. data/app/helpers/storage_pools_helper.rb +2 -0
  34. data/app/helpers/users_helper.rb +2 -0
  35. data/app/helpers/volumes_helper.rb +2 -0
  36. data/app/models/account.rb +104 -0
  37. data/app/models/authz.rb +102 -0
  38. data/app/models/base_new.rb +311 -0
  39. data/app/models/dcmgr_resource/account.rb +5 -0
  40. data/app/models/dcmgr_resource/base.rb +51 -0
  41. data/app/models/dcmgr_resource/host_pool.rb +11 -0
  42. data/app/models/dcmgr_resource/image.rb +11 -0
  43. data/app/models/dcmgr_resource/instance.rb +37 -0
  44. data/app/models/dcmgr_resource/mock.rb +15 -0
  45. data/app/models/dcmgr_resource/netfilter_group.rb +29 -0
  46. data/app/models/dcmgr_resource/ssh_key_pair.rb +25 -0
  47. data/app/models/dcmgr_resource/storage_pool.rb +11 -0
  48. data/app/models/dcmgr_resource/volume.rb +48 -0
  49. data/app/models/dcmgr_resource/volume_snapshot.rb +35 -0
  50. data/app/models/information.rb +9 -0
  51. data/app/models/schema.rb +51 -0
  52. data/app/models/tag.rb +121 -0
  53. data/app/models/tag_mapping.rb +25 -0
  54. data/app/models/user.rb +46 -0
  55. data/app/views/accounts/index.html.erb +68 -0
  56. data/app/views/dialog/attach_volume.html.erb +13 -0
  57. data/app/views/dialog/create_and_edit_security_group.html.erb +32 -0
  58. data/app/views/dialog/create_snapshot.html.erb +7 -0
  59. data/app/views/dialog/create_ssh_keypair.html.erb +15 -0
  60. data/app/views/dialog/create_volume.html.erb +18 -0
  61. data/app/views/dialog/create_volume_from_snapshot.html.erb +7 -0
  62. data/app/views/dialog/delete_security_group.html.erb +4 -0
  63. data/app/views/dialog/delete_snapshot.html.erb +7 -0
  64. data/app/views/dialog/delete_ssh_keypair.html.erb +4 -0
  65. data/app/views/dialog/delete_volume.html.erb +7 -0
  66. data/app/views/dialog/detach_volume.html.erb +7 -0
  67. data/app/views/dialog/launch_instance.html.erb +70 -0
  68. data/app/views/dialog/reboot_instances.html.erb +7 -0
  69. data/app/views/dialog/start_instances.html.erb +8 -0
  70. data/app/views/dialog/stop_instances.html.erb +7 -0
  71. data/app/views/dialog/terminate_instances.html.erb +7 -0
  72. data/app/views/home/index.html.erb +55 -0
  73. data/app/views/host_pools/index.html.erb +103 -0
  74. data/app/views/images/index.html.erb +126 -0
  75. data/app/views/information/index.html.erb +25 -0
  76. data/app/views/instances/index.html.erb +134 -0
  77. data/app/views/keypairs/index.html.erb +104 -0
  78. data/app/views/layouts/_footer.html.erb +4 -0
  79. data/app/views/layouts/_header.html.erb +14 -0
  80. data/app/views/layouts/_informationarea.html.erb +18 -0
  81. data/app/views/layouts/_login_header.erb +4 -0
  82. data/app/views/layouts/_service_health.erb +27 -0
  83. data/app/views/layouts/_sidemenu.html.erb +58 -0
  84. data/app/views/layouts/application.html.erb +34 -0
  85. data/app/views/layouts/login.html.erb +25 -0
  86. data/app/views/security_groups/index.html.erb +114 -0
  87. data/app/views/sessions/new.html.erb +27 -0
  88. data/app/views/snapshots/index.html.erb +110 -0
  89. data/app/views/storage_pools/index.html.erb +98 -0
  90. data/app/views/volumes/index.html.erb +117 -0
  91. data/config.ru +4 -0
  92. data/config/application.rb +48 -0
  93. data/config/boot.rb +13 -0
  94. data/config/database.yml +20 -0
  95. data/config/environment.rb +5 -0
  96. data/config/environments/development.rb +28 -0
  97. data/config/environments/production.rb +49 -0
  98. data/config/environments/test.rb +35 -0
  99. data/config/initializers/backtrace_silencers.rb +7 -0
  100. data/config/initializers/dcmgr_gui.rb +14 -0
  101. data/config/initializers/inflections.rb +10 -0
  102. data/config/initializers/mime_types.rb +5 -0
  103. data/config/initializers/secret_token.rb +7 -0
  104. data/config/initializers/session_store.rb +8 -0
  105. data/config/locales/en.yml +5 -0
  106. data/config/routes.rb +109 -0
  107. data/db/seeds.rb +7 -0
  108. data/extras/authentication.rb +94 -0
  109. data/extras/util.rb +5 -0
  110. data/lib/tasks/dcmgr_gui.rake +51 -0
  111. data/public/404.html +26 -0
  112. data/public/422.html +26 -0
  113. data/public/500.html +26 -0
  114. data/public/favicon.ico +0 -0
  115. data/public/images/app_active.gif +0 -0
  116. data/public/images/app_passive.gif +0 -0
  117. data/public/images/body_bg.gif +0 -0
  118. data/public/images/btn_change.gif +0 -0
  119. data/public/images/btn_create_security_group.gif +0 -0
  120. data/public/images/btn_create_snapshot.gif +0 -0
  121. data/public/images/btn_create_volume.gif +0 -0
  122. data/public/images/btn_createkey.gif +0 -0
  123. data/public/images/btn_de_register.gif +0 -0
  124. data/public/images/btn_delete_security_group.gif +0 -0
  125. data/public/images/btn_delete_snapshot.gif +0 -0
  126. data/public/images/btn_delete_volume.gif +0 -0
  127. data/public/images/btn_deletekey.gif +0 -0
  128. data/public/images/btn_healthdetail.gif +0 -0
  129. data/public/images/btn_hide.gif +0 -0
  130. data/public/images/btn_launch.gif +0 -0
  131. data/public/images/btn_next.gif +0 -0
  132. data/public/images/btn_prev.gif +0 -0
  133. data/public/images/btn_refresh.gif +0 -0
  134. data/public/images/btn_register_new_ami.gif +0 -0
  135. data/public/images/btn_savechange.gif +0 -0
  136. data/public/images/btn_show.gif +0 -0
  137. data/public/images/btn_show_accesskey.png +0 -0
  138. data/public/images/bup_btn_healthdetail.gif +0 -0
  139. data/public/images/bup_btn_refresh.gif +0 -0
  140. data/public/images/clear.gif +0 -0
  141. data/public/images/content_bg.png +0 -0
  142. data/public/images/content_foot_bg.gif +0 -0
  143. data/public/images/content_head_bg.gif +0 -0
  144. data/public/images/footer_bg.gif +0 -0
  145. data/public/images/head_gradation_bg.gif +0 -0
  146. data/public/images/header_logo.gif +0 -0
  147. data/public/images/icon_blockstore.gif +0 -0
  148. data/public/images/icon_caution.gif +0 -0
  149. data/public/images/icon_health.gif +0 -0
  150. data/public/images/icon_images.gif +0 -0
  151. data/public/images/icon_information.gif +0 -0
  152. data/public/images/icon_instances.gif +0 -0
  153. data/public/images/icon_resource.gif +0 -0
  154. data/public/images/icon_resource01.gif +0 -0
  155. data/public/images/icon_resource02.gif +0 -0
  156. data/public/images/icon_resource03.gif +0 -0
  157. data/public/images/icon_resource04.gif +0 -0
  158. data/public/images/icon_rss.gif +0 -0
  159. data/public/images/icon_security.gif +0 -0
  160. data/public/images/icon_service.gif +0 -0
  161. data/public/images/icon_service_stat.gif +0 -0
  162. data/public/images/icon_stop.gif +0 -0
  163. data/public/images/icon_summary.gif +0 -0
  164. data/public/images/icon_ttl_accskey.gif +0 -0
  165. data/public/images/icon_ttl_detail.gif +0 -0
  166. data/public/images/icon_ttl_instance.gif +0 -0
  167. data/public/images/icon_ttl_personal_inf.gif +0 -0
  168. data/public/images/infra_active.gif +0 -0
  169. data/public/images/infra_passive.gif +0 -0
  170. data/public/images/lastelement_bg.gif +0 -0
  171. data/public/images/lastelement_bg.png +0 -0
  172. data/public/images/listicon_useast.gif +0 -0
  173. data/public/images/loader_ball.gif +0 -0
  174. data/public/images/loader_boxes.gif +0 -0
  175. data/public/images/loading.gif +0 -0
  176. data/public/images/mainarea_bottom_bg.gif +0 -0
  177. data/public/images/mainarea_content_bg.gif +0 -0
  178. data/public/images/mainarea_h3_bg.gif +0 -0
  179. data/public/images/mainarea_wide_bottom_bg.gif +0 -0
  180. data/public/images/mainarea_wide_content_bg.gif +0 -0
  181. data/public/images/mainarea_wide_h3_bg.gif +0 -0
  182. data/public/images/menu_list_header.gif +0 -0
  183. data/public/images/menu_list_header_current.gif +0 -0
  184. data/public/images/plat_active.gif +0 -0
  185. data/public/images/plat_passive.gif +0 -0
  186. data/public/images/regionselect_bg.gif +0 -0
  187. data/public/images/select_bg_126.gif +0 -0
  188. data/public/images/select_bg_139.gif +0 -0
  189. data/public/images/sidemenu_bg.gif +0 -0
  190. data/public/images/sidemenu_bottom.gif +0 -0
  191. data/public/images/sidemenu_top.gif +0 -0
  192. data/public/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  193. data/public/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  194. data/public/images/ui-bg_flat_10_000000_40x100.png +0 -0
  195. data/public/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  196. data/public/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  197. data/public/images/ui-bg_glass_55_fcf0ba_1x400.png +0 -0
  198. data/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  199. data/public/images/ui-bg_gloss-wave_100_ece8da_500x100.png +0 -0
  200. data/public/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  201. data/public/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png +0 -0
  202. data/public/images/ui-bg_highlight-hard_100_fafaf4_1x100.png +0 -0
  203. data/public/images/ui-bg_highlight-hard_15_459e00_1x100.png +0 -0
  204. data/public/images/ui-bg_highlight-hard_95_cccccc_1x100.png +0 -0
  205. data/public/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  206. data/public/images/ui-bg_highlight-soft_25_67b021_1x100.png +0 -0
  207. data/public/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  208. data/public/images/ui-bg_highlight-soft_95_ffedad_1x100.png +0 -0
  209. data/public/images/ui-bg_inset-soft_15_2b2922_1x100.png +0 -0
  210. data/public/images/ui-icons_222222_256x240.png +0 -0
  211. data/public/images/ui-icons_228ef1_256x240.png +0 -0
  212. data/public/images/ui-icons_808080_256x240.png +0 -0
  213. data/public/images/ui-icons_847e71_256x240.png +0 -0
  214. data/public/images/ui-icons_8dc262_256x240.png +0 -0
  215. data/public/images/ui-icons_cd0a0a_256x240.png +0 -0
  216. data/public/images/ui-icons_eeeeee_256x240.png +0 -0
  217. data/public/images/ui-icons_ef8c08_256x240.png +0 -0
  218. data/public/images/ui-icons_ffd27a_256x240.png +0 -0
  219. data/public/images/ui-icons_ffffff_256x240.png +0 -0
  220. data/public/images/vtip_arrow.png +0 -0
  221. data/public/javascripts/controls.js +965 -0
  222. data/public/javascripts/dcmgr_gui/application.js +91 -0
  223. data/public/javascripts/dcmgr_gui/core.js +539 -0
  224. data/public/javascripts/dcmgr_gui/dashboard_panel.js +34 -0
  225. data/public/javascripts/dcmgr_gui/host_pool_panel.js +83 -0
  226. data/public/javascripts/dcmgr_gui/image_panel.js +242 -0
  227. data/public/javascripts/dcmgr_gui/instance_panel.js +197 -0
  228. data/public/javascripts/dcmgr_gui/security_group_panel.js +196 -0
  229. data/public/javascripts/dcmgr_gui/snapshot_panel.js +168 -0
  230. data/public/javascripts/dcmgr_gui/sshkeypair_panel.js +161 -0
  231. data/public/javascripts/dcmgr_gui/storage_pool_panel.js +99 -0
  232. data/public/javascripts/dcmgr_gui/volume_panel.js +311 -0
  233. data/public/javascripts/dragdrop.js +974 -0
  234. data/public/javascripts/effects.js +1123 -0
  235. data/public/javascripts/jquery-1.4.2.min.js +154 -0
  236. data/public/javascripts/jquery-ui-1.8.4.custom.min.js +763 -0
  237. data/public/javascripts/jquery.loadmask.min.js +10 -0
  238. data/public/javascripts/jquery.tmpl.js +486 -0
  239. data/public/javascripts/jsdeferred.jquery.js +385 -0
  240. data/public/javascripts/prototype.js +6001 -0
  241. data/public/javascripts/rails.js +175 -0
  242. data/public/robots.txt +5 -0
  243. data/public/stylesheets/common.css +1236 -0
  244. data/public/stylesheets/dialog.css +67 -0
  245. data/public/stylesheets/jquery-ui-1.8.4.custom.css +572 -0
  246. data/public/stylesheets/jquery.loadmask.css +40 -0
  247. data/public/stylesheets/reset.css +71 -0
  248. data/public/stylesheets/style.css +7 -0
  249. data/public/stylesheets/vtip.css +28 -0
  250. data/script/rails +6 -0
  251. data/test/functional/accounts_controller_test.rb +8 -0
  252. data/test/functional/dialog_controller_test.rb +8 -0
  253. data/test/functional/home_controller_test.rb +8 -0
  254. data/test/functional/host_pools_controller_test.rb +8 -0
  255. data/test/functional/images_controller_test.rb +8 -0
  256. data/test/functional/information_controller_test.rb +8 -0
  257. data/test/functional/instances_controller_test.rb +8 -0
  258. data/test/functional/keypairs_controller_test.rb +8 -0
  259. data/test/functional/security_groups_controller_test.rb +8 -0
  260. data/test/functional/sessions_controller_test.rb +8 -0
  261. data/test/functional/snapshots_controller_test.rb +8 -0
  262. data/test/functional/storage_pools_controller_test.rb +8 -0
  263. data/test/functional/users_controller_test.rb +8 -0
  264. data/test/functional/volumes_controller_test.rb +8 -0
  265. data/test/performance/browsing_test.rb +9 -0
  266. data/test/test_helper.rb +13 -0
  267. data/test/unit/helpers/accounts_helper_test.rb +4 -0
  268. data/test/unit/helpers/dialog_helper_test.rb +4 -0
  269. data/test/unit/helpers/home_helper_test.rb +4 -0
  270. data/test/unit/helpers/host_pools_helper_test.rb +4 -0
  271. data/test/unit/helpers/images_helper_test.rb +4 -0
  272. data/test/unit/helpers/information_helper_test.rb +4 -0
  273. data/test/unit/helpers/instances_helper_test.rb +4 -0
  274. data/test/unit/helpers/keypairs_helper_test.rb +4 -0
  275. data/test/unit/helpers/security_groups_helper_test.rb +4 -0
  276. data/test/unit/helpers/sessions_helper_test.rb +4 -0
  277. data/test/unit/helpers/snapshots_helper_test.rb +4 -0
  278. data/test/unit/helpers/storage_pools_helper_test.rb +4 -0
  279. data/test/unit/helpers/users_helper_test.rb +4 -0
  280. data/test/unit/helpers/volumes_helper_test.rb +4 -0
  281. metadata +399 -0
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ DcmgrGui::Application.load_tasks
8
+
9
+ $LOAD_PATH.unshift File.expand_path('../../../dcmgr/lib', __FILE__)
10
+
11
+ desc "build gem packages"
12
+ task :gem do
13
+ require 'rubygems'
14
+ require 'rake/gempackagetask'
15
+ require 'dcmgr'
16
+
17
+ spec = Gem::Specification.new do |s|
18
+ s.platform = Gem::Platform::RUBY
19
+ s.version = Dcmgr::VERSION
20
+ s.authors = ['axsh Ltd.']
21
+ s.email = ['dev@axsh.net']
22
+ s.name = 'wakame-vdc-webui'
23
+ s.summary = "Datacenter management toolkit for IaaS Cloud: UI frontend"
24
+ s.required_ruby_version = '>= 1.8.7'
25
+
26
+ s.files = Dir['app/**/*.{rb,erb}','lib/**/*.rb',
27
+ 'config/**/*.{rb,yml}', 'db/**/*.rb',
28
+ 'extras/**/*.rb', 'public/**/*.*',
29
+ 'lib/**/*.{rb,rake}', 'test/**/*.rb',
30
+ 'vendor/plugins/**/*.*', 'tmp/',
31
+ 'script/*', 'test/**/*.rb', 'doc/**/*.*'] +
32
+ %w(Rakefile config.ru README LICENSE NOTICE INSTALL.txt tmp)
33
+
34
+ s.add_dependency "rails", '3.0.0'
35
+ s.add_dependency 'mysql','2.8.1'
36
+ s.add_dependency 'sequel','3.15.0'
37
+ s.add_dependency 'json','1.4.6'
38
+ end
39
+
40
+ File.open("#{spec.name}.gemspec", 'w'){|f| f.write(spec.to_ruby) }
41
+ sh "gem build #{spec.name}.gemspec"
42
+ end
@@ -0,0 +1,15 @@
1
+ class AccountsController < ApplicationController
2
+ def switch
3
+ account_uuid = params[:accounts][:account_uuid]
4
+
5
+ user = User.find(:uuid => @current_user.uuid)
6
+ user.primary_account_id = account_uuid
7
+ user.save
8
+
9
+ redirect_to :root
10
+ end
11
+
12
+ def index
13
+
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ include Authentication
4
+ before_filter :login_required
5
+ end
@@ -0,0 +1,80 @@
1
+ class DialogController < ApplicationController
2
+ layout false
3
+
4
+ def create_volume
5
+ end
6
+
7
+ def create_volume_from_snapshot
8
+ @snapshot_ids = params[:ids]
9
+ end
10
+
11
+ def attach_volume
12
+ @volume_id = params[:ids][0]
13
+ end
14
+
15
+ def detach_volume
16
+ @volume_ids = params[:ids]
17
+ end
18
+
19
+ def delete_volume
20
+ @volume_ids = params[:ids]
21
+ end
22
+
23
+ def create_snapshot
24
+ @volume_ids = params[:ids]
25
+ end
26
+
27
+ def delete_snapshot
28
+ @snapshot_ids = params[:ids]
29
+ end
30
+
31
+ def start_instances
32
+ @instance_ids = params[:ids]
33
+ end
34
+
35
+ def stop_instances
36
+ @instance_ids = params[:ids]
37
+ end
38
+
39
+ def reboot_instances
40
+ @instance_ids = params[:ids]
41
+ end
42
+
43
+ def terminate_instances
44
+ @instance_ids = params[:ids]
45
+ end
46
+
47
+ def create_security_group
48
+ @uuid = ''
49
+ @description = ''
50
+ @rule = ''
51
+ render :create_and_edit_security_group
52
+ end
53
+
54
+ def delete_security_group
55
+ @uuid = params[:ids][0]
56
+ @netfilter_group = DcmgrResource::NetfilterGroup.show(@uuid)
57
+ @name = @netfilter_group['name']
58
+ end
59
+
60
+ def edit_security_group
61
+ @uuid = params[:ids][0]
62
+ @netfilter_group = DcmgrResource::NetfilterGroup.show(@uuid)
63
+
64
+ @name = @netfilter_group['name']
65
+ @description = @netfilter_group["description"]
66
+ @rule = @netfilter_group["rule"]
67
+ render :create_and_edit_security_group
68
+ end
69
+
70
+ def launch_instance
71
+ @image_id = params[:ids][0]
72
+ end
73
+
74
+ def create_ssh_keypair
75
+ end
76
+
77
+ def delete_ssh_keypair
78
+ @ssh_keypair_id = params[:ids][0]
79
+ end
80
+ end
@@ -0,0 +1,5 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ @informations = Information.all
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ class HostPoolsController < ApplicationController
2
+ respond_to :json
3
+
4
+ def index
5
+ end
6
+
7
+ def list
8
+ data = {
9
+ :start => params[:start].to_i - 1,
10
+ :limit => params[:limit]
11
+ }
12
+ host_pools = DcmgrResource::HostPool.list(data)
13
+ respond_with(host_pools[0], :to => [:json])
14
+ end
15
+
16
+ def show
17
+ host_pool_id = params[:id]
18
+ detail = DcmgrResource::HostPool.show(host_pool_id)
19
+ respond_with(detail,:to => [:json])
20
+ end
21
+
22
+ def show_host_pools
23
+ host_pools = DcmgrResource::HostPool.list
24
+ respond_with(host_pools[0],:to => [:json])
25
+ end
26
+ end
@@ -0,0 +1,28 @@
1
+ class ImagesController < ApplicationController
2
+ respond_to :json
3
+
4
+ def index
5
+ end
6
+
7
+ # images/show/1.json
8
+ def show
9
+ image_id = params[:id]
10
+ detail = DcmgrResource::Image.show(image_id)
11
+ respond_with(detail,:to => [:json])
12
+ end
13
+
14
+
15
+ def list
16
+ data = {
17
+ :start => params[:start].to_i - 1,
18
+ :limit => params[:limit]
19
+ }
20
+ image = DcmgrResource::Image.list(data)
21
+ respond_with(image[0],:to => [:json])
22
+ end
23
+
24
+ def total
25
+ total_resource = DcmgrResource::Image.total_resource
26
+ render :json => total_resource
27
+ end
28
+ end
@@ -0,0 +1,10 @@
1
+ class InformationController < ApplicationController
2
+ def index
3
+ end
4
+
5
+ def rss
6
+ @feed_title = "Wakame VDC Informations"
7
+ @informations = Information.all
8
+ render :layout => false
9
+ end
10
+ end
@@ -0,0 +1,59 @@
1
+ class InstancesController < ApplicationController
2
+ respond_to :json
3
+
4
+ def index
5
+ end
6
+
7
+ def create
8
+ data = {
9
+ :image_id => params[:image_id],
10
+ :instance_spec_id => params[:instance_spec_id],
11
+ :host_pool_id => params[:host_pool_id],
12
+ :host_name => params[:host_name],
13
+ :user_data => params[:user_data],
14
+ :nf_group => params[:nf_group],
15
+ :ssh_key => params[:ssh_key]
16
+ }
17
+ instance = DcmgrResource::Instance.create(params)
18
+ render :json => instance
19
+ end
20
+
21
+ def list
22
+ data = {
23
+ :start => params[:start].to_i - 1,
24
+ :limit => params[:limit]
25
+ }
26
+ instances = DcmgrResource::Instance.list(data)
27
+ respond_with(instances[0],:to => [:json])
28
+ end
29
+
30
+ def show
31
+ instance_id = params[:id]
32
+ detail = DcmgrResource::Instance.show(instance_id)
33
+ respond_with(detail,:to => [:json])
34
+ end
35
+
36
+ def terminate
37
+ instance_ids = params[:ids]
38
+ response = []
39
+ instance_ids.each do |instance_id|
40
+ response << DcmgrResource::Instance.destroy(instance_id)
41
+ end
42
+ render :json => response
43
+ end
44
+
45
+ def reboot
46
+ instance_ids = params[:ids]
47
+ response = []
48
+ instance_ids.each do |instance_id|
49
+ response << DcmgrResource::Instance.reboot(instance_id)
50
+ end
51
+ render :json => response
52
+ end
53
+
54
+ def total
55
+ total_resource = DcmgrResource::Instance.total_resource
56
+ render :json => total_resource
57
+ end
58
+
59
+ end
@@ -0,0 +1,64 @@
1
+ class KeypairsController < ApplicationController
2
+ respond_to :json,:except => [:create,:prk_download]
3
+
4
+ def index
5
+ end
6
+
7
+ def list
8
+ data = {
9
+ :start => params[:start].to_i - 1,
10
+ :limit => params[:limit]
11
+ }
12
+ @ssh_key_pair = DcmgrResource::SshKeyPair.list(data)
13
+ respond_with(@ssh_key_pair[0],:to => [:json])
14
+ end
15
+
16
+ def show
17
+ uuid = params[:id]
18
+ @ssh_key_pair = DcmgrResource::SshKeyPair.show(uuid)
19
+ respond_with(@ssh_key_pair,:to => [:json])
20
+ end
21
+
22
+ def destroy
23
+ name = params[:id]
24
+ @ssh_key_pair = DcmgrResource::SshKeyPair.destroy(name)
25
+ render :json => @ssh_key_pair
26
+ end
27
+
28
+ def create_ssh_keypair
29
+ data = {
30
+ :name => params[:name],
31
+ :download_once => params[:download_once]
32
+ }
33
+
34
+ @filename = params[:name] + ".pem"
35
+ @ssh_key_pair = DcmgrResource::SshKeyPair.create(data)
36
+
37
+ send_data(@ssh_key_pair.private_key,{
38
+ :filename => @filename,
39
+ :type => 'application/pgp-encrypted',
40
+ :status => 200
41
+ })
42
+ end
43
+
44
+ def show_keypairs
45
+ @ssh_key_pair = DcmgrResource::SshKeyPair.list
46
+ respond_with(@ssh_key_pair[0],:to => [:json])
47
+ end
48
+
49
+ def total
50
+ total_resource = DcmgrResource::SshKeyPair.total_resource
51
+ render :json => total_resource
52
+ end
53
+
54
+ def prk_download
55
+ uuid = params[:id]
56
+ @ssh_key_pair = DcmgrResource::SshKeyPair.show(uuid)
57
+ @filename = @ssh_key_pair['name'] + ".pem"
58
+ send_data(@ssh_key_pair['private_key'],{
59
+ :filename => @filename,
60
+ :type => 'application/pgp-encrypted',
61
+ :status => 200
62
+ })
63
+ end
64
+ end
@@ -0,0 +1,59 @@
1
+ class SecurityGroupsController < ApplicationController
2
+ respond_to :json
3
+
4
+ def index
5
+ end
6
+
7
+ # security_groups/show/1.json
8
+ def list
9
+ data = {
10
+ :start => params[:start].to_i - 1,
11
+ :limit => params[:limit]
12
+ }
13
+ @netfilter_group = DcmgrResource::NetfilterGroup.list(data)
14
+ respond_with(@netfilter_group[0],:to => [:json])
15
+ end
16
+
17
+ # security_groups/detail/s-000001.json
18
+ def show
19
+ uuid = params[:id]
20
+ @netfilter_group = DcmgrResource::NetfilterGroup.show(uuid)
21
+ respond_with(@netfilter_group,:to => [:json])
22
+ end
23
+
24
+ def create
25
+ data = {
26
+ :name => params[:name],
27
+ :description => params[:description],
28
+ :rule => params[:rule]
29
+ }
30
+ @netfilter_group = DcmgrResource::NetfilterGroup.create(data)
31
+ render :json => @netfilter_group
32
+ end
33
+
34
+ def destroy
35
+ uuid = params[:id]
36
+ @netfilter_group = DcmgrResource::NetfilterGroup.destroy(uuid)
37
+ render :json => @netfilter_group
38
+ end
39
+
40
+ def update
41
+ uuid = params[:id]
42
+ data = {
43
+ :description => params[:description],
44
+ :rule => params[:rule]
45
+ }
46
+ @netfilter_group = DcmgrResource::NetfilterGroup.update(uuid,data)
47
+ render :json => @netfilter_group
48
+ end
49
+
50
+ def show_groups
51
+ @netfilter_group = DcmgrResource::NetfilterGroup.list
52
+ respond_with(@netfilter_group[0],:to => [:json])
53
+ end
54
+
55
+ def total
56
+ total_resource = DcmgrResource::NetfilterGroup.total_resource
57
+ render :json => total_resource
58
+ end
59
+ end
@@ -0,0 +1,25 @@
1
+ class SessionsController < ApplicationController
2
+ layout 'login'
3
+ skip_before_filter :login_required
4
+
5
+ def new
6
+ @user = User.new
7
+ end
8
+
9
+ def create
10
+ user = User.authenticate(params[:login], params[:password])
11
+ if user
12
+ self.current_user = user
13
+ redirect_back_or_default('/', :notice => "Logged in successfully")
14
+ else
15
+ # note_failed_signin
16
+ @login = params[:login]
17
+ render :action => 'new'
18
+ end
19
+ end
20
+
21
+ def destroy
22
+ logout_killing_session!
23
+ redirect_back_or_default('/', :notice => "You have been logged out.")
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ class SnapshotsController < ApplicationController
2
+ respond_to :json
3
+ include Util
4
+
5
+ def index
6
+ end
7
+
8
+ def create
9
+ volume_ids = params[:ids]
10
+ response = []
11
+ volume_ids.each do |volume_id|
12
+ data = {
13
+ :volume_id => volume_id
14
+ }
15
+ response << DcmgrResource::VolumeSnapshot.create(data)
16
+ end
17
+ render :json => response
18
+ end
19
+
20
+ def destroy
21
+ snapshot_ids = params[:ids]
22
+ response = []
23
+ snapshot_ids.each do |snapshot_id|
24
+ response << DcmgrResource::VolumeSnapshot.delete(snapshot_id)
25
+ end
26
+ render :json => response
27
+ end
28
+
29
+ def list
30
+ data = {
31
+ :start => params[:start].to_i - 1,
32
+ :limit => params[:limit]
33
+ }
34
+ snapshots = DcmgrResource::VolumeSnapshot.list(data)
35
+ respond_with(snapshots[0], :to => [:json])
36
+ end
37
+
38
+ def show
39
+ snapshot_id = params[:id]
40
+ detail = DcmgrResource::VolumeSnapshot.show(snapshot_id)
41
+ respond_with(detail,:to => [:json])
42
+ end
43
+
44
+ def total
45
+ total_resource = DcmgrResource::VolumeSnapshot.total_resource
46
+ render :json => total_resource
47
+ end
48
+ end