utils

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package utils contains methods to support security, cache, and webhook functions.

Package utils contains methods to support security, cache, and webhook functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJobServiceClient added in v1.5.0

func GetJobServiceClient() job.Client

GetJobServiceClient returns the job service client instance.

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 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

func ScanImagesByProjectID(id int64) error

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

func TriggerImageScan(repository string, tag string) error

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

func (JobLogRespHandler) Handle

func (h JobLogRespHandler) Handle(resp *http.Response) error

Handle will consume the response of job service and put the content of the job log in the reponse of the API.

type ResponseHandler

type ResponseHandler interface {
	Handle(*http.Response) error
}

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.

func (StatusRespHandler) Handle

func (s StatusRespHandler) Handle(resp *http.Response) error

Handle ...

Jump to

Keyboard shortcuts

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