Example #1
0
 def post(self):
     """创建 Redis 实例
     """
     data = request.get_json()
     user, errors = UserSchema().load(data)
     if errors:
         return errors, 400
     user.save()
     return {'ok': True}, 201
Example #2
0
 def put(self, object_id):
     """更新服务器
     """
     schema = UserSchema(context={'instance': g.instance})
     data = request.get_json()
     server, errors = schema.load(data, partial=True)
     if errors:
         return errors, 400
     server.save()
     return {'ok': True}
Example #3
0
 def get(self, object_id):
     """
     """
     data, _ = UserSchema().dump(g.instance)
     return data
Example #4
0
 def get(self):
     """获取 Redis 列表
     """
     servers = User.query.all()
     return UserSchema().dump(servers, many=True).data