4 from sfa.util.faults import *
5 from sfa.util.method import Method
6 from sfa.util.parameter import Parameter, Mixed
7 from sfa.util.debug import log
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 hrn human readable name of record to remove
19 @return 1 if successful, faults otherwise
22 interfaces = ['registry']
25 Parameter(str, "Credential string"),
26 Parameter(str, "Record type"),
27 Parameter(str, "Human readable name of slice to instantiate"),
28 Mixed(Parameter(str, "Human readable name of the original caller"),
29 Parameter(None, "Origin hrn not specified"))
32 returns = Parameter(int, "1 if successful")
34 def call(self, cred, type, hrn, origin_hrn=None):
35 user_cred = Credential(string=cred)
39 origin_hrn = user_cred.get_gid_caller().get_hrn()
40 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
43 self.api.auth.check(cred, "remove")
44 self.api.auth.verify_object_permission(hrn)
46 # send the call to the right manager
47 manager_base = 'sfa.managers'
48 mgr_type = self.api.config.SFA_REGISTRY_TYPE
49 manager_module = manager_base + ".registry_manager_%s" % mgr_type
50 manager = __import__(manager_module, fromlist=[manager_base])
51 return manager.remove(self.api, hrn, type, origin_hrn)