mirror of
https://github.com/goharbor/harbor
synced 2025-04-15 03:01:52 +00:00
Rename scan request type (#20288)
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
parent
6709c789fb
commit
fb2e0042d0
|
@ -1176,11 +1176,11 @@ paths:
|
||||||
- $ref: '#/parameters/projectName'
|
- $ref: '#/parameters/projectName'
|
||||||
- $ref: '#/parameters/repositoryName'
|
- $ref: '#/parameters/repositoryName'
|
||||||
- $ref: '#/parameters/reference'
|
- $ref: '#/parameters/reference'
|
||||||
- name: scan_request_type
|
- name: scanType
|
||||||
in: body
|
in: body
|
||||||
required: false
|
required: false
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/ScanRequestType'
|
$ref: '#/definitions/ScanType'
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'202':
|
||||||
$ref: '#/responses/202'
|
$ref: '#/responses/202'
|
||||||
|
@ -6766,13 +6766,6 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
description: Version of the scanner adapter
|
description: Version of the scanner adapter
|
||||||
example: "v0.9.1"
|
example: "v0.9.1"
|
||||||
ScanRequestType:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
scan_type:
|
|
||||||
type: string
|
|
||||||
description: 'The scan type for the scan request. Two options are currently supported, vulnerability and sbom'
|
|
||||||
enum: [vulnerability, sbom]
|
|
||||||
ScanOverview:
|
ScanOverview:
|
||||||
type: object
|
type: object
|
||||||
description: 'The scan overview attached in the metadata of tag'
|
description: 'The scan overview attached in the metadata of tag'
|
||||||
|
|
|
@ -742,10 +742,11 @@ func (bc *basicController) GetSBOMSummary(ctx context.Context, art *ar.Artifact,
|
||||||
return map[string]interface{}{}, nil
|
return map[string]interface{}{}, nil
|
||||||
}
|
}
|
||||||
reportContent := reports[0].Report
|
reportContent := reports[0].Report
|
||||||
|
result := map[string]interface{}{}
|
||||||
if len(reportContent) == 0 {
|
if len(reportContent) == 0 {
|
||||||
log.Warning("no content for current report")
|
log.Warning("no content for current report")
|
||||||
|
return result, nil
|
||||||
}
|
}
|
||||||
result := map[string]interface{}{}
|
|
||||||
err = json.Unmarshal([]byte(reportContent), &result)
|
err = json.Unmarshal([]byte(reportContent), &result)
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ func (s *scanAPI) ScanArtifact(ctx context.Context, params operation.ScanArtifac
|
||||||
if !distribution.IsDigest(params.Reference) {
|
if !distribution.IsDigest(params.Reference) {
|
||||||
options = append(options, scan.WithTag(params.Reference))
|
options = append(options, scan.WithTag(params.Reference))
|
||||||
}
|
}
|
||||||
if params.ScanRequestType != nil && validScanType(params.ScanRequestType.ScanType) {
|
if params.ScanType != nil && validScanType(params.ScanType.ScanType) {
|
||||||
scanType = params.ScanRequestType.ScanType
|
scanType = params.ScanType.ScanType
|
||||||
options = append(options, scan.WithScanType(scanType))
|
options = append(options, scan.WithScanType(scanType))
|
||||||
}
|
}
|
||||||
res := rbac.ResourceScan
|
res := rbac.ResourceScan
|
||||||
|
|
Loading…
Reference in New Issue
Block a user