コード例 #1
0
def build_activator(act):
    act_dict = {
        'id': act.id,
        'name': act.name,
        'type': act.type,
        'available': act.available,
        'sensitivity': act.sensitivity,
        'category': act.category,
        'envs': ModelTools.load_json_array(act.envs),
        'platforms': ModelTools.load_json_array(act.platforms),
        'lastUpdated': ModelTools.datetime_as_string(act.lastUpdated),
        'userCapacity': act.userCapacity,
        'serverCapacity': act.serverCapacity,
        'regions': ModelTools.load_json_array(act.regions),
        'hosting': ModelTools.load_json_array(act.hosting),
        'apiManagement': ModelTools.load_json_array(act.apiManagement),
        'ci': ModelTools.load_json_array(act.ci),
        'cd': ModelTools.load_json_array(act.cd),
        'sourceControl': ModelTools.load_json_array(act.sourceControl),
        'businessUnit': act.businessUnit,
        'technologyOwner': act.technologyOwner,
        'technologyOwnerEmail': act.technologyOwnerEmail,
        'billing': act.billing,
        'activator': act.activator,
        'resources': ModelTools.load_json_array(act.resources),
        'status': act.status,
        'description': act.description,
        'accessRequestedBy': act.accessRequestedBy,
        'source': act.source,
        'activatorLink': act.activatorLink
    }
    act_dict['accessRequestedBy'] = user_extension.build_user(
        act.accessRequestedBy)

    return act_dict
コード例 #2
0
def build_solution(sol):
    sol_dict = {
        'id': sol.id,
        'name': sol.name,
        'description': sol.description,
        'businessUnit': sol.businessUnit,
        'costCentre': sol.costCentre,
        'ci': sol.ci,
        'cd': sol.cd,
        'sourceControl': sol.sourceControl,
        'environments': ModelTools.load_json_array(sol.environments),
        'active': sol.active,
        'favourite': sol.favourite,
        'teams': sol.teams,
        'lastUpdated': ModelTools.datetime_as_string(sol.lastUpdated)
    }

    apps = Application.query.filter(Application.solutionId == sol.id).all()
    app_arr = []
    if apps is not None:
        for ap in apps:
            app_dict = application_extension.build_application(ap)
            app_arr.append(app_dict)

    sol_dict['applications'] = app_arr
    return sol_dict
コード例 #3
0
def build_application(app):
    app_dict = {
        'id': app.id,
        'name': app.name,
        'env': app.env,
        'status': app.status,
        'description': app.description,
        'resources': ModelTools.load_json_array(app.resources),
        'lastUpdated': app.lastUpdated
    }
    acts = Activator.query.filter(Activator.id == app.activatorId).all()
    act_dict = {}
    for act in acts:
        act_dict = activator_extension.build_activator(act)

    app_dict['activator'] = act_dict
    return app_dict