Documentation
¶
Index ¶
- func WriteJsonResp(w http.ResponseWriter, err error, respBody interface{}, status int)
- func WriteJsonRespStructured(w http.ResponseWriter, err error, respBody interface{}, status int, ...)
- type ApiError
- type ResetRequest
- type Response
- type ResponseV2
- type RestHandler
- type RestHandlerImpl
- func (impl *RestHandlerImpl) ScanForVulnerability(w http.ResponseWriter, r *http.Request)
- func (impl *RestHandlerImpl) ScanForVulnerabilityEvent(scanConfig *common.ImageScanEvent) (*common.ScanEventResponse, error)
- func (impl *RestHandlerImpl) ScanImageAsPerTool(scanConfig *common.ImageScanEvent, tool *repository.ScanToolMetadata, ...) (*common.ScanEventResponse, error)
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteJsonResp ¶
func WriteJsonResp(w http.ResponseWriter, err error, respBody interface{}, status int)
use of WriteJsonRespStructured is preferable. it api exists due to historical reason err.message is used as internals message for ApiError object in resp
func WriteJsonRespStructured ¶
func WriteJsonRespStructured(w http.ResponseWriter, err error, respBody interface{}, status int, apiErrors []*util.ApiError)
use this method when we have specific api error to be conveyed to api User
Types ¶
type ResetRequest ¶
type ResponseV2 ¶
type ResponseV2 struct {
Code int `json:"code,omitempty"`
Status string `json:"status,omitempty"`
Result interface{} `json:"result,omitempty"`
Errors []*util.ApiError `json:"errors,omitempty"`
}
global response body used across api
type RestHandler ¶
type RestHandler interface {
ScanForVulnerability(w http.ResponseWriter, r *http.Request)
ScanForVulnerabilityEvent(scanConfig *common.ImageScanEvent) (*common.ScanEventResponse, error)
}
type RestHandlerImpl ¶
type RestHandlerImpl struct {
Logger *zap.SugaredLogger
ImageScanService security.ImageScanService
KlarService klarService.KlarService
ClairService clairService.ClairService
// contains filtered or unexported fields
}
func NewRestHandlerImpl ¶
func NewRestHandlerImpl(logger *zap.SugaredLogger, grafeasService grafeasService.GrafeasService, userService user.UserService, imageScanService security.ImageScanService, klarService klarService.KlarService, clairService clairService.ClairService, imageScanConfig *security.ImageScanConfig) *RestHandlerImpl
func (*RestHandlerImpl) ScanForVulnerability ¶
func (impl *RestHandlerImpl) ScanForVulnerability(w http.ResponseWriter, r *http.Request)
func (*RestHandlerImpl) ScanForVulnerabilityEvent ¶
func (impl *RestHandlerImpl) ScanForVulnerabilityEvent(scanConfig *common.ImageScanEvent) (*common.ScanEventResponse, error)
func (*RestHandlerImpl) ScanImageAsPerTool ¶
func (impl *RestHandlerImpl) ScanImageAsPerTool(scanConfig *common.ImageScanEvent, tool *repository.ScanToolMetadata, executionHistory *repository.ImageScanExecutionHistory, executionHistoryDirPath string) (*common.ScanEventResponse, error)
type Router ¶
func NewRouter ¶
func NewRouter(logger *zap.SugaredLogger, restHandler RestHandler, monitoringRouter *monitoring.MonitoringRouter) *Router
Click to show internal directories.
Click to hide internal directories.