|
22 | 22 | from ...decorators import requires_sql_reader
|
23 | 23 | from ...files.v2_api.serializers import RelatedFileSerializer, FileSQLSerializer, NestedRelatedFileSerializer
|
24 | 24 | from ...files.v1_api.views import handle_related_file, handle_json_data, handle_related_file_sql
|
| 25 | +from ...files.v2_api.views import handle_get_related_file_tar |
25 | 26 | from ...filters import TimeStampedFilter, CsvMultipleChoiceFilter, CsvModelMultipleChoiceFilter
|
26 | 27 | from ...permissions.group_auth import VerifyGroupAccessModelViewSet, verify_user_is_in_obj_groups
|
27 | 28 | from ...portfolios.models import Portfolio
|
|
31 | 32 | RUN_MODE_PARAM,
|
32 | 33 | SUBTASK_STATUS_PARAM,
|
33 | 34 | SUBTASK_SLUG_PARAM,
|
| 35 | + FILENAME_PARAM, |
| 36 | + FILE_LIST_RESPONSE, |
34 | 37 | )
|
35 | 38 |
|
36 | 39 |
|
@@ -419,7 +422,25 @@ def input_file(self, request, pk=None, version=None):
|
419 | 422 | """
|
420 | 423 | return handle_related_file(self.get_object(), 'input_file', request, ['application/x-gzip', 'application/gzip', 'application/x-tar', 'application/tar'])
|
421 | 424 |
|
422 |
| - @swagger_auto_schema(methods=['get'], responses={200: FILE_RESPONSE}) |
| 425 | + @swagger_auto_schema(methods=["get"], responses={200: FILE_LIST_RESPONSE}) |
| 426 | + @action(methods=['get'], detail=True) |
| 427 | + def input_file_tar_list(self, request, pk=None, version=None): |
| 428 | + """ |
| 429 | + get: |
| 430 | + List the files in `input_file`. |
| 431 | + """ |
| 432 | + return handle_get_related_file_tar(self.get_object(), "input_file", request, ["application/x-gzip", "application/gzip", "application/x-tar", "application/tar"]) |
| 433 | + |
| 434 | + @swagger_auto_schema(methods=['get'], responses={200: FILE_RESPONSE}, manual_parameters=[FILENAME_PARAM]) |
| 435 | + @action(methods=['get'], detail=True) |
| 436 | + def input_file_tar_extract(self, request, pk=None, version=None): |
| 437 | + """ |
| 438 | + get: |
| 439 | + Extract and get `input_file` content. |
| 440 | + """ |
| 441 | + return handle_get_related_file_tar(self.get_object(), 'input_file', request, ['application/x-gzip', 'application/gzip', 'application/x-tar', 'application/tar']) |
| 442 | + |
| 443 | + @swagger_auto_schema(methods=["get"], responses={200: FILE_RESPONSE}) |
423 | 444 | @action(methods=['get'], detail=True)
|
424 | 445 | def lookup_errors_file(self, request, pk=None, version=None):
|
425 | 446 | """
|
@@ -503,6 +524,24 @@ def output_file(self, request, pk=None, version=None):
|
503 | 524 | """
|
504 | 525 | return handle_related_file(self.get_object(), 'output_file', request, ['application/x-gzip', 'application/gzip', 'application/x-tar', 'application/tar'])
|
505 | 526 |
|
| 527 | + @swagger_auto_schema(methods=['get'], responses={200: FILE_LIST_RESPONSE}) |
| 528 | + @action(methods=['get'], detail=True) |
| 529 | + def output_file_tar_list(self, request, pk=None, version=None): |
| 530 | + """ |
| 531 | + get: |
| 532 | + List the files in `output_file`. |
| 533 | + """ |
| 534 | + return handle_get_related_file_tar(self.get_object(), "output_file", request, ["application/x-gzip", "application/gzip", "application/x-tar", "application/tar"]) |
| 535 | + |
| 536 | + @swagger_auto_schema(methods=['get'], responses={200: FILE_RESPONSE}, manual_parameters=[FILENAME_PARAM]) |
| 537 | + @action(methods=['get'], detail=True) |
| 538 | + def output_file_tar_extract(self, request, pk=None, version=None): |
| 539 | + """ |
| 540 | + get: |
| 541 | + Extract and get `output_file` content. |
| 542 | + """ |
| 543 | + return handle_get_related_file_tar(self.get_object(), 'output_file', request, ['application/x-gzip', 'application/gzip', 'application/x-tar', 'application/tar']) |
| 544 | + |
506 | 545 | @requires_sql_reader
|
507 | 546 | @swagger_auto_schema(methods=['get'], responses={200: NestedRelatedFileSerializer})
|
508 | 547 | @action(methods=['get'], detail=True)
|
|
0 commit comments