add site_tags : GetSites() now returns 'site_tag_ids' attribute.
[plcapi.git] / PLC / Methods / GetSiteTags.py
1 # $Id: GetSiteTags.py 14587 2009-07-19 13:18:50Z thierry $
2 # $URL: http://svn.planet-lab.org/svn/PLCAPI/tags/PLCAPI-4.3-27/PLC/Methods/GetSiteTags.py $
3 #
4 # Thierry Parmentelat - INRIA
5 #
6 # $Revision: 14587 $
7 #
8 from PLC.Faults import *
9 from PLC.Method import Method
10 from PLC.Parameter import Parameter, Mixed
11 from PLC.Filter import Filter
12 from PLC.Auth import Auth
13
14 from PLC.SiteTags import SiteTag, SiteTags
15 from PLC.Sites import Site, Sites
16
17 class GetSiteTags(Method):
18     """
19     Returns an array of structs containing details about
20     sites and related settings.
21
22     If site_tag_filter is specified and is an array of
23     site setting identifiers, only site settings matching
24     the filter will be returned. If return_fields is specified, only
25     the specified details will be returned.
26     """
27
28     roles = ['admin', 'pi', 'user', 'node']
29
30     accepts = [
31         Auth(),
32         Mixed([SiteTag.fields['site_tag_id']],
33               Parameter(int,"Site setting id"),
34               Filter(SiteTag.fields)),
35         Parameter([str], "List of fields to return", nullok = True)
36         ]
37
38     returns = [SiteTag.fields]
39     
40
41     def call(self, auth, site_tag_filter = None, return_fields = None):
42
43         site_tags = SiteTags(self.api, site_tag_filter, return_fields)
44
45         return site_tags