Ejemplo n.º 1
0
from flask import Blueprint, request
import requests
from commandment.apps.resources import ApplicationDetail, ApplicationList
from commandment.api.resources import DeviceRelationship
from commandment.api.app_jsonapi import api

api_app = Blueprint('applications_api', __name__)

api.route(ApplicationList, 'applications_list',
          '/v1/applications')
api.route(ApplicationDetail, 'application_detail',
          '/v1/applications/<int:application_id>')
#api.route(DeviceRelationship, 'application_devices',
#          '/v1/applications/<int:application_id>/relationship/devices')


@api_app.route('/v1/applications/manifests/fetch', methods=['POST'])
def fetch_manifest():
    data = request.get_json()
Ejemplo n.º 2
0
from flask import Blueprint
from commandment.mdm.resources import CommandsList, CommandDetail
from commandment.api.app_jsonapi import api

api_app = Blueprint('inventory_api_app', __name__)

# Commands
api.route(CommandsList, 'commands_list', '/v1/commands',
          '/v1/devices/<int:device_id>/commands')
api.route(CommandDetail, 'command_detail', '/v1/commands/<int:command_id>')
Ejemplo n.º 3
0
from flask import Blueprint, send_file
from flask_rest_jsonapi import Api
import io

from commandment.inventory.models import db, InstalledCertificate
from commandment.inventory.resources import InstalledApplicationsList, InstalledApplicationDetail, \
    InstalledCertificatesList, InstalledCertificateDetail, InstalledProfilesList, InstalledProfileDetail
from commandment.api.app_jsonapi import api

api_app = Blueprint('inventory_api_app', __name__)
# api = Api(blueprint=api_app)

# InstalledApplications
api.route(InstalledApplicationsList, 'installed_applications_list',
          '/v1/installed_applications', '/v1/devices/<int:device_id>/installed_applications')
api.route(InstalledApplicationDetail, 'installed_application_detail',
          '/v1/installed_applications/<int:installed_application_id>')

# InstalledCertificates
api.route(InstalledCertificatesList, 'installed_certificates_list',
          '/v1/installed_certificates', '/v1/devices/<int:device_id>/installed_certificates')
api.route(InstalledCertificateDetail, 'installed_certificate_detail',
          '/v1/installed_certificates/<int:installed_certificate_id>')

api.route(InstalledProfilesList, 'installed_profiles_list', '/v1/installed_profiles',
          '/v1/devices/<int:device_id>/installed_profiles')
api.route(InstalledProfileDetail, 'installed_profile_detail', '/v1/installed_profiles/<int:installed_profile_id>')


@api_app.route('/v1/installed_certificates/<int:installed_certificate_id>/download')
def download_installed_certificate(installed_certificate_id: int):