endpoint

package
v1.1.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accepted

type Accepted struct {
	Data interface{}
}

func (Accepted) StatusCode

func (c Accepted) StatusCode() int

type CheckRequest

type CheckRequest struct {
	ID string `json:"id" urlvar:"id"`
}

CheckRequest specifies the request for the get check endpoint.

type Created

type Created struct {
	Data interface{}
}

func (Created) MarshalJSON

func (c Created) MarshalJSON() ([]byte, error)

func (Created) StatusCode

func (c Created) StatusCode() int

type Endpoints

type Endpoints struct {
	Healthcheck   endpoint.Endpoint
	CreateScan    endpoint.Endpoint
	ListScans     endpoint.Endpoint
	GetScan       endpoint.Endpoint
	GetScanChecks endpoint.Endpoint
	GetScanStats  endpoint.Endpoint
	GetCheck      endpoint.Endpoint
	AbortScan     endpoint.Endpoint
}

Endpoints contains all available endpoints for this api

func MakeEndpoints

func MakeEndpoints(s ScanEngineService) *Endpoints

MakeEndpoints initialize endpoints using the given service

type GetCheckResponse

type GetCheckResponse struct {
	ID            string `json:"id"`
	Status        string `json:"status"`
	Target        string `json:"target"`
	ChecktypeName string `json:"checktype_name,omitempty"`
	Image         string `json:"image,omitempty"`
	Options       string `json:"options,omitempty"`
	Report        string `json:"report,omitempty"`
	Raw           string `json:"raw,omitempty"`
	Tag           string `json:"tag,omitempty"`
	Assettype     string `json:"assettype,omitempty"`
}

GetCheckResponse represents the response for a get check request.

type GetChecksResponse

type GetChecksResponse struct {
	Checks []GetCheckResponse `json:"checks"`
}

GetChecksResponse represents the response for a get scan checks request.

type GetScanResponse

type GetScanResponse struct {
	ID            string     `json:"id"`
	ExternalID    string     `json:"external_id"`
	Status        string     `json:"status"`
	Trigger       string     `json:"trigger"`
	ScheduledTime *time.Time `json:"scheduled_time"`
	StartTime     *time.Time `json:"start_time"`
	EndTime       *time.Time `json:"end_time"`
	Progress      *float32   `json:"progress"`
	CheckCount    *int       `json:"check_count"`
	ChecksCreated *int       `json:"checks_created"`
	AbortedAt     *time.Time `json:"aborted_at,omitempty"`
}

GetScanResponse represents the response for a get scan request.

type GetScanStatsResponse

type GetScanStatsResponse struct {
	Checks []api.CheckStats `json:"checks"`
}

GetScanStatsResponse represents the response for a get scan checks stats request.

type GetScansResponse

type GetScansResponse struct {
	Scans []GetScanResponse `json:"scans"`
}

GetScansResponse represents the response for a list scans request.

type HTTPResponse

type HTTPResponse interface {
	StatusCode() int
}

type HealthChecker

type HealthChecker interface {
	Healthcheck(context.Context) error
}

HealthChecker defines the services needed by the endpoint.

type HealthcheckResponse

type HealthcheckResponse struct {
	Status string `json:"status"`
}

type NoContent

type NoContent struct {
	Data interface{}
}

func (NoContent) MarshalJSON

func (c NoContent) MarshalJSON() ([]byte, error)

func (NoContent) StatusCode

func (c NoContent) StatusCode() int

type Ok

type Ok struct {
	Data interface{}
}

func (Ok) MarshalJSON

func (c Ok) MarshalJSON() ([]byte, error)

func (Ok) StatusCode

func (c Ok) StatusCode() int

type ScanChecksRequest

type ScanChecksRequest struct {
	ID     string `json:"id" urlvar:"id"`
	Status string `json:"status" urlquery:"status"`
}

ScanChecksRequest specifies the request for the get scan checks endpoint.

type ScanCreator

type ScanCreator interface {
	CreateScan(context.Context, *api.Scan) (uuid.UUID, error)
}

ScanCreator defines the service interface required by the endpoint CreateScan

type ScanEngineService

type ScanEngineService interface {
	HealthChecker
	ScanCreator
	ScanGetter
}

ScanEngineService contains the services needed by all the endpoints.

type ScanGetter

type ScanGetter interface {
	ListScans(ctx context.Context, extID string, offset, limit uint32) ([]api.Scan, error)
	GetScan(ctx context.Context, scanID string) (api.Scan, error)
	GetScanChecks(ctx context.Context, scanID, status string) ([]api.Check, error)
	GetScanStats(ctx context.Context, scanID string) ([]api.CheckStats, error)
	GetCheck(ctx context.Context, checkID string) (api.Check, error)
	AbortScan(ctx context.Context, scanID string) error
}

ScanGetter defines the service interface required by the endpoint GetScan

type ScanRequest

type ScanRequest struct {
	ID            string     `json:"id" urlvar:"id"`
	ExternalID    string     `json:"external_id" urlquery:"external_id"`
	ScheduledTime *time.Time `json:"scheduled_time"`
	// TODO: Remove TargetGroup and ChecktypeGroup when we deprecate the version 1
	// of the endpoint for creating scans.
	TargetGroup     api.TargetGroup              `json:"target_group"`
	ChecktypesGroup api.ChecktypesGroup          `json:"check_types_groups"`
	TargetGroups    []api.TargetsChecktypesGroup `json:"target_groups"`
	Trigger         string                       `json:"trigger"`
	Tag             string                       `json:"tag,omitempty"`
	Offset          string                       `urlquery:"offset"`
	Limit           string                       `urlquery:"limit"`
}

ScanRequest defines the request accepted by CreateScan endpoint.

type ScanResponse

type ScanResponse struct {
	ScanID string `json:"scan_id"`
}

ScanResponse represents the response for a scan creation request.

type ServerDown

type ServerDown struct {
	Data interface{}
}

func (ServerDown) MarshalJSON

func (c ServerDown) MarshalJSON() ([]byte, error)

func (ServerDown) StatusCode

func (c ServerDown) StatusCode() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL