1 ### $Id: remove.py 16497 2010-01-07 03:33:24Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/remove.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.credential import Credential
12 Remove an object from the registry. If the object represents a PLC object,
13 then the PLC records will also be removed.
15 @param cred credential string
16 @param type record type
17 @param xrn human readable name of record to remove (hrn or urn)
19 @return 1 if successful, faults otherwise
22 interfaces = ['registry']
25 Parameter(str, "Human readable name of slice to instantiate (hrn or urn)"),
26 Mixed(Parameter(str, "Credential string"),
27 Parameter(type([str]), "List of credentials")),
28 Mixed(Parameter(str, "Record type"),
29 Parameter(None, "Type not specified")),
32 returns = Parameter(int, "1 if successful")
34 def call(self, xrn, creds, type):
36 hrn = urn_to_hrn(xrn)[0]
38 hrn, type = urn_to_hrn(xrn)
41 valid_creds = self.api.auth.checkCredentials(creds, "remove")
42 self.api.auth.verify_object_permission(hrn)
45 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
46 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
49 manager = self.api.get_interface_manager()
51 return manager.remove(self.api, xrn, type)