check for the correct rights
[sfa.git] / geni / methods / stop_slice.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 stop_slice(Method):
10     """
11     Stop the specified slice      
12
13     @param cred credential string specifying the rights of the caller
14     @param hrn human readable name of slice to instantiate
15     @return 1 is successful, faults otherwise  
16     """
17
18     interfaces = ['aggregate', 'slicemgr']
19     
20     accepts = [
21         Parameter(str, "Credential string"),
22         Parameter(str, "Human readable name of slice to instantiate"),
23         ]
24
25     returns = [Parameter(int, "1 if successful")]
26     
27     def call(self, cred, hrn):
28        
29         self.api.auth.check(cred, 'stopslice')
30         slices = Slices(self.api)
31         slices.stop_slice(hrn)
32         
33         return 1