Exemplo n.º 1
0
class RecordResponseFields:
    """
    structure-metadata record meta (ids, date, user).
    """
    resource_fields = dict(structure=Integer(attribute='structure.id'),
                           metadata=Integer(attribute='id'),
                           date=DateTime(dt_format='iso8601'),
                           user=UserResponseField)
Exemplo n.º 2
0
class LogInResponseFields:
    resource_fields = dict(user=Integer(attribute='id'), name=String(attribute='full_name'),
                           role=TypeResponseField(attribute='role'))
Exemplo n.º 3
0
class DestinationFields:
    resource_fields = dict(host=String, port=Integer(6379), password=String, name=String)
Exemplo n.º 4
0
 def __init__(self, data_field=None, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self["code"] = Integer(default=0)
     self["message"] = String(default="success")
     self["data"] = Nested(data_field, default={})
Exemplo n.º 5
0
class DBUsersResponseFields:
    resource_fields = dict(user=Integer(attribute='id'),
                           name=String(attribute='full_name'),
                           role=Integer(attribute='_role'))
Exemplo n.º 6
0
from flask_restful import Resource, marshal
from flask_restful.fields import String, Integer, DateTime, Nested, List
from flask_restful.reqparse import RequestParser

from App.models.logs import RunningLog
from App.setting import HTTP_OK, HTTP_QUERY_ERROR, MSG_JOB_QUERY_SUCCESS, MSG_JOB_QUERY_FAILED

parser_logs = RequestParser(trim=True)
parser_logs.add_argument("total", type=int, required=True, help="查询正确的查询数据量")

log_fields_running = {
    "jobName": String(attribute="job_name"),
    "jobCmd": String(attribute="job_cmd"),
    "startDate": DateTime(attribute="start_date", dt_format="iso8601"),
    "endDate": DateTime(attribute="end_date", dt_format="iso8601"),
    "returnCode": Integer(attribute="return_code"),
    "stdout": String,
    "stderr": String
}

logs_fields_running = {
    "status": Integer,
    "msg": String,
    "total": Integer,
    "data": List(Nested(log_fields_running))
}


class LogResource(Resource):
    def get(self, job_name):
        args = parser_logs.parse_args()
Exemplo n.º 7
0
from .auth import *
from flask_restful.fields import Integer, String
import os
error_fields = {
    "code": Integer(default=404),
    "message": String(default="Not Found Resource")
}
common_response = ResponseField()


class StaticUrl(Raw):

    def format(self, value):
        return 'http://39.97.113.252:8080/static/' + value