wakame-vdc-webui 10.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL.txt +21 -0
- data/LICENSE +202 -0
- data/NOTICE +1 -0
- data/README +256 -0
- data/Rakefile +42 -0
- data/app/controllers/accounts_controller.rb +15 -0
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/dialog_controller.rb +80 -0
- data/app/controllers/home_controller.rb +5 -0
- data/app/controllers/host_pools_controller.rb +26 -0
- data/app/controllers/images_controller.rb +28 -0
- data/app/controllers/information_controller.rb +10 -0
- data/app/controllers/instances_controller.rb +59 -0
- data/app/controllers/keypairs_controller.rb +64 -0
- data/app/controllers/security_groups_controller.rb +59 -0
- data/app/controllers/sessions_controller.rb +25 -0
- data/app/controllers/snapshots_controller.rb +48 -0
- data/app/controllers/storage_pools_controller.rb +27 -0
- data/app/controllers/users_controller.rb +3 -0
- data/app/controllers/volumes_controller.rb +86 -0
- data/app/helpers/accounts_helper.rb +2 -0
- data/app/helpers/application_helper.rb +23 -0
- data/app/helpers/dialog_helper.rb +2 -0
- data/app/helpers/home_helper.rb +2 -0
- data/app/helpers/host_pools_helper.rb +2 -0
- data/app/helpers/images_helper.rb +2 -0
- data/app/helpers/information_helper.rb +2 -0
- data/app/helpers/instances_helper.rb +2 -0
- data/app/helpers/keypairs_helper.rb +2 -0
- data/app/helpers/security_groups_helper.rb +2 -0
- data/app/helpers/sessions_helper.rb +2 -0
- data/app/helpers/snapshots_helper.rb +2 -0
- data/app/helpers/storage_pools_helper.rb +2 -0
- data/app/helpers/users_helper.rb +2 -0
- data/app/helpers/volumes_helper.rb +2 -0
- data/app/models/account.rb +104 -0
- data/app/models/authz.rb +102 -0
- data/app/models/base_new.rb +311 -0
- data/app/models/dcmgr_resource/account.rb +5 -0
- data/app/models/dcmgr_resource/base.rb +51 -0
- data/app/models/dcmgr_resource/host_pool.rb +11 -0
- data/app/models/dcmgr_resource/image.rb +11 -0
- data/app/models/dcmgr_resource/instance.rb +37 -0
- data/app/models/dcmgr_resource/mock.rb +15 -0
- data/app/models/dcmgr_resource/netfilter_group.rb +29 -0
- data/app/models/dcmgr_resource/ssh_key_pair.rb +25 -0
- data/app/models/dcmgr_resource/storage_pool.rb +11 -0
- data/app/models/dcmgr_resource/volume.rb +48 -0
- data/app/models/dcmgr_resource/volume_snapshot.rb +35 -0
- data/app/models/information.rb +9 -0
- data/app/models/schema.rb +51 -0
- data/app/models/tag.rb +121 -0
- data/app/models/tag_mapping.rb +25 -0
- data/app/models/user.rb +46 -0
- data/app/views/accounts/index.html.erb +68 -0
- data/app/views/dialog/attach_volume.html.erb +13 -0
- data/app/views/dialog/create_and_edit_security_group.html.erb +32 -0
- data/app/views/dialog/create_snapshot.html.erb +7 -0
- data/app/views/dialog/create_ssh_keypair.html.erb +15 -0
- data/app/views/dialog/create_volume.html.erb +18 -0
- data/app/views/dialog/create_volume_from_snapshot.html.erb +7 -0
- data/app/views/dialog/delete_security_group.html.erb +4 -0
- data/app/views/dialog/delete_snapshot.html.erb +7 -0
- data/app/views/dialog/delete_ssh_keypair.html.erb +4 -0
- data/app/views/dialog/delete_volume.html.erb +7 -0
- data/app/views/dialog/detach_volume.html.erb +7 -0
- data/app/views/dialog/launch_instance.html.erb +70 -0
- data/app/views/dialog/reboot_instances.html.erb +7 -0
- data/app/views/dialog/start_instances.html.erb +8 -0
- data/app/views/dialog/stop_instances.html.erb +7 -0
- data/app/views/dialog/terminate_instances.html.erb +7 -0
- data/app/views/home/index.html.erb +55 -0
- data/app/views/host_pools/index.html.erb +103 -0
- data/app/views/images/index.html.erb +126 -0
- data/app/views/information/index.html.erb +25 -0
- data/app/views/instances/index.html.erb +134 -0
- data/app/views/keypairs/index.html.erb +104 -0
- data/app/views/layouts/_footer.html.erb +4 -0
- data/app/views/layouts/_header.html.erb +14 -0
- data/app/views/layouts/_informationarea.html.erb +18 -0
- data/app/views/layouts/_login_header.erb +4 -0
- data/app/views/layouts/_service_health.erb +27 -0
- data/app/views/layouts/_sidemenu.html.erb +58 -0
- data/app/views/layouts/application.html.erb +34 -0
- data/app/views/layouts/login.html.erb +25 -0
- data/app/views/security_groups/index.html.erb +114 -0
- data/app/views/sessions/new.html.erb +27 -0
- data/app/views/snapshots/index.html.erb +110 -0
- data/app/views/storage_pools/index.html.erb +98 -0
- data/app/views/volumes/index.html.erb +117 -0
- data/config.ru +4 -0
- data/config/application.rb +48 -0
- data/config/boot.rb +13 -0
- data/config/database.yml +20 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +28 -0
- data/config/environments/production.rb +49 -0
- data/config/environments/test.rb +35 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/dcmgr_gui.rb +14 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +109 -0
- data/db/seeds.rb +7 -0
- data/extras/authentication.rb +94 -0
- data/extras/util.rb +5 -0
- data/lib/tasks/dcmgr_gui.rake +51 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/images/app_active.gif +0 -0
- data/public/images/app_passive.gif +0 -0
- data/public/images/body_bg.gif +0 -0
- data/public/images/btn_change.gif +0 -0
- data/public/images/btn_create_security_group.gif +0 -0
- data/public/images/btn_create_snapshot.gif +0 -0
- data/public/images/btn_create_volume.gif +0 -0
- data/public/images/btn_createkey.gif +0 -0
- data/public/images/btn_de_register.gif +0 -0
- data/public/images/btn_delete_security_group.gif +0 -0
- data/public/images/btn_delete_snapshot.gif +0 -0
- data/public/images/btn_delete_volume.gif +0 -0
- data/public/images/btn_deletekey.gif +0 -0
- data/public/images/btn_healthdetail.gif +0 -0
- data/public/images/btn_hide.gif +0 -0
- data/public/images/btn_launch.gif +0 -0
- data/public/images/btn_next.gif +0 -0
- data/public/images/btn_prev.gif +0 -0
- data/public/images/btn_refresh.gif +0 -0
- data/public/images/btn_register_new_ami.gif +0 -0
- data/public/images/btn_savechange.gif +0 -0
- data/public/images/btn_show.gif +0 -0
- data/public/images/btn_show_accesskey.png +0 -0
- data/public/images/bup_btn_healthdetail.gif +0 -0
- data/public/images/bup_btn_refresh.gif +0 -0
- data/public/images/clear.gif +0 -0
- data/public/images/content_bg.png +0 -0
- data/public/images/content_foot_bg.gif +0 -0
- data/public/images/content_head_bg.gif +0 -0
- data/public/images/footer_bg.gif +0 -0
- data/public/images/head_gradation_bg.gif +0 -0
- data/public/images/header_logo.gif +0 -0
- data/public/images/icon_blockstore.gif +0 -0
- data/public/images/icon_caution.gif +0 -0
- data/public/images/icon_health.gif +0 -0
- data/public/images/icon_images.gif +0 -0
- data/public/images/icon_information.gif +0 -0
- data/public/images/icon_instances.gif +0 -0
- data/public/images/icon_resource.gif +0 -0
- data/public/images/icon_resource01.gif +0 -0
- data/public/images/icon_resource02.gif +0 -0
- data/public/images/icon_resource03.gif +0 -0
- data/public/images/icon_resource04.gif +0 -0
- data/public/images/icon_rss.gif +0 -0
- data/public/images/icon_security.gif +0 -0
- data/public/images/icon_service.gif +0 -0
- data/public/images/icon_service_stat.gif +0 -0
- data/public/images/icon_stop.gif +0 -0
- data/public/images/icon_summary.gif +0 -0
- data/public/images/icon_ttl_accskey.gif +0 -0
- data/public/images/icon_ttl_detail.gif +0 -0
- data/public/images/icon_ttl_instance.gif +0 -0
- data/public/images/icon_ttl_personal_inf.gif +0 -0
- data/public/images/infra_active.gif +0 -0
- data/public/images/infra_passive.gif +0 -0
- data/public/images/lastelement_bg.gif +0 -0
- data/public/images/lastelement_bg.png +0 -0
- data/public/images/listicon_useast.gif +0 -0
- data/public/images/loader_ball.gif +0 -0
- data/public/images/loader_boxes.gif +0 -0
- data/public/images/loading.gif +0 -0
- data/public/images/mainarea_bottom_bg.gif +0 -0
- data/public/images/mainarea_content_bg.gif +0 -0
- data/public/images/mainarea_h3_bg.gif +0 -0
- data/public/images/mainarea_wide_bottom_bg.gif +0 -0
- data/public/images/mainarea_wide_content_bg.gif +0 -0
- data/public/images/mainarea_wide_h3_bg.gif +0 -0
- data/public/images/menu_list_header.gif +0 -0
- data/public/images/menu_list_header_current.gif +0 -0
- data/public/images/plat_active.gif +0 -0
- data/public/images/plat_passive.gif +0 -0
- data/public/images/regionselect_bg.gif +0 -0
- data/public/images/select_bg_126.gif +0 -0
- data/public/images/select_bg_139.gif +0 -0
- data/public/images/sidemenu_bg.gif +0 -0
- data/public/images/sidemenu_bottom.gif +0 -0
- data/public/images/sidemenu_top.gif +0 -0
- data/public/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/images/ui-bg_glass_55_fcf0ba_1x400.png +0 -0
- data/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/images/ui-bg_gloss-wave_100_ece8da_500x100.png +0 -0
- data/public/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png +0 -0
- data/public/images/ui-bg_highlight-hard_100_fafaf4_1x100.png +0 -0
- data/public/images/ui-bg_highlight-hard_15_459e00_1x100.png +0 -0
- data/public/images/ui-bg_highlight-hard_95_cccccc_1x100.png +0 -0
- data/public/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/images/ui-bg_highlight-soft_25_67b021_1x100.png +0 -0
- data/public/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/images/ui-bg_highlight-soft_95_ffedad_1x100.png +0 -0
- data/public/images/ui-bg_inset-soft_15_2b2922_1x100.png +0 -0
- data/public/images/ui-icons_222222_256x240.png +0 -0
- data/public/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/images/ui-icons_808080_256x240.png +0 -0
- data/public/images/ui-icons_847e71_256x240.png +0 -0
- data/public/images/ui-icons_8dc262_256x240.png +0 -0
- data/public/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/images/ui-icons_eeeeee_256x240.png +0 -0
- data/public/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/images/vtip_arrow.png +0 -0
- data/public/javascripts/controls.js +965 -0
- data/public/javascripts/dcmgr_gui/application.js +91 -0
- data/public/javascripts/dcmgr_gui/core.js +539 -0
- data/public/javascripts/dcmgr_gui/dashboard_panel.js +34 -0
- data/public/javascripts/dcmgr_gui/host_pool_panel.js +83 -0
- data/public/javascripts/dcmgr_gui/image_panel.js +242 -0
- data/public/javascripts/dcmgr_gui/instance_panel.js +197 -0
- data/public/javascripts/dcmgr_gui/security_group_panel.js +196 -0
- data/public/javascripts/dcmgr_gui/snapshot_panel.js +168 -0
- data/public/javascripts/dcmgr_gui/sshkeypair_panel.js +161 -0
- data/public/javascripts/dcmgr_gui/storage_pool_panel.js +99 -0
- data/public/javascripts/dcmgr_gui/volume_panel.js +311 -0
- data/public/javascripts/dragdrop.js +974 -0
- data/public/javascripts/effects.js +1123 -0
- data/public/javascripts/jquery-1.4.2.min.js +154 -0
- data/public/javascripts/jquery-ui-1.8.4.custom.min.js +763 -0
- data/public/javascripts/jquery.loadmask.min.js +10 -0
- data/public/javascripts/jquery.tmpl.js +486 -0
- data/public/javascripts/jsdeferred.jquery.js +385 -0
- data/public/javascripts/prototype.js +6001 -0
- data/public/javascripts/rails.js +175 -0
- data/public/robots.txt +5 -0
- data/public/stylesheets/common.css +1236 -0
- data/public/stylesheets/dialog.css +67 -0
- data/public/stylesheets/jquery-ui-1.8.4.custom.css +572 -0
- data/public/stylesheets/jquery.loadmask.css +40 -0
- data/public/stylesheets/reset.css +71 -0
- data/public/stylesheets/style.css +7 -0
- data/public/stylesheets/vtip.css +28 -0
- data/script/rails +6 -0
- data/test/functional/accounts_controller_test.rb +8 -0
- data/test/functional/dialog_controller_test.rb +8 -0
- data/test/functional/home_controller_test.rb +8 -0
- data/test/functional/host_pools_controller_test.rb +8 -0
- data/test/functional/images_controller_test.rb +8 -0
- data/test/functional/information_controller_test.rb +8 -0
- data/test/functional/instances_controller_test.rb +8 -0
- data/test/functional/keypairs_controller_test.rb +8 -0
- data/test/functional/security_groups_controller_test.rb +8 -0
- data/test/functional/sessions_controller_test.rb +8 -0
- data/test/functional/snapshots_controller_test.rb +8 -0
- data/test/functional/storage_pools_controller_test.rb +8 -0
- data/test/functional/users_controller_test.rb +8 -0
- data/test/functional/volumes_controller_test.rb +8 -0
- data/test/performance/browsing_test.rb +9 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/helpers/accounts_helper_test.rb +4 -0
- data/test/unit/helpers/dialog_helper_test.rb +4 -0
- data/test/unit/helpers/home_helper_test.rb +4 -0
- data/test/unit/helpers/host_pools_helper_test.rb +4 -0
- data/test/unit/helpers/images_helper_test.rb +4 -0
- data/test/unit/helpers/information_helper_test.rb +4 -0
- data/test/unit/helpers/instances_helper_test.rb +4 -0
- data/test/unit/helpers/keypairs_helper_test.rb +4 -0
- data/test/unit/helpers/security_groups_helper_test.rb +4 -0
- data/test/unit/helpers/sessions_helper_test.rb +4 -0
- data/test/unit/helpers/snapshots_helper_test.rb +4 -0
- data/test/unit/helpers/storage_pools_helper_test.rb +4 -0
- data/test/unit/helpers/users_helper_test.rb +4 -0
- data/test/unit/helpers/volumes_helper_test.rb +4 -0
- 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,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,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,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
|