387981d46b6eff05ab06cb47c27da4b73567d522
[sfa.git] / sfa / methods / reset_slice.py
1 from sfa.util.xrn import urn_to_hrn
2 from sfa.util.method import Method
3 from sfa.util.parameter import Parameter, Mixed
4
5 class reset_slice(Method):
6     """
7     Reset the specified slice      
8
9     @param cred credential string specifying the rights of the caller
10     @param xrn human readable name of slice to instantiate (hrn or urn)
11     @return 1 is successful, faults otherwise  
12     """
13
14     interfaces = ['aggregate', 'slicemgr', 'component']
15     
16     accepts = [
17         Parameter(str, "Credential string"),
18         Parameter(str, "Human readable name of slice to instantiate (hrn or urn)"),
19         Mixed(Parameter(str, "Human readable name of the original caller"),
20               Parameter(None, "Origin hrn not specified"))
21         ]
22
23     returns = Parameter(int, "1 if successful")
24     
25     def call(self, cred, xrn, origin_hrn=None):
26         hrn, type = urn_to_hrn(xrn)
27         self.api.auth.check(cred, 'resetslice', hrn)
28         self.api.manager.reset_slice (self.api, xrn)
29         return 1