def delete(self, token):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     args = parser.parse_args()
     return queue.get_result(
         queue.add_for_processing(("Authentication", "delete"), args,
                                  token))
Example #2
0
 def post(self):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     args = parser.parse_args()
     data = request.json #{"name": "name_tag"}
     identifier = queue.add_for_processing(("Tags", "post"), args, data)
     return queue.get_result(identifier)
Example #3
0
 def post(self):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     args = parser.parse_args()
     data = request.json  #{'port':'8888','ipAddress':device_ip,'username':'******','password':'******'}
     identifier = queue.add_for_processing(("Devices", "post"), args, data)
     return queue.get_result(identifier)
Example #4
0
 def get(self):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     args = parser.parse_args()
     identifier = queue.add_for_processing(("Tags", "get"), args)
     return queue.get_result(identifier)
     
Example #5
0
 def delete(self, myappId):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     args = parser.parse_args()
     identifier = queue.add_for_processing(("MyApps", "delete"), args,
                                           myappId)
     return queue.get_result(identifier)
 def post(self, tagid):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     args = parser.parse_args()
     data = request.json  #{"devices":[deviceids]}}
     identifier = queue.add_for_processing(("TaggingDevices", "post"), args,
                                           data, tagid)
     return queue.get_result(identifier)
Example #7
0
 def delete(self, appURL):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     parser.add_argument('x-unpublish-on-delete', location='headers')
     args = parser.parse_args()
     identifier = queue.add_for_processing(("Applications", "delete"), args,
                                           appURL)
     return queue.get_result(identifier)
Example #8
0
 def put(self, appURL):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     args = parser.parse_args()
     data = request.json
     identifier = queue.add_for_processing(("Applications", "put"), args,
                                           data, appURL)
     return queue.get_result(identifier)
Example #9
0
 def post(self, myappId):
     parser = reqparse.RequestParser()
     parser.add_argument('x-token-id', location='headers')
     parser.add_argument("profile")
     args = parser.parse_args()
     data = request.json
     identifier = queue.add_for_processing(("MyAppsAction", "post"), args,
                                           data, myappId)
     return queue.get_result(identifier)
Example #10
0
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument("limit", type=int)
        parser.add_argument("offset", type=int)
        parser.add_argument("searchByTags")
        parser.add_argument("searchByAnyMatch")
        parser.add_argument('x-token-id', location='headers')
        args = parser.parse_args()

        identifier = queue.add_for_processing(("Devices", "get"), args)
        return queue.get_result(identifier)
Example #11
0
    def post(self):
        parser = reqparse.RequestParser()
        parser.add_argument('x-token-id', location='headers')
        parser.add_argument("x-publish-on-upload", location="headers")
        args = parser.parse_args()
        file = request.files['file']
        if 'file' not in request.files or request.files[
                "file"].filename == '' or not (file and allowed_file(
                    file.filename)):
            # Thank you CISCO for returning an XML here...
            return file_error_string, 400, {
                "Content-Type": "application/xml"
            }  # TODO: resolve output, not XML but string now
        filename = secure_filename(file.filename)
        uploadDir = "./fileApplication"
        if not os.path.exists(uploadDir):
            os.makedirs(uploadDir)
        path = os.path.join(uploadDir, filename)
        file.save(path)

        identifier = queue.add_for_processing(("Applications", "post"), args,
                                              request, uploadDir, filename)
        return queue.get_result(identifier)
Example #12
0
 def post(self):
     return queue.get_result(
         queue.add_for_processing(("Authentication", "post"),
                                  request.authorization["username"],
                                  request.authorization["password"]))