class name should be create_slice not create_slices
[sfa.git] / geni / methods / create_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 create_slice(Method):
10     """
11     Instantiate the specified slice according to whats defined in the specified rspec      
12
13     @param cred credential string specifying the rights of the caller
14     @param hrn human readable name of slice to instantiate
15     @param rspec resource specification
16     @return 1 is 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 instantiate"),
24         Parameter(str, "Resource specification"),
25         ]
26
27     returns = [Parameter(int, "1 if successful")]
28     
29     def call(self, cred, hrn, rspec):
30        
31         self.api.auth.check(cred, 'createslice')
32         slices = Slices(self.api)
33         slices.create_slice(hrn, rspec)
34         
35         return 1