cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
vm.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 ##
21 # @package src.clm.views.user.vm
22 # @alldecoratedby{src.clm.utils.decorators.user_log}
23 # @author Maciej Nabo┼╝ny <di.dijo@gmail.com>
24 #
25 
26 from clm.models.user import User
27 from clm.utils.decorators import user_log, cm_request
28 from clm.utils.cm import CM
29 from common.states import group_states
30 
31 
32 @user_log(log=True, pack=False)
33 ##
34 #
35 # @clmview_user
36 # @asrequired{src.cm.element.role.action} except for @prm{groups}.
37 #
38 def create(cm_id, caller_id, **data):
39  user = User.get(caller_id)
40  groups = list(user.group_set.filter(usergroup__status__exact=group_states['ok']).values_list('id', flat=True))
41  return CM(cm_id).send_request("user/vm/create/", caller_id=caller_id, groups=groups, **data)
42 
43 
44 @user_log(log=True, pack=False)
45 @cm_request
46 ##
47 #
48 # @clmview_user
49 # @cm_request_transparent{user.vm.destroy()}
50 #
51 def destroy(cm_response, **data):
52  return cm_response
53 
54 
55 @user_log(log=False, pack=False)
56 @cm_request
57 ##
58 #
59 # @clmview_user
60 # @cm_request_transparent{user.vm.get_list()}
61 #
62 def get_list(cm_response, **data):
63  return cm_response
64 
65 
66 @user_log(log=False, pack=False)
67 @cm_request
68 ##
69 #
70 # @clmview_user
71 # @cm_request_transparent{user.vm.get_by_id()}
72 #
73 def get_by_id(cm_response, **data): # @todo rename for fun name consistency
74  return cm_response
75 
76 
77 @user_log(log=True, pack=False)
78 @cm_request
79 ##
80 #
81 # @clmview_user
82 # @cm_request_transparent{user.vm.save_and_shutdown()}
83 #
84 def save_and_shutdown(cm_response, **data):
85  return cm_response
86 
87 
88 @user_log(log=True, pack=False)
89 @cm_request
90 ##
91 #
92 # @clmview_user
93 # @cm_request_transparent{user.vm.reset()}
94 #
95 def reset(cm_response, **data):
96  return cm_response
97 
98 
99 @user_log(log=True, pack=False)
100 @cm_request
101 ##
102 #
103 # @clmview_user
104 # @cm_request_transparent{user.vm.edit()}
105 #
106 def edit(cm_response, **data):
107  return cm_response
108 
109 
110 @user_log(log=True, pack=False)
111 @cm_request
112 ##
113 #
114 # @clmview_user
115 # @cm_request_transparent{user.vm.attach_vnc()}
116 #
117 def attach_vnc(cm_response, **data):
118  return cm_response
119 
120 
121 @user_log(log=True, pack=False)
122 @cm_request
123 ##
124 #
125 # @clmview_user
126 # @cm_request_transparent{user.vm.detach_vnc()}
127 #
128 def detach_vnc(cm_response, **data):
129  return cm_response
130