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