Documentation ¶
Overview ¶
Package utils contains methods to support security, cache, and webhook functions.
Index ¶
- func AddUISecret(req *http.Request)
- func NewRepositoryClientForUI(username, repository string) (*registry.Repository, error)
- func RequestAsUI(method, url string, body io.Reader, h ResponseHandler) error
- func ScanAllImages() error
- func ScanImagesByProjectID(id int64) error
- func TriggerImageScan(repository string, tag string) error
- type JobLogRespHandler
- type ResponseHandler
- type StatusRespHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRepositoryClientForUI ¶
func NewRepositoryClientForUI(username, repository string) (*registry.Repository, error)
NewRepositoryClientForUI creates a repository client that can only be used to access the internal registry
func RequestAsUI ¶
func RequestAsUI(method, url string, body io.Reader, h ResponseHandler) error
RequestAsUI is a shortcut to make a request attach UI secret and send the request. Do not use this when you want to handle the response
func ScanAllImages ¶
func ScanAllImages() error
ScanAllImages scans all images of Harbor by submiting jobs to jobservice, the whole process will move on if failed to submit any job of a single image.
func ScanImagesByProjectID ¶
ScanImagesByProjectID scans all images under a projet, the whole process will move on if failed to submit any job of a single image.
func TriggerImageScan ¶
TriggerImageScan triggers an image scan job on jobservice.
Types ¶
type JobLogRespHandler ¶
type JobLogRespHandler struct {
// contains filtered or unexported fields
}
JobLogRespHandler handles the response from jobservice to show the log of a job
type ResponseHandler ¶
ResponseHandler provides utility to handle http response.
func NewJobLogRespHandler ¶
func NewJobLogRespHandler(apiHandler *api.BaseAPI) ResponseHandler
NewJobLogRespHandler ...
func NewStatusRespHandler ¶
func NewStatusRespHandler(sc int) ResponseHandler
NewStatusRespHandler ...
type StatusRespHandler ¶
type StatusRespHandler struct {
// contains filtered or unexported fields
}
StatusRespHandler handles the response to check if the status is expected, if not returns an error.