quota

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrQuotaIllegalIDFormatMsg is the error for message for ErrQuotaIllegalIDFormat errors.
	ErrQuotaIllegalIDFormatMsg = "illegal format in quota update request"

	// ErrQuotaUnauthorizedMsg is the error for message for ErrQuotaUnauthorized errors.
	ErrQuotaUnauthorizedMsg = "unauthorized"

	// ErrQuotaInternalServerErrorsMsg is the error message for ErrQuotaInternalServerErrors errors.
	ErrQuotaInternalServerErrorsMsg = "unexpected internal errors"

	// ErrQuotaNoPermissionMsg is the error message for ErrQuotaNoPermission errors.
	ErrQuotaNoPermissionMsg = "user does not have permission to the quota"

	// ErrQuotaUnknownResourceMsg is the errors message for ErrQuotaUnknownResource errors.
	ErrQuotaUnknownResourceMsg = "quota does not exist"

	ErrQuotaRefNotFoundMsg = "quota could not be found or contains unexpected reference object"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetQuotaByProjectID(ctx context.Context, projectID int64) (*legacymodel.Quota, error)
	UpdateStorageQuotaByProjectID(ctx context.Context, projectID int64, storageLimit int64) error
}

type ErrQuotaIllegalIDFormat

type ErrQuotaIllegalIDFormat struct{}

ErrQuotaIllegalIDFormat describes an error due to an illegal request format.

func (*ErrQuotaIllegalIDFormat) Error

func (e *ErrQuotaIllegalIDFormat) Error() string

Error returns the error message.

type ErrQuotaInternalServerErrors

type ErrQuotaInternalServerErrors struct{}

ErrQuotaInternalServerErrors describes miscellaneous internal server errors.

func (*ErrQuotaInternalServerErrors) Error

Error returns the error message.

type ErrQuotaNoPermission

type ErrQuotaNoPermission struct{}

ErrQuotaNoPermission describes an error in the request due to the lack of permissions.

func (*ErrQuotaNoPermission) Error

func (e *ErrQuotaNoPermission) Error() string

Error returns the error message.

type ErrQuotaRefNotFound

type ErrQuotaRefNotFound struct{}

ErrQuotaRefNotFound describes an error when the quota reference could not be found.

func (*ErrQuotaRefNotFound) Error

func (e *ErrQuotaRefNotFound) Error() string

type ErrQuotaUnauthorized

type ErrQuotaUnauthorized struct{}

ErrQuotaUnauthorized describes an unauthorized request.

func (*ErrQuotaUnauthorized) Error

func (e *ErrQuotaUnauthorized) Error() string

Error returns the error message.

type ErrQuotaUnknownResource

type ErrQuotaUnknownResource struct{}

ErrQuotaUnknownResource describes an error when the specified quota could not be found.

func (*ErrQuotaUnknownResource) Error

func (e *ErrQuotaUnknownResource) 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 project related actions.

func NewClient

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

func (*RESTClient) GetQuotaByProjectID

func (c *RESTClient) GetQuotaByProjectID(ctx context.Context, projectID int64) (*legacymodel.Quota, error)

GetQuotaByProjectID returns a quota object containing all configured quotas for a project.

func (*RESTClient) ListQuotas

func (c *RESTClient) ListQuotas(ctx context.Context, referenceType, referenceID, sort *string) ([]*legacymodel.Quota, error)

func (*RESTClient) UpdateStorageQuotaByProjectID

func (c *RESTClient) UpdateStorageQuotaByProjectID(ctx context.Context, projectID int64, storageLimit int64) error

UpdateStorageQuotaByProjectID updates the storageLimit quota of a project. A storageLimit value smaller than '0' will implicitly be set to '-1', equalling the 'unlimited' setting.

Jump to

Keyboard shortcuts

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