svn keywords
[plcapi.git] / PLC / Methods / GetMessages.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.Messages import Message, Messages
8 from PLC.Auth import Auth
9
10 class GetMessages(Method):
11     """
12     Returns an array of structs containing details about message
13     templates. If message template_filter is specified and is an array
14     of message template identifiers, or a struct of message template
15     attributes, only message templates matching the filter will be
16     returned. If return_fields is specified, only the specified
17     details will be returned.
18     """
19
20     roles = ['admin', 'node']
21
22     accepts = [
23         Auth(),
24         Mixed([Message.fields['message_id']],
25               Filter(Message.fields)),
26         Parameter([str], "List of fields to return", nullok = True),
27         ]
28
29     returns = [Message.fields]
30
31
32     def call(self, auth, message_filter = None, return_fields = None):
33         return Messages(self.api, message_filter, return_fields)