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