1 from sfa.util.method import Method
3 from sfa.trust.credential import Credential
5 from sfa.storage.parameter import Parameter, Mixed
8 class Register(Method):
10 Register an object with the registry. In addition to being stored in the
11 SFA database, the appropriate records will also be created in the
14 @param cred credential string
15 @param record_dict dictionary containing record fields
17 @return gid string representation
20 interfaces = ['registry']
23 Parameter(dict, "Record dictionary containing record fields"),
24 Mixed(Parameter(str, "Credential string"),
25 Parameter(type([str]), "List of credentials")),
28 returns = Parameter(int, "String representation of gid object")
30 def call(self, record, creds):
32 valid_creds = self.api.auth.checkCredentials(creds, 'register')
35 hrn = record.get('hrn', '')
36 self.api.auth.verify_object_permission(hrn)
39 origin_hrn = Credential(
40 string=valid_creds[0]).get_gid_caller().get_hrn()
41 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s" %
42 (self.api.interface, origin_hrn, hrn, self.name))
44 return self.api.manager.Register(self.api, record)