svn keywords
[plcapi.git] / PLC / Methods / GetSites.py
1 # $Id$
2 # $URL$
3 from PLC.Method import Method
4 from PLC.Parameter import Parameter, Mixed
5 from PLC.Filter import Filter
6 from PLC.Auth import Auth
7 from PLC.Sites import Site, Sites
8
9 class GetSites(Method):
10     """
11     Returns an array of structs containing details about sites. If
12     site_filter is specified and is an array of site identifiers or
13     hostnames, or a struct of site attributes, only sites matching the
14     filter will be returned. If return_fields is specified, only the
15     specified details will be returned.
16     """
17
18     roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous']
19
20     accepts = [
21         Auth(),
22         Mixed([Mixed(Site.fields['site_id'],
23                      Site.fields['login_base'])],
24               Parameter(str,"login_base"),
25               Parameter(int,"site_id"),
26               Filter(Site.fields)),
27         Parameter([str], "List of fields to return", nullok = True)        
28         ]
29
30     returns = [Site.fields]
31
32     def call(self, auth, site_filter = None, return_fields = None):
33         return Sites(self.api, site_filter, return_fields)