1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Sites import Site, Sites
5 from PLC.Auth import PasswordAuth
7 class AdmGetSiteNodes(Method):
9 Deprecated. See GetSites.
11 Return a dictionary containing a list of node_ids for each of the
14 Admins may retrieve details about all nodes on a site by not specifying
15 site_id_or_name or by specifying an empty list. Users and
16 techs may only retrieve details about themselves. PIs may retrieve
17 details about themselves and others at their sites.
22 roles = ['admin', 'pi', 'user', 'tech']
26 [Mixed(Site.fields['site_id'],
27 Site.fields['name'])],
30 returns = { Site.fields['site_id']: Site.fields['node_ids'] }
32 def call(self, auth, site_id_or_name_list = None):
33 # Get site information
34 sites = Sites(self.api, site_id_or_name_list).values()
36 raise PLCInvalidArgument, "No such site"
38 # Convert to {str(site_id): [node_id]}
41 site_nodes[str(site['site_id'])] = site['node_ids']