1 from PLC.Method import Method
2 from PLC.Parameter import Parameter, Mixed
3 from PLC.Filter import Filter
4 from PLC.Auth import Auth
5 from PLC.Slices import Slice, Slices
7 class ResolveSlices(Method):
9 This method is similar to GetSlices, except that (1) the returned
10 columns are restricted to 'name', 'slice_id' and 'expires', and
11 (2) it returns expired slices too. This method is designed to help
12 third-party software solve slice names from their slice_id
13 (e.g. PlanetFlow Central). For this reason it is accessible with
14 anonymous authentication (among others).
17 roles = ['admin', 'pi', 'user', 'tech', 'anonymous' ]
20 'slice_id' : Slice.fields['slice_id'],
21 'name' : Slice.fields['name'],
22 'expires': Slice.fields['expires'],
27 Mixed([Mixed(Slice.fields['slice_id'],
28 Slice.fields['name'])],
29 Parameter(str,"name"),
30 Parameter(int,"slice_id"),
31 Filter(applicable_fields))
34 returns = [applicable_fields]
36 def call(self, auth, slice_filter = None):
38 # Must query at least slice_id (see below)
39 return_fields = list(self.applicable_fields.keys())
41 slices = Slices(self.api, slice_filter, return_fields, 0)