def validate_post(self): parser = RequestParser() parser.add_argument('message', type=str, required=False, help="The message to send to the actor.") args = parser.parse_args() # if a special 'message' object isn't passed, use entire POST payload as message if not args.get('message'): json_data = request.get_json() if json_data: args['message'] = json_data args['_abaco_Content-Type'] = 'application/json' else: # try to get data for mime types not recognized by flask. flask creates a python string for these try: args['message'] = json.loads(request.data) except TypeError: raise DAOError( 'message POST body could not be serialized. Pass JSON data or use the message attribute.' ) args['_abaco_Content-Type'] = 'str' else: # the special message object is a string args['_abaco_Content-Type'] = 'str' return args
def validate_post(self): parser = RequestParser() parser.add_argument('num', type=int, help="Number of workers to start (default is 1).") args = parser.parse_args() return args
def validate_post(self): parser = RequestParser() parser.add_argument('runtime', type=str, required=True, help="Runtime, in milliseconds, of the execution.") parser.add_argument( 'cpu', type=str, required=True, help="CPU usage, in user jiffies, of the execution.") parser.add_argument( 'io', type=str, required=True, help= "Block I/O usage, in number of 512-byte sectors read from and written to, by the execution." ) # Accounting for memory is quite hard -- probably easier to cap all containers at a fixed amount or perhaps have # a graduated list of cap sized (e.g. small, medium and large). # parser.add_argument('mem', type=str, required=True, help="Memory usage, , of the execution.") args = parser.parse_args() for k, v in args.items(): try: int(v) except ValueError: raise ResourceError(message="Argument " + k + " must be an integer.") return args
def validate_post(self): parser = RequestParser() parser.add_argument('state', type=str, required=True, help="Set the state for this actor.") args = parser.parse_args() return args
def validate_put(self): parser = RequestParser() parser.add_argument('image', type=str, required=True, help='Reference to image on docker hub for this actor.') parser.add_argument('subscriptions', type=[str], help='List of event ids to subscribe this actor to.') parser.add_argument('description', type=str) args = parser.parse_args() return args
def validate_post(self): parser = RequestParser() parser.add_argument('name', type=str, required=True, help="User defined name for this actor.") parser.add_argument('image', type=str, required=True, help='Reference to image on docker hub for this actor.') parser.add_argument('description', type=str) args = parser.parse_args() return args
def validate_post(self): parser = RequestParser() parser.add_argument('user', type=str, required=True, help="User owning the permission.") parser.add_argument('level', type=str, required=True, help="Level of the permission: {}".format(PERMISSION_LEVELS)) args = parser.parse_args() if not args['level'] in PERMISSION_LEVELS: raise APIException("Invalid permission level: {}. \ The valid values are {}".format(args['level'], PERMISSION_LEVELS)) return args
def validate_post(self): parser = RequestParser() parser.add_argument('runtime', type=str, required=True, help="Runtime, in milliseconds, of the execution.") parser.add_argument('cpu', type=str, required=True, help="CPU usage, in user jiffies, of the execution.") parser.add_argument('io', type=str, required=True, help="Block I/O usage, in number of 512-byte sectors read from and written to, by the execution.") # Accounting for memory is quite hard -- probably easier to cap all containers at a fixed amount or perhaps have a graduated # list of cap sized (e.g. small, medium and large). # parser.add_argument('mem', type=str, required=True, help="Memory usage, , of the execution.") args = parser.parse_args() for k,v in args.items(): try: int(v) except ValueError: raise APIException(message="Argument " + k + " must be an integer.") return args
def validate_post(self): parser = RequestParser() parser.add_argument('name', type=str, required=True, help="User defined name for this actor.") parser.add_argument('image', type=str, required=True, help='Reference to image on docker hub for this actor.') parser.add_argument('streaming', type=str) parser.add_argument('description', type=str) args = parser.parse_args() if not args.get('streaming'): args['streaming'] = 'FALSE' else: args['streaming'] = args['streaming'].upper() if args['streaming'] not in ('TRUE', 'FALSE'): raise APIException("Invalid value for streaming: must be in:{}".format(('TRUE', 'FALSE'))) return args
def validate_put(self): parser = RequestParser() parser.add_argument('image', type=str, required=True, help='Reference to image on docker hub for this actor.') parser.add_argument('subscriptions', type=[str], help='List of event ids to subscribe this actor to.') parser.add_argument('description', type=str) parser.add_argument('streaming', type=str) args = parser.parse_args() if not args.get('streaming'): args['streaming'] = 'FALSE' else: args['streaming'] = args['streaming'].upper() print("Got streaming parm of: {}".format(args.get('streaming'))) if args['streaming'] not in ('TRUE', 'FALSE'): raise APIException("Invalid value for streaming: must be in:{}".format(('TRUE', 'FALSE'))) return args
def validate_post(self): parser = RequestParser() parser.add_argument('user', type=str, required=True, help="User owning the permission.") parser.add_argument( 'level', type=str, required=True, help="Level of the permission: {}".format(PERMISSION_LEVELS)) args = parser.parse_args() if not args['level'] in PERMISSION_LEVELS: raise ResourceError("Invalid permission level: {}. \ The valid values are {}".format(args['level'], PERMISSION_LEVELS)) return args
def validate_post(self): parser = RequestParser() parser.add_argument('message', type=str, required=False, help="The message to send to the actor.") args = parser.parse_args() # if a special 'message' object isn't passed, use entire POST payload as message if not args.get('message'): json_data = request.get_json() if json_data: args['message'] = json_data args['_abaco_Content-Type'] = 'application/json' else: # try to get data for mime types not recognized by flask. flask creates a python string for these try: args['message'] = json.loads(request.data) except TypeError: raise DAOError('message POST body could not be serialized. Pass JSON data or use the message attribute.') args['_abaco_Content-Type'] = 'str' else: # the special message object is a string args['_abaco_Content-Type'] = 'str' return args
def validate_post(self): parser = RequestParser() parser.add_argument('event_id', type=str, action='append', help="Event id for the subscription.") parser.add_argument('event_pattern', type=str, action='append', help="Regex pattern of event id's for the subscription.") args = parser.parse_args() return args
def validate_post(self): parser = RequestParser() parser.add_argument("num", type=int, help="Number of workers to start (default is 1).") args = parser.parse_args() return args
def validate_post(self): parser = RequestParser() parser.add_argument('message', type=str, required=True, help="The message to send to the actor.") args = parser.parse_args() return args