Documentation ¶
Index ¶
- Constants
- Variables
- func ErrAbortFailed(statusCode int) error
- func ErrNotFound(err error) error
- func ErrUpdateFailed(err error) error
- func ErrValidationError(err error) error
- type ChecksCreator
- type ChecktypesByAssettypes
- type ChecktypesInformer
- type HealthcheckService
- type ScansService
- func (s ScansService) AbortScan(ctx context.Context, scanID string) error
- func (s ScansService) CreateScan(ctx context.Context, scan *api.Scan) (uuid.UUID, error)
- func (s ScansService) GetCheck(ctx context.Context, checkID string) (api.Check, error)
- func (s ScansService) GetScan(ctx context.Context, scanID string) (api.Scan, error)
- func (s ScansService) GetScanChecks(ctx context.Context, scanID, status string) ([]api.Check, error)
- func (s ScansService) GetScanStats(ctx context.Context, scanID string) ([]api.CheckStats, error)
- func (s ScansService) ListScans(ctx context.Context, extID string, offset, limit uint32) ([]api.Scan, error)
- func (s ScansService) ProcessScanCheckNotification(ctx context.Context, msg []byte) error
Constants ¶
const ( // ScanStatusRunning status when a Scan is created. ScanStatusRunning = "RUNNING" // ScanStatusFinished status when a Scan has all the checks in a terminal status. ScanStatusFinished = "FINISHED" )
Variables ¶
var ErrAtLeastOneTargetAndChecktype = fmt.Errorf("AtLeastOneTargetAndChecktype")
ErrAtLeastOneTargetAndChecktype must have al least one checktype and one target.
var ErrNotDefinedCheckState = ers.New("CheckStateNotDefined")
ErrNotDefinedCheckState a check update with an unkown state has been received.
var ErrNotImplemented = ers.New("NotImplemented")
ErrNotImplemented ...
var ErrNotTargetGroupsDefined = fmt.Errorf("a scan must have a least one target_group defined")
ErrNotTargetGroupsDefined a scan must have at least one targetgroup defined.
Functions ¶
func ErrAbortFailed ¶
ErrAbortFailed creates a new ErrorAbortFailed with the given status code returned by vulcan-core.
func ErrValidationError ¶
ErrValidationError returns a pretty error
Types ¶
type ChecksCreator ¶
ChecksCreator abstracts the actual implementation for the checks creation process.
type ChecktypesByAssettypes ¶
ChecktypesByAssettypes is used as a lookup table to check if a checktype can be run against a concrete assettype.
type ChecktypesInformer ¶
type ChecktypesInformer interface {
GetAssettypes() (*client.AssettypeCollection, error)
}
ChecktypesInformer represents an informer for the mapping between checktypes and supported asset types.
type HealthcheckService ¶
type HealthcheckService struct {
DB persistenceHealthChecker
}
HealthcheckService provides functionality to check the health of the service.
func (HealthcheckService) Healthcheck ¶
func (s HealthcheckService) Healthcheck(ctx context.Context) error
Healthcheck checks the health of the service.
type ScansService ¶
type ScansService struct {
// contains filtered or unexported fields
}
ScansService implements the functionality needed to create and query scans.
func New ¶
func New(logger log.Logger, db persistence.ScansStore, client ChecktypesInformer, metricsClient metrics.Client, ccreator ChecksCreator, scansNotifier notify.Notifier, checksNotifier notify.Notifier, streamClient stream.Client) ScansService
New Creates and returns ScansService with all the dependencies wired in.
func (ScansService) AbortScan ¶
func (s ScansService) AbortScan(ctx context.Context, scanID string) error
AbortScan is called in order to signal the vulcan core to try to abort and on going scan.
func (ScansService) CreateScan ¶
func (ScansService) GetScanChecks ¶
func (s ScansService) GetScanChecks(ctx context.Context, scanID, status string) ([]api.Check, error)
GetScanChecks returns the checks for the scan with the given id.
func (ScansService) GetScanStats ¶
func (s ScansService) GetScanStats(ctx context.Context, scanID string) ([]api.CheckStats, error)
GetScanStats returns the check stats for the given scan ID.
func (ScansService) ListScans ¶
func (s ScansService) ListScans(ctx context.Context, extID string, offset, limit uint32) ([]api.Scan, error)
ListScans returns the list of scans.
func (ScansService) ProcessScanCheckNotification ¶
func (s ScansService) ProcessScanCheckNotification(ctx context.Context, msg []byte) error
ProcessScanCheckNotification process and update the checks. The func will return nil if the event must be marked as consumed by the caller.