v1

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AcceptHeader               = "Accept"
	ContentTypeHeader          = "Content-Type"
	AuthorizationHeader        = "Authorization"
	BearerTokenPrefix          = "bearer"
	AllMimeTypes               = "*/*"
	JSONRequestMimeType        = "application/json"
	HarborVulnReportv1MimeType = "application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0"
	RawVulnReportMimeType      = "application/vnd.scanner.adapter.vuln.report.raw+json"
	ScanRequestMimeType        = "application/vnd.scanner.adapter.scan.request+json; version=1.0"
	ScanResponseMimeType       = "application/vnd.scanner.adapter.scan.response+json; version=1.0"
	MetadataResponseMimeType   = "application/vnd.scanner.adapter.metadata+json; version=1.0"
	ErrorResponseMimeType      = "application/vnd.scanner.adapter.error+json; version=1.0"
)

Variables

This section is empty.

Functions

func SendErrorResponse

func SendErrorResponse(res *http.ResponseWriter, message string, code int)

func SendJSONResponse added in v1.2.0

func SendJSONResponse(res *http.ResponseWriter, obj interface{}, contentType string)

func UnmarshallScanRequest

func UnmarshallScanRequest(req *http.Request) (harbor.ScanRequest, error)

func ValidateMetadataRequest

func ValidateMetadataRequest(req *http.Request) error

func ValidateScanRequest

func ValidateScanRequest(req *harbor.ScanRequest) error

Types

type APIHandler

type APIHandler struct {
	// contains filtered or unexported fields
}

func NewAPIHandler

func NewAPIHandler(scanner adapter.ScannerAdapter, cfg anchore.AdapterConfig) *APIHandler

func (*APIHandler) AuthenticationMiddleware

func (h *APIHandler) AuthenticationMiddleware(next http.Handler) http.Handler

Middleware function, which will be called for each request

func (*APIHandler) CreateScan

func (h *APIHandler) CreateScan(res http.ResponseWriter, req *http.Request)

func (*APIHandler) GetHarborVulnerabilityReport

func (h *APIHandler) GetHarborVulnerabilityReport(
	scanID string,
	includeFullDescriptions bool,
) (harbor.VulnerabilityReport, error)

func (*APIHandler) GetMetadata

func (h *APIHandler) GetMetadata(res http.ResponseWriter, req *http.Request)

Return metadata about the adapter service itself as well as the upstream service it proxies (Anchore Engine or Enterprise).

func (*APIHandler) GetRawScanReport

func (h *APIHandler) GetRawScanReport(scanID string) (harbor.RawReport, error)

func (*APIHandler) GetScanReport

func (h *APIHandler) GetScanReport(res http.ResponseWriter, req *http.Request)

func (*APIHandler) LoggerMiddleware

func (h *APIHandler) LoggerMiddleware(next http.Handler) http.Handler

Simple logger middleware to log requests

Jump to

Keyboard shortcuts

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