1 ### $Id: stop_slice.py 17732 2010-04-19 21:10:45Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/stop_slice.py $
4 from sfa.util.faults import *
5 from sfa.util.namespace import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8 from sfa.trust.auth import Auth
9 from sfa.trust.credential import Credential
11 class ListSlices(Method):
13 List the slices instantiated at this interface
15 @param cred credential string specifying the rights of the caller
16 @return 1 is successful, faults otherwise
19 interfaces = ['aggregate', 'slicemgr', 'component']
22 Mixed(Parameter(str, "Credential string"),
23 Parameter(type([str]), "List of credentials")),
26 returns = Parameter(list, "List of slice names")
28 def call(self, creds):
29 valid_creds = self.api.auth.checkCredentials(creds, 'listslices')
32 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
33 self.api.logger.info("interface: %s\tcaller-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, self.name))
35 manager = self.api.get_interface_manager()
36 return manager.get_slices(self.api, creds)