Revision 65769612 commissioning/hlapi/api.py
b/commissioning/hlapi/api.py | ||
---|---|---|
91 | 91 |
|
92 | 92 |
|
93 | 93 |
# internal API |
94 |
@method_accepts(basestring, basestring, basestring, basestring,
|
|
94 |
@method_accepts(str, str, str, str,
|
|
95 | 95 |
int, int, int, int, int) |
96 |
@returns(basestring)
|
|
96 |
@returns(str)
|
|
97 | 97 |
def __create_attribute_of_node_for_resource(self, |
98 | 98 |
abs_or_not_node_name, |
99 | 99 |
intended_parent_node_name, |
... | ... | |
156 | 156 |
return computed_attribute_name |
157 | 157 |
|
158 | 158 |
|
159 |
@method_accepts(basestring)
|
|
160 |
@returns(basestring)
|
|
159 |
@method_accepts(str)
|
|
160 |
@returns(str)
|
|
161 | 161 |
def get_cached_node_key(self, node_name): |
162 | 162 |
check_abs_name(node_name, 'node_name') |
163 | 163 |
return self.__node_keys.get(node_name) or '' # sane default |
164 | 164 |
|
165 | 165 |
|
166 |
@method_accepts(basestring, basestring)
|
|
166 |
@method_accepts(str, str)
|
|
167 | 167 |
@returns(type(None)) |
168 | 168 |
def set_cached_node_key(self, abs_node_name, node_key, label='abs_node_name'): |
169 | 169 |
check_abs_name(abs_node_name, label) |
... | ... | |
178 | 178 |
return self.__node_keys.copy() # Client cannot mess with the original |
179 | 179 |
|
180 | 180 |
|
181 |
@method_accepts(basestring)
|
|
181 |
@method_accepts(str)
|
|
182 | 182 |
@returns(list) |
183 | 183 |
def get_node_children(self, node_name): |
184 | 184 |
check_abs_name(node_name, 'node_name') |
... | ... | |
213 | 213 |
return self.get_node_children(NameOfUsersNode) |
214 | 214 |
|
215 | 215 |
|
216 |
@method_accepts(basestring, basestring)
|
|
217 |
@returns(basestring)
|
|
216 |
@method_accepts(str, str)
|
|
217 |
@returns(str)
|
|
218 | 218 |
def ensure_node(self, abs_node_name, label='abs_node_name'): |
219 | 219 |
if not self.has_node(abs_node_name, label): |
220 | 220 |
return self.create_node(abs_node_name, label) |
... | ... | |
222 | 222 |
return abs_node_name |
223 | 223 |
|
224 | 224 |
|
225 |
@returns(basestring)
|
|
225 |
@returns(str)
|
|
226 | 226 |
def ensure_resources_node(self): |
227 | 227 |
""" |
228 | 228 |
Ensure that the node 'system/resources' exists. |
... | ... | |
230 | 230 |
return self.ensure_node(NameOfResourcesNode, 'NameOfResourcesNode') |
231 | 231 |
|
232 | 232 |
|
233 |
@returns(basestring)
|
|
233 |
@returns(str)
|
|
234 | 234 |
def ensure_groups_node(self): |
235 | 235 |
""" |
236 | 236 |
Ensure that the node 'system/groups' exists. |
... | ... | |
238 | 238 |
return self.ensure_node(NameOfGroupsNode, 'NameOfGroupsNode') |
239 | 239 |
|
240 | 240 |
|
241 |
@returns(basestring)
|
|
241 |
@returns(str)
|
|
242 | 242 |
def ensure_users_node(self): |
243 | 243 |
""" |
244 | 244 |
Ensure that the node 'system/users' exists. |
... | ... | |
246 | 246 |
return self.ensure_node(NameOfUsersNode, 'NameOfGroupsNode') |
247 | 247 |
|
248 | 248 |
|
249 |
@method_accepts(basestring, basestring)
|
|
249 |
@method_accepts(str, str)
|
|
250 | 250 |
@returns(bool) |
251 | 251 |
def has_node(self, abs_node_name, label='abs_node_name'): |
252 | 252 |
""" |
... | ... | |
263 | 263 |
return len(entity_owner_list) == 1 # TODO: any other check here? |
264 | 264 |
|
265 | 265 |
|
266 |
@method_accepts(basestring, basestring)
|
|
267 |
@returns(basestring)
|
|
266 |
@method_accepts(str, str)
|
|
267 |
@returns(str)
|
|
268 | 268 |
def create_node(self, node_name, label='node_name'): |
269 | 269 |
""" |
270 | 270 |
Creates a node with an absolute name ``node_name``. |
... | ... | |
306 | 306 |
return node_name |
307 | 307 |
|
308 | 308 |
|
309 |
@method_accepts(basestring)
|
|
309 |
@method_accepts(str)
|
|
310 | 310 |
@returns(bool) |
311 | 311 |
def has_global_resource(self, abs_resource_name): |
312 | 312 |
check_abs_global_resource_name(abs_resource_name) |
313 | 313 |
return self.has_node(abs_resource_name) |
314 | 314 |
|
315 | 315 |
|
316 |
@method_accepts(basestring)
|
|
316 |
@method_accepts(str)
|
|
317 | 317 |
def define_global_resource(self, resource_name): |
318 | 318 |
""" |
319 | 319 |
Defines a resource globally known to Quota Holder. |
... | ... | |
334 | 334 |
return self.create_node(abs_resource_name, 'abs_resource_name') |
335 | 335 |
|
336 | 336 |
|
337 |
@method_accepts(basestring, basestring, int, int, int, int, int)
|
|
338 |
@returns(basestring)
|
|
337 |
@method_accepts(str, str, int, int, int, int, int)
|
|
338 |
@returns(str)
|
|
339 | 339 |
def define_attribute_of_global_resource(self, |
340 | 340 |
global_resource_name, |
341 | 341 |
attribute_name, |
... | ... | |
375 | 375 |
|
376 | 376 |
|
377 | 377 |
|
378 |
@method_accepts(basestring, basestring)
|
|
379 |
@returns(basestring)
|
|
378 |
@method_accepts(str, str)
|
|
379 |
@returns(str)
|
|
380 | 380 |
def define_group(self, group_name, group_node_key=''): |
381 | 381 |
""" |
382 | 382 |
Creates a new group under 'system/groups'. |
... | ... | |
408 | 408 |
|
409 | 409 |
|
410 | 410 |
|
411 |
@method_accepts(basestring, basestring, basestring, int, int, int, int, int)
|
|
412 |
@returns(basestring)
|
|
411 |
@method_accepts(str, str, str, int, int, int, int, int)
|
|
412 |
@returns(str)
|
|
413 | 413 |
def define_attribute_of_group_for_resource(self, |
414 | 414 |
group_name, |
415 | 415 |
attribute_name, |
... | ... | |
436 | 436 |
flags=flags) |
437 | 437 |
|
438 | 438 |
|
439 |
@method_accepts(basestring, basestring, int, int, int, int, int, int, int)
|
|
439 |
@method_accepts(str, str, int, int, int, int, int, int, int)
|
|
440 | 440 |
@returns(type(None)) |
441 | 441 |
def define_group_resource(self, |
442 | 442 |
group_name, |
Also available in: Unified diff