Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to configure timeout for Scans #273

Merged
merged 4 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions api/models/models.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions api/models/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@ func (s *Scan) GetScanConfigScope() (ScanScopeType, bool) {

return scope, ok
}

func (s *Scan) GetTimeoutSeconds() int {
var timeoutSec int

if s.ScanConfigSnapshot != nil {
timeoutSec = s.ScanConfigSnapshot.GetTimeoutSeconds()
}

return timeoutSec
}
10 changes: 10 additions & 0 deletions api/models/scanconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ func (s *ScanConfig) GetMaxParallelScanners() int {

return DefaultMaxParallelScanners
}

func (s *ScanConfig) GetTimeoutSeconds() int {
var timeoutSec int

if s.TimeoutSeconds != nil {
timeoutSec = *s.TimeoutSeconds
}

return timeoutSec
}
10 changes: 10 additions & 0 deletions api/models/scanconfigsnapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,13 @@ func (s *ScanConfigSnapshot) GetMaxParallelScanners() int {

return DefaultMaxParallelScanners
}

func (s *ScanConfigSnapshot) GetTimeoutSeconds() int {
var timeoutSec int

if s.TimeoutSeconds != nil {
timeoutSec = *s.TimeoutSeconds
}

return timeoutSec
}
19 changes: 19 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,12 @@ components:
$ref: '#/components/schemas/ScanFamiliesConfig'
scope:
$ref: '#/components/schemas/ScanScopeType'
timeoutSeconds:
akpsgit marked this conversation as resolved.
Show resolved Hide resolved
type: integer
minimum: 0
description: |
The maximum time in seconds that a scan started from this config
should run for before being automatically aborted.
scheduled:
$ref: '#/components/schemas/RuntimeScheduleScanConfig'
maxParallelScanners:
Expand Down Expand Up @@ -1281,6 +1287,13 @@ components:
scope:
$ref: '#/components/schemas/ScanScopeType'
readOnly: true
timeoutSeconds:
type: integer
minimum: 0
description: |
The maximum time in seconds that a scan started from this config
should run for before being automatically aborted.
readOnly: true
scheduled:
$ref: '#/components/schemas/RuntimeScheduleScanConfig'
readOnly: true
Expand Down Expand Up @@ -1315,6 +1328,12 @@ components:
$ref: '#/components/schemas/ScanFamiliesConfig'
scope:
$ref: '#/components/schemas/ScanScopeType'
timeoutSeconds:
type: integer
minimum: 0
description: |
The maximum time in seconds that a scan started from this config
should run for before being automatically aborted.
scheduled:
$ref: '#/components/schemas/RuntimeScheduleScanConfig'
maxParallelScanners:
Expand Down
Loading