get rid of svn keywords once and for good
[plcapi.git] / PLC / Methods / GetNodeGroups.py
1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Filter import Filter
5 from PLC.Auth import Auth
6 from PLC.NodeGroups import NodeGroup, NodeGroups
7
8 class GetNodeGroups(Method):
9     """
10     Returns an array of structs containing details about node groups.
11     If nodegroup_filter is specified and is an array of node group
12     identifiers or names, or a struct of node group attributes, only
13     node groups matching the filter will be returned. If return_fields
14     is specified, only the specified details will be returned.
15     """
16
17     roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous']
18
19     accepts = [
20         Auth(),
21         Mixed([Mixed(NodeGroup.fields['nodegroup_id'],
22                      NodeGroup.fields['groupname'])],
23               Filter(NodeGroup.fields)),
24         Parameter([str], "List of fields to return", nullok = True)
25         ]
26
27     returns = [NodeGroup.fields]
28
29     def call(self, auth, nodegroup_filter = None, return_fields = None):
30         return NodeGroups(self.api, nodegroup_filter, return_fields)