Documentation ¶
Index ¶
- Constants
- func SendErrorResponse(res *http.ResponseWriter, message string, code int)
- func SendJSONResponse(res *http.ResponseWriter, obj interface{}, contentType string)
- func UnmarshallScanRequest(req *http.Request) (harbor.ScanRequest, error)
- func ValidateMetadataRequest(req *http.Request) error
- func ValidateScanRequest(req *harbor.ScanRequest) error
- type APIHandler
- func (h *APIHandler) AuthenticationMiddleware(next http.Handler) http.Handler
- func (h *APIHandler) CreateScan(res http.ResponseWriter, req *http.Request)
- func (h *APIHandler) GetHarborVulnerabilityReport(scanID string, includeFullDescriptions bool) (harbor.VulnerabilityReport, error)
- func (h *APIHandler) GetMetadata(res http.ResponseWriter, req *http.Request)
- func (h *APIHandler) GetRawScanReport(scanID string) (harbor.RawReport, error)
- func (h *APIHandler) GetScanReport(res http.ResponseWriter, req *http.Request)
- func (h *APIHandler) LoggerMiddleware(next http.Handler) http.Handler
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 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
Click to show internal directories.
Click to hide internal directories.