Exemplo n.º 1
0
 def system(self, context, segments):
     """/<api>/system"""
     if len(segments) == 0:
         # This provides backward compatibility; see /system/versions.
         return Versions()
     elif segments[0] == 'preferences':
         if len(segments) > 1:
             return BadRequest(), []
         return ReadOnlyPreferences(system_preferences, 'system'), []
     elif segments[0] == 'versions':
         if len(segments) > 1:
             return BadRequest(), []
         return Versions(), []
     elif segments[0] == 'configuration':
         if len(segments) <= 2:
             return SystemConfiguration(*segments[1:]), []
         return BadRequest(), []
     elif segments[0] == 'pipelines':
         if len(segments) > 1:
             return BadRequest(), []
         return Pipelines(), []
     elif segments[0] == 'chains':
         if len(segments) > 1:
             return BadRequest(), []
         return Chains(), []
     else:
         return NotFound(), []
Exemplo n.º 2
0
 def all(self, request, segments):
     """/members/<id>/all/preferences"""
     if len(segments) == 0:
         return NotFound(), []
     if self._member is None:
         return NotFound(), []
     child = ReadOnlyPreferences(
         self._member, 'members/{0}/all'.format(self._member.member_id.int))
     return child, []
Exemplo n.º 3
0
 def all(self, context, segments):
     """/members/<id>/all/preferences"""
     if len(segments) == 0:
         return NotFound(), []
     if self._member is None:
         return NotFound(), []
     member_id = self.api.from_uuid(self._member_id)
     child = ReadOnlyPreferences(self._member,
                                 'members/{}/all'.format(member_id))
     return child, []