fixed up the names of new site names/slices to be more PLC compatible
[sfa.git] / sfa / methods / RedeemTicket.py
1 ### $Id: reset_slice.py 15428 2009-10-23 15:28:03Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfacomponent/methods/reset_slice.py $
3 import xmlrpclib
4 from sfa.util.faults import *
5 from sfa.util.method import Method
6 from sfa.util.parameter import Parameter, Mixed
7
8 class RedeemTicket(Method):
9     """
10     Deprecated. Use RedeemTicket instead.
11
12     @param cred credential string specifying the rights of the caller
13     @param ticket 
14     @return 1 is successful, faults otherwise  
15     """
16
17     interfaces = ['component']
18     
19     accepts = [
20         Parameter(str, "Ticket  string representation of SFA ticket"),
21         Mixed(Parameter(str, "Credential string"),
22               Parameter(type([str]), "List of credentials")),
23         ]
24
25     returns = [Parameter(int, "1 if successful")]
26     
27     def call(self, ticket, creds):
28         valid_creds = self.api.auth.checkCredentials(cred, 'redeemticket')
29         self.api.auth.check_ticket(ticket)
30
31         
32         # send the call to the right manager
33         manager = self.api.get_interface_manager()
34         manager.redeem_ticket(self.api, ticket) 
35         return 1