From 25818e8141e6922e7a60cd9d2cf2d338b8090de5 Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 2 Feb 2023 09:37:57 +0800 Subject: [PATCH] =?UTF-8?q?:art:=E5=A2=9E=E5=8A=A0=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=89=AB=E6=8F=8F=E6=96=B9=E6=A1=88=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=88=9B=E5=BB=BA=E6=96=B9=E6=A1=88=E7=9A=84=E5=BC=80?= =?UTF-8?q?=E6=94=BE=E6=8E=A5=E5=8F=A3=E4=B8=8E=E7=9B=B8=E5=85=B3=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...41\345\235\227\346\216\245\345\217\243.md" | 137 ------------------ ...41\345\235\227\346\216\245\345\217\243.md" | 23 +++ .../main/apps/codeproj/api_urls/v1_org.py | 4 +- .../projects/main/apps/codeproj/apis/v1_pt.py | 8 + 4 files changed, 34 insertions(+), 138 deletions(-) diff --git "a/doc/en/api/\344\273\243\347\240\201\346\211\253\346\217\217\346\225\260\346\215\256\346\250\241\345\235\227\346\216\245\345\217\243.md" "b/doc/en/api/\344\273\243\347\240\201\346\211\253\346\217\217\346\225\260\346\215\256\346\250\241\345\235\227\346\216\245\345\217\243.md" index fc89e3982..5bf352e35 100644 --- "a/doc/en/api/\344\273\243\347\240\201\346\211\253\346\217\217\346\225\260\346\215\256\346\250\241\345\235\227\346\216\245\345\217\243.md" +++ "b/doc/en/api/\344\273\243\347\240\201\346\211\253\346\217\217\346\225\260\346\215\256\346\250\241\345\235\227\346\216\245\345\217\243.md" @@ -135,140 +135,3 @@ GET /server/analysis/api/orgs//teams//repos//projec "status_code": 200 } ``` - -## 查看每次扫描的问题列表 -``` -GET /server/analysis/api/orgs//teams//repos//projects//codelint/scans//issues/ -``` -#### 参数 -| 参数 | 类型 | 描述 | -| --- | --- | --- | -| state | str | 问题状态, 1为未处理,2为已处理,3为关闭,可多选,格式为1,2,3 | -| severity | str | 严重程度, 1为致命,2为错误,3为警告,4为提示,可多选,格式为1,2,3,4 | -| resolution | str | 解决方式, 0为无,1为修复,2为无需修复,3为误报,4为重复单过滤,5为路径过滤,6为规则移除 | -| author | str | 问题责任人 | -| scan_open_id | int | 发现问题的扫描编号 | -| scan_fix_id | int | 修复问题的扫描编号 | -| ci_time_gte | str | 修复问题的起始时间 | -| ci_time_lte | str | 修复问题的结束时间 | -| file_path | str | 文件路径 | -| checkrule_display_name | str | 检查规则名 | -| checkpackage | int | 问题所属的规则包 | - -#### 返回结果 -```JSON -{ - "data": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "id": 1, - "repo_id": 1, - "project_id": 1, - "scan_time": "2021-03-11T20:46:44.171607+08:00", - "file_path": "test/demo.py", - "scm_url": "", - "real_file_path": "", - "line": 21, - "column": 68, - "checkrule_gid": 1, - "checkrule_real_name": "xxx", - "checkrule_display_name": "xxx", - "checkrule_rule_title": "xxx", - "checktool_name": "xxx", - "category": 7, - "msg": "xxx", - "state": 1, - "resolution": null, - "author": "author", - "scan_open_id": 1, - "scan_fix_id": null, - "issuedetail_uuid": "26d7ba88-8268-11eb-a304-5254005e71ca", - "scan_revision": "scan_revision", - "real_revision": "", - "severity": 2, - "language": "python", - "revision": "revision", - "ci_time": "2019-07-01T10:28:19+08:00", - "file_owners": null, - "created_time": "2021-03-11T20:49:00.539537+08:00", - "fixed_time": null - } - ] - }, - "code": 0, - "msg": "xxx", - "status_code": 200 -} -``` - - -## 查看指定CR扫描的问题列表 -``` -GET /server/analysis/api/orgs//teams//repos//projects//codelint/crscans//issues/ -``` -#### 参数 -| 参数 | 类型 | 描述 | -| --- | --- | --- | -| state | str | 问题状态, 1为未处理,2为已处理,3为关闭,可多选,格式为1,2,3 | -| severity | str | 严重程度, 1为致命,2为错误,3为警告,4为提示,可多选,格式为1,2,3,4 | -| resolution | str | 解决方式, 0为无,1为修复,2为无需修复,3为误报,4为重复单过滤,5为路径过滤,6为规则移除 | -| author | str | 问题责任人 | -| scan_open_id | int | 发现问题的扫描编号 | -| scan_fix_id | int | 修复问题的扫描编号 | -| ci_time_gte | str | 修复问题的起始时间 | -| ci_time_lte | str | 修复问题的结束时间 | -| file_path | str | 文件路径 | -| checkrule_display_name | str | 检查规则名 | -| checkpackage | int | 问题所属的规则包 | - -#### 返回结果 -```JSON -{ - "data": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "id": 1, - "repo_id": 1, - "project_id": 1, - "scan_time": "2021-03-11T20:46:44.171607+08:00", - "file_path": "test/demo.py", - "scm_url": "", - "real_file_path": "", - "line": 21, - "column": 68, - "checkrule_gid": 1, - "checkrule_real_name": "xxx", - "checkrule_display_name": "xxx", - "checkrule_rule_title": "xxx", - "checktool_name": "xxx", - "category": 7, - "msg": "xxx", - "state": 1, - "resolution": null, - "author": "author", - "scan_open_id": 1, - "scan_fix_id": null, - "issuedetail_uuid": "26d7ba88-8268-11eb-a304-5254005e71ca", - "scan_revision": "scan_revision", - "real_revision": "", - "severity": 2, - "language": "python", - "revision": "revision", - "ci_time": "2019-07-01T10:28:19+08:00", - "file_owners": null, - "created_time": "2021-03-11T20:49:00.539537+08:00", - "fixed_time": null - } - ] - }, - "code": 0, - "msg": "xxx", - "status_code": 200 -} -``` \ No newline at end of file diff --git "a/doc/en/api/\351\241\271\347\233\256\347\256\241\347\220\206\346\250\241\345\235\227\346\216\245\345\217\243.md" "b/doc/en/api/\351\241\271\347\233\256\347\256\241\347\220\206\346\250\241\345\235\227\346\216\245\345\217\243.md" index 9d021daf4..1b5bd1fc1 100644 --- "a/doc/en/api/\351\241\271\347\233\256\347\256\241\347\220\206\346\250\241\345\235\227\346\216\245\345\217\243.md" +++ "b/doc/en/api/\351\241\271\347\233\256\347\256\241\347\220\206\346\250\241\345\235\227\346\216\245\345\217\243.md" @@ -478,6 +478,29 @@ GET /server/main/api/orgs//teams//repos//schemes/ } ``` +## 使用指定扫描方案模板创建指定代码库的扫描方案 +``` +GET /server/main/api/orgs//teams//repos//copyscheme/ +``` + +#### 参数列表 +| 参数 | 类型 | 描述 | +| --- | --- | --- | +| name | str | 扫描方案名称 | +| ref_scheme | int | 参照扫描方案编号 | + +#### 返回结果 +```JSON +{ + "data": { + "scan_scheme": 1 + }, + "code": 0, + "msg": "请求成功", + "status_code": 201 +} +``` + ## 查看指定代码库的指定扫描方案 ``` GET /server/main/api/orgs//teams//repos//schemes//basicconf/ diff --git a/server/projects/main/apps/codeproj/api_urls/v1_org.py b/server/projects/main/apps/codeproj/api_urls/v1_org.py index 1ac316cc5..d732e6dd2 100644 --- a/server/projects/main/apps/codeproj/api_urls/v1_org.py +++ b/server/projects/main/apps/codeproj/api_urls/v1_org.py @@ -77,7 +77,9 @@ v1_pt.PTProjectScanCreateAPIView.as_view(), name="apiv1_pt_project_team_repo_project_scans"), path("/schemes/", v1_pt.PTScanSchemeListAPIView.as_view(), - name="apiv1_pt_project_team_repo_scheme_detail"), + name="apiv1_pt_project_team_repo_scheme_list"), + path("/copyscheme/", v1_pt.PTRepositorySchemeCopyApiView.as_view(), + name="apiv1_pt_project_team_repo_scheme_copy"), path("/schemes//basicconf/", v1_pt.PTScanSchemeBasicConfAPIView.as_view(), name="apiv1_pt_project_team_repo_scheme_basicconf"), path("/schemes//lintconf/", v1_pt.PTScanSchemeLintConfAPIView.as_view(), diff --git a/server/projects/main/apps/codeproj/apis/v1_pt.py b/server/projects/main/apps/codeproj/apis/v1_pt.py index f20147105..bb5cf66e5 100644 --- a/server/projects/main/apps/codeproj/apis/v1_pt.py +++ b/server/projects/main/apps/codeproj/apis/v1_pt.py @@ -172,6 +172,14 @@ class PTScanSchemeListAPIView(v3.ScanSchemeListApiView): """ +class PTRepositorySchemeCopyApiView(v3.RepositorySchemeCopyApiView): + """拷贝方案模板 + + ### POST + 应用场景:仅用于拷贝方案模板 + """ + + class PTScanSchemeBasicConfAPIView(v3.ScanSchemeBasicConfApiView): """指定扫描方案详情接口,仅basic配置