def post(self, input_scope, input_name, output_scope, output_name, nbfiles): """ Return the file associated to a GUID. .. :quickref: Sample; Create a sample DID. HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param input_scope: The scope of the input DID. :param input_name: The name of the input DID. :param output_scope: The scope of the output dataset. :param output_name: The name of the output dataset. :param nbfiles: The number of files to register in the output dataset. """ try: create_did_sample(input_scope=input_scope, input_name=input_name, output_scope=output_scope, output_name=output_name, issuer=request.environ.get('issuer'), nbfiles=nbfiles) except DataIdentifierNotFound, error: return generate_http_error_flask(404, 'DataIdentifierNotFound', error.args[0][0])
def post(self, input_scope, input_name, output_scope, output_name, nbfiles): """ Return the file associated to a GUID. .. :quickref: Sample; Create a sample DID. HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param input_scope: The scope of the input DID. :param input_name: The name of the input DID. :param output_scope: The scope of the output dataset. :param output_name: The name of the output dataset. :param nbfiles: The number of files to register in the output dataset. """ try: create_did_sample(input_scope=input_scope, input_name=input_name, output_scope=output_scope, output_name=output_name, issuer=request.environ.get('issuer'), nbfiles=nbfiles) except DataIdentifierNotFound as error: return generate_http_error_flask(404, 'DataIdentifierNotFound', error.args[0]) except DuplicateContent as error: return generate_http_error_flask(409, 'DuplicateContent', error.args[0]) except DataIdentifierAlreadyExists as error: return generate_http_error_flask(409, 'DataIdentifierAlreadyExists', error.args[0]) except AccessDenied as error: return generate_http_error_flask(401, 'AccessDenied', error.args[0]) except UnsupportedOperation as error: return generate_http_error_flask(409, 'UnsupportedOperation', error.args[0]) except DatabaseException as error: return generate_http_error_flask(500, 'DatabaseException', error.args) except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0]) except Exception as error: print format_exc() return error, 500 return "Created", 201
def POST(self, input_scope, input_name, output_scope, output_name, nbfiles): """ Return the file associated to a GUID. HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param input_scope: The scope of the input DID. :param input_name: The name of the input DID. :param output_scope: The scope of the output dataset. :param output_name: The name of the output dataset. :param nbfiles: The number of files to register in the output dataset. """ try: create_did_sample(input_scope=input_scope, input_name=input_name, output_scope=output_scope, output_name=output_name, issuer=ctx.env.get('issuer'), nbfiles=nbfiles, vo=ctx.env.get('vo')) except DataIdentifierNotFound as error: raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0]) except DuplicateContent as error: raise generate_http_error(409, 'DuplicateContent', error.args[0]) except DataIdentifierAlreadyExists as error: raise generate_http_error(409, 'DataIdentifierAlreadyExists', error.args[0]) except AccessDenied as error: raise generate_http_error(401, 'AccessDenied', error.args[0]) except UnsupportedOperation as error: raise generate_http_error(409, 'UnsupportedOperation', error.args[0]) except DatabaseException as error: raise generate_http_error(500, 'DatabaseException', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print(format_exc()) raise InternalError(error) raise Created()
def post(self, input_scope, input_name, output_scope, output_name, nbfiles): """ Return the file associated to a GUID. .. :quickref: Sample; Create a sample DID. HTTP Success: 201 Created HTTP Error: 401 Unauthorized 404 Not Found 409 Conflict 500 Internal Error :param input_scope: The scope of the input DID. :param input_name: The name of the input DID. :param output_scope: The scope of the output dataset. :param output_name: The name of the output dataset. :param nbfiles: The number of files to register in the output dataset. """ try: create_did_sample( input_scope=input_scope, input_name=input_name, output_scope=output_scope, output_name=output_name, issuer=request.environ.get('issuer'), nbfiles=nbfiles, vo=request.environ.get('vo'), ) except DataIdentifierNotFound as error: return generate_http_error_flask(404, error) except (DuplicateContent, DataIdentifierAlreadyExists, UnsupportedOperation) as error: return generate_http_error_flask(409, error) except AccessDenied as error: return generate_http_error_flask(401, error) return 'Created', 201