support for negation with fields starting with ~
[plcapi.git] / PLC / Methods / GetForeignSlices.py
1 #
2 # Thierry Parmentelat - INRIA
3
4
5 from PLC.Faults import *
6 from PLC.Method import Method
7 from PLC.Parameter import Parameter, Mixed
8 from PLC.Filter import Filter
9 from PLC.Auth import Auth
10
11 from PLC.ForeignSlices import ForeignSlice, ForeignSlices
12
13 class GetForeignSlices(Method):
14     """
15     Returns an array of structs containing details about foreign
16     slices. If foreign_slice_filter is specified and is an array of
17     foreign slice identifiers or names, or a struct of foreign slice
18     attributes, only foreign slices matching the filter will be
19     returned. If return_fields is specified, only the specified
20     details will be returned.
21     """
22
23     roles = ['admin']
24
25     accepts = [
26         Auth(),
27         Mixed([Mixed(ForeignSlice.fields['slice_id'],
28                      ForeignSlice.fields['name'])],
29               Filter(ForeignSlice.fields)),
30         Parameter([str], "List of fields to return", nullok = True)
31         ]
32     
33     returns = [ForeignSlice.fields]
34
35     def call(self, auth, foreign_slice_filter = None, return_fields = None):
36         return ForeignSlices(self.api, foreign_slice_filter, return_fields)