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