1 from sfa.util.faults import RecordNotFound
2 from sfa.util.method import Method
4 from sfa.trust.credential import Credential
6 from sfa.storage.parameter import Parameter, Mixed
10 Get a list of record information (hrn, gid and type) for
13 @param cred credential string
14 @param cert certificate string
18 interfaces = ['registry']
21 Mixed(Parameter(str, "Human readable name (hrn or xrn)"),
22 Parameter(type([str]), "List of Human readable names (hrn or xrn)")),
23 Mixed(Parameter(str, "Credential string"),
24 Parameter(type([str]), "List of credentials")),
27 returns = [Parameter(dict, "Dictionary of gids keyed on hrn")]
29 def call(self, xrns, creds):
30 # validate the credential
31 valid_creds = self.api.auth.checkCredentials(creds, 'getgids')
32 # xxxpylintxxx origin_hrn is unused..
33 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
36 records = self.api.manager.Resolve(self.api, xrns, full = False)
38 raise RecordNotFound(xrns)
40 allowed_fields = ['hrn', 'type', 'gid']
41 for record in records:
42 for key in record.keys():
43 if key not in allowed_fields: