allow filters to be specified in most Get() calls
[plcapi.git] / PLC / Methods / GetConfFiles.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.ConfFiles import ConfFile, ConfFiles
6 from PLC.Auth import Auth
7
8 class GetConfFiles(Method):
9     """
10     Returns an array of structs containing details about configuration
11     files. If conf_file_filter is specified and is an array of
12     configuration file identifiers, or a struct of configuration file
13     attributes, only configuration files matching the filter will be
14     returned.
15     """
16
17     roles = ['admin']
18
19     accepts = [
20         Auth(),
21         Mixed([ConfFile.fields['conf_file_id']],
22               Filter(ConfFile.fields))
23         ]
24
25     returns = [ConfFile.fields]
26
27     def call(self, auth, conf_file_filter = None):
28         return ConfFiles(self.api, conf_file_filter).values()