432ae043a2816b2fc5067b8c10274c3fa9c66c16
[plcapi.git] / PLC / Methods / GetEventObjects.py
1 # $Id$
2 # $URL$
3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.Filter import Filter
7 from PLC.EventObjects import EventObject, EventObjects
8 from PLC.Auth import Auth
9
10 class GetEventObjects(Method):
11     """
12     Returns an array of structs containing details about events and
13     faults. If event_filter is specified and is an array of event
14     identifiers, or a struct of event attributes, only events matching
15     the filter will be returned. If return_fields is specified, only the
16     specified details will be returned.
17     """
18
19     roles = ['admin']
20
21     accepts = [
22         Auth(),
23         Mixed(Filter(EventObject.fields)),
24         Parameter([str], "List of fields to return", nullok = True)
25         ]
26
27     returns = [EventObject.fields]
28
29     def call(self, auth, event_filter = None, return_fields = None):
30         return EventObjects(self.api, event_filter, return_fields)
31