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