mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-29 05:35:43 +01:00
461a5fa50d
* add stop sbom scanning API 1. [UI] support to stop sbom scanning #20200 2. add type for stop scanning api, make it able to support both vulnerability and sbom. 3. refactor the db query to support multiple extra attributes. Signed-off-by: wang yan <wangyan@vmware.com> Signed-off-by: xuelichao <xuel@vmware.com> Co-authored-by: xuelichao <xuel@vmware.com>
25 lines
958 B
Python
25 lines
958 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import time
|
|
import base
|
|
import v2_swagger_client
|
|
from v2_swagger_client.rest import ApiException
|
|
|
|
class StopScan(base.Base, object):
|
|
def __init__(self):
|
|
super(StopScan,self).__init__(api_type = "scan")
|
|
|
|
def stop_scan_artifact(self, project_name, repo_name, reference, expect_status_code = 202, expect_response_body = None, **kwargs):
|
|
try:
|
|
scanType = v2_swagger_client.ScanType()
|
|
scanType.scan_type = "vulnerability"
|
|
data, status_code, _ = self._get_client(**kwargs).stop_scan_artifact_with_http_info(project_name, repo_name, reference, scanType)
|
|
except ApiException as e:
|
|
base._assert_status_code(expect_status_code, e.status)
|
|
if expect_response_body is not None:
|
|
base._assert_status_body(expect_response_body, e.body)
|
|
return
|
|
|
|
base._assert_status_code(expect_status_code, status_code)
|
|
|
|
return data |