checkpoint
[sfa.git] / geni / methods / delete_slice.py
1 ### $Id$
2 ### $URL$
3
4 from geni.util.faults import *
5 from geni.util.misc import *
6 from geni.util.method import Method
7 from geni.util.parameter import Parameter, Mixed
8 from geni.util.auth import Auth
9
10 from geni.util.slices import Slices
11
12 class delete_slice(Method):
13     """
14     Remove the slice from all nodes.      
15
16     @param cred credential string specifying the rights of the caller
17     @param hrn human readable name specifying the slice to delete
18     @return 1 if successful, faults otherwise  
19     """
20
21     interfaces = ['aggregate', 'slicemgr']
22     
23     accepts = [
24         Parameter(str, "Credential string"),
25         Parameter(str, "Human readable name of slice to delete"),
26         ]
27
28     returns = [Parameter(int, "1 if successful")]
29     
30     def call(self, cred, hrn):
31        
32         self.api.auth.check(cred, 'deleteslice')
33         slices = Slices(self.api)
34         slices.delete_slice(hrn)
35         return 1