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