1 from sfa.util.xrn import Xrn
2 from sfa.util.method import Method
3 from sfa.util.sfalogging import logger
5 from sfa.trust.credential import Credential
7 from sfa.storage.parameter import Parameter, Mixed
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):
35 xrn = Xrn(xrn, type=type)
38 valid_creds = self.api.auth.checkCredentials(creds, "remove")
39 self.api.auth.verify_object_permission(xrn.get_hrn())
42 origin_hrn = Credential(
43 string=valid_creds[0]).get_gid_caller().get_hrn()
44 logger.info("interface: %s\tmethod-name: %s\tcaller-hrn: %s\ttarget-urn: %s" % (
45 self.api.interface, self.name, origin_hrn, xrn.get_urn()))
47 return self.api.manager.Remove(self.api, xrn)