Пример #1
0
 def post(self):
     data = request.get_json()
     server, erros = ServerSchema().load(data)
     if errors:
         return errors, 400
     server.ping()
     server.save()
     return('ok':True},201
Пример #2
0
 def put(self,object_id):
     schema = ServerSchema(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}
Пример #3
0
 def post(self):
     """创建 Redis 服务器
     """
     data = request.get_json()
     server,errors = ServerSchema().load(data)
     if errors:
         return errors,400
     server.ping()
Пример #4
0
 def post(self):
     """create Redis server"""
     data = request.get_json()
     server, errors = ServerSchema().load(data)
     if errors:
         return errors, 400
     server.ping()
     server.save()
     return {'ok': True}, 201
Пример #5
0
 def get(self):
     servers = Server.query.all()
     return ServerSchema().dump(servers,many=True).data
Пример #6
0
 def get(self,object_id):
     data, _ = ServerSchema().dump(g.instance)
     return data
Пример #7
0
 def get(self):
     """获取 Redis 列表
     """
     servers = Server.query.all()
     return ServerSchema().dump(servers, many=True).data
Пример #8
0
 def get(self):
     """ get redis list
     """
     servers = Server.query.all()
     return ServerSchema().dump(servers, many=True).data
Пример #9
0
 def get(self, object_id):
     """ get  redis server detail
     """
     data, _ = ServerSchema().dump(g.instance)
     return data
Пример #10
0
 def get(self, object_id):
     server = Server.query.filter_by('id' =object_id).first()
     data = ServerSchema().dump(server).data
     return json.dumps(data.get_metrics())