use self.get_auth_info
[sfa.git] / sfa / methods / get_slices.py
1 ### $Id$
2 ### $URL$
3
4 from sfa.util.faults import *
5 from sfa.util.misc import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8 from sfa.util.auth import Auth
9 from sfa.util.slices import Slices
10
11 class get_slices(Method):
12     """
13     Get a list of instantiated slices at this authority.      
14
15     @param cred credential string specifying the rights of the caller
16     @return list of human readable slice names (hrn).  
17     """
18
19     interfaces = ['aggregate', 'slicemgr']
20     
21     accepts = [
22         Parameter(str, "Credential string"),
23         ]
24
25     returns = [Parameter(str, "Human readable slice name (hrn)")]
26     
27     def call(self, cred):
28        
29         self.api.auth.check(cred, 'listslices')
30         slices = Slices(self.api)
31         slices.refresh()    
32         return slices['hrn']