added more methods
[sfa.git] / geni / methods / delete_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.aggregate import Aggregates
8 from geni.util.slices import Slices
9
10 class delete_slice(Method):
11     """
12     Remove the slice from all nodes.      
13
14     @param cred credential string specifying the rights of the caller
15     @param hrn human readable name specifying the slice to delete
16     @return 1 if successful, faults otherwise  
17     """
18
19     interfaces = ['aggregate', 'slicemgr']
20     
21     accepts = [
22         Parameter(str, "Credential string"),
23         Parameter(str, "Human readable name of slice to delete"),
24         ]
25
26     returns = [Parameter(int, "1 if successful")]
27     
28     def call(self, cred, hrn):
29        
30         self.api.auth.check(cred, 'deleteslice')
31         slices = Slices(self.api)
32         slices.delete_slice(hrn)
33         return 1