gc

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ErrSystemInvalidScheduleMsg describes an invalid schedule type request
	ErrSystemInvalidScheduleMsg = "invalid schedule type"

	// ErrSystemGcInProgressMsg describes that a gc progress is already running
	ErrSystemGcInProgressMsg = "the system is already running a gc job"

	// ErrSystemUnauthorizedMsg describes an unauthorized request
	ErrSystemUnauthorizedMsg = "unauthorized"

	// ErrSystemInternalErrorsMsg describes server-side internal errors
	ErrSystemInternalErrorsMsg = "unexpected internal errors"

	// ErrSystemNoPermissionMsg describes a request error without permission
	ErrSystemNoPermissionMsg = "user does not have permission to the System"

	// ErrSystemGcUndefinedMsg describes a server-side response returning an empty GC schedule
	ErrSystemGcUndefinedMsg = "no schedule defined"

	// ErrSystemGcScheduleIdenticalMsg describes equality between two GC schedules
	ErrSystemGcScheduleIdenticalMsg = "the provided schedule is identical to the existing schedule"

	// ErrSystemGcScheduleNotProvidedMsg describes the absence of a required schedule
	ErrSystemGcScheduleNotProvidedMsg = "no schedule provided"

	// ErrSystemGcScheduleUndefinedMsg describes an error when the GC schedule is undefined
	ErrSystemGcScheduleUndefinedMsg = "the garbage collection schedule is undefined"

	// ErrSystemGcScheduleParametersUndefinedMsg describes an error when a GC schedule's parameters are undefined
	ErrSystemGcScheduleParametersUndefinedMsg = "garbage collection schedule parameters are undefined"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewGarbageCollection(ctx context.Context, gcSchedule *modelv2.Schedule) error
	UpdateGarbageCollection(ctx context.Context, newGCSchedule *modelv2.Schedule) error
	GetGarbageCollectionExecution(ctx context.Context, id int64) (*modelv2.GCHistory, error)
	GetGarbageCollectionSchedule(ctx context.Context) (*modelv2.GCHistory, error)
	ResetGarbageCollection(ctx context.Context) error
}

type ErrSystemGcInProgress

type ErrSystemGcInProgress struct{}

ErrSystemGcInProgress describes that a gc progress is already running.

func (*ErrSystemGcInProgress) Error

func (e *ErrSystemGcInProgress) Error() string

Error returns the error message.

type ErrSystemGcScheduleIdentical

type ErrSystemGcScheduleIdentical struct{}

ErrSystemGcScheduleIdentical describes equality between two GC schedules.

func (*ErrSystemGcScheduleIdentical) Error

Error returns the error message.

type ErrSystemGcScheduleNotProvided

type ErrSystemGcScheduleNotProvided struct{}

ErrSystemGcScheduleNotProvided describes the absence of a required schedule.

func (*ErrSystemGcScheduleNotProvided) Error

Error returns the error message.

type ErrSystemGcScheduleParametersUndefined

type ErrSystemGcScheduleParametersUndefined struct{}

ErrSystemGcScheduleParametersUndefined describes an error when a GC schedule's parameters are undefined

func (*ErrSystemGcScheduleParametersUndefined) Error

Error returns the error message.

type ErrSystemGcScheduleUndefined

type ErrSystemGcScheduleUndefined struct{}

ErrSystemGcScheduleUndefined describes an error when the fetched gc schedule is undefined.

func (*ErrSystemGcScheduleUndefined) Error

Error returns the error message.

type ErrSystemGcUndefined

type ErrSystemGcUndefined struct{}

ErrSystemGcUndefined describes a server-side response returning an empty GC schedule.

func (*ErrSystemGcUndefined) Error

func (e *ErrSystemGcUndefined) Error() string

Error returns the error message.

type ErrSystemInternalErrors

type ErrSystemInternalErrors struct{}

ErrSystemInternalErrors describes server-side internal errors.

func (*ErrSystemInternalErrors) Error

func (e *ErrSystemInternalErrors) Error() string

Error returns the error message.

type ErrSystemInvalidSchedule

type ErrSystemInvalidSchedule struct{}

ErrSystemInvalidSchedule describes an invalid schedule type request.

func (*ErrSystemInvalidSchedule) Error

func (e *ErrSystemInvalidSchedule) Error() string

Error returns the error message.

type ErrSystemNoPermission

type ErrSystemNoPermission struct{}

ErrSystemNoPermission describes a request error without permission.

func (*ErrSystemNoPermission) Error

func (e *ErrSystemNoPermission) Error() string

Error returns the error message.

type ErrSystemUnauthorized

type ErrSystemUnauthorized struct{}

ErrSystemUnauthorized describes an unauthorized request.

func (*ErrSystemUnauthorized) Error

func (e *ErrSystemUnauthorized) Error() string

Error returns the error message.

type RESTClient

type RESTClient struct {
	// The legacy swagger client
	LegacyClient *client.Harbor

	// The new client of the harbor v2 API
	V2Client *v2client.Harbor

	// AuthInfo contains the auth information that is provided on API calls.
	AuthInfo runtime.ClientAuthInfoWriter
}

RESTClient is a subclient for handling system related actions.

func NewClient

func NewClient(legacyClient *client.Harbor, v2Client *v2client.Harbor, authInfo runtime.ClientAuthInfoWriter) *RESTClient

func (*RESTClient) GetGarbageCollectionExecution

func (c *RESTClient) GetGarbageCollectionExecution(ctx context.Context, id int64) (*modelv2.GCHistory, error)

GetGarbageCollectionExecution Returns a garbage collection execution identified by its id.

func (*RESTClient) GetGarbageCollectionSchedule

func (c *RESTClient) GetGarbageCollectionSchedule(ctx context.Context) (*modelv2.GCHistory, error)

GetGarbageCollectionSchedule returns the system GC schedule.

func (*RESTClient) NewGarbageCollection

func (c *RESTClient) NewGarbageCollection(ctx context.Context, gcSchedule *modelv2.Schedule) error

NewGarbageCollection creates a new garbage collection schedule.

func (*RESTClient) ResetGarbageCollection

func (c *RESTClient) ResetGarbageCollection(ctx context.Context) error

ResetGarbageCollection resets the system GC schedule to it's default values containing "None" as the Schedule Type, which effectively deactivates the schedule. For this to work correctly, a GC schedule must exist beforehand.

func (*RESTClient) UpdateGarbageCollection

func (c *RESTClient) UpdateGarbageCollection(ctx context.Context,
	newGCSchedule *modelv2.Schedule) error

UpdateGarbageCollection updates the system GC schedule.

Jump to

Keyboard shortcuts

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