registry

package
v5.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrRegistryIllegalIDFormat describes an illegal request format
	ErrRegistryIllegalIDFormatMsg = "illegal format of provided ID value"
	// ErrRegistryUnauthorized describes an unauthorized request
	ErrRegistryUnauthorizedMsg = "unauthorized"
	// ErrRegistryInternalErrors describes server-side internal errors
	ErrRegistryInternalErrorsMsg = "unexpected internal errors"
	// ErrRegistryNoPermission describes a request error without permission
	ErrRegistryNoPermissionMsg = "user does not have permission to the registry"
	// ErrRegistryIDNotExists describes an error
	// when no proper registry ID is found
	ErrRegistryIDNotExistsMsg = "registry ID does not exist"
	// ErrRegistryNameAlreadyExists describes a duplicate registry name error
	ErrRegistryNameAlreadyExistsMsg = "registry name already exists"
	// ErrRegistryMismatch describes a failed lookup
	// of a registry with name/id pair
	ErrRegistryMismatchMsg = "id/name pair not found on server side"
	// ErrRegistryNotFound describes an error
	// when a specific registry is not found
	ErrRegistryNotFoundMsg = "registry not found on server side"
	// ErrRegistryNotProvidedMsg describes an error
	// when no registry was provided by the user
	ErrRegistryNotProvidedMsg = "no registry provided"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewRegistry(ctx context.Context, name, registryType, url string,
		credential *model.RegistryCredential, insecure bool) (*model.Registry, error)
	GetRegistry(ctx context.Context, name string) (*model.Registry, error)
	DeleteRegistry(ctx context.Context, r *model.Registry) error
	UpdateRegistry(ctx context.Context, r *model.Registry) error
}

type ErrRegistryIDNotExists

type ErrRegistryIDNotExists struct{}

ErrRegistryIDNotExists describes an error when no proper registry ID is found.

func (*ErrRegistryIDNotExists) Error

func (e *ErrRegistryIDNotExists) Error() string

Error returns the error message.

type ErrRegistryIllegalIDFormat

type ErrRegistryIllegalIDFormat struct{}

ErrRegistryIllegalIDFormat describes an illegal request format.

func (*ErrRegistryIllegalIDFormat) Error

Error returns the error message.

type ErrRegistryInternalErrors

type ErrRegistryInternalErrors struct{}

ErrRegistryInternalErrors describes server-side internal errors.

func (*ErrRegistryInternalErrors) Error

func (e *ErrRegistryInternalErrors) Error() string

Error returns the error message.

type ErrRegistryMismatch

type ErrRegistryMismatch struct{}

ErrRegistryMismatch describes a failed lookup of a registry with name/id pair.

func (*ErrRegistryMismatch) Error

func (e *ErrRegistryMismatch) Error() string

Error returns the error message.

type ErrRegistryNameAlreadyExists

type ErrRegistryNameAlreadyExists struct{}

ErrRegistryNameAlreadyExists describes a duplicate registry name error.

func (*ErrRegistryNameAlreadyExists) Error

Error returns the error message.

type ErrRegistryNoPermission

type ErrRegistryNoPermission struct{}

ErrRegistryNoPermission describes a request error without permission.

func (*ErrRegistryNoPermission) Error

func (e *ErrRegistryNoPermission) Error() string

Error returns the error message.

type ErrRegistryNotFound

type ErrRegistryNotFound struct{}

ErrRegistryNotFound describes an error when a specific registry is not found.

func (*ErrRegistryNotFound) Error

func (e *ErrRegistryNotFound) Error() string

Error returns the error message.

type ErrRegistryNotProvided

type ErrRegistryNotProvided struct{}

ErrRegistryNotProvided describes an error when no registry was provided.

func (*ErrRegistryNotProvided) Error

func (e *ErrRegistryNotProvided) Error() string

Error returns the error message.

type ErrRegistryUnauthorized

type ErrRegistryUnauthorized struct{}

ErrRegistryUnauthorized describes an unauthorized request.

func (*ErrRegistryUnauthorized) Error

func (e *ErrRegistryUnauthorized) Error() string

Error returns the error message.

type RESTClient

type RESTClient struct {
	// The swagger client
	Client *client.Harbor

	// AuthInfo contain auth information, which are provided on API calls.
	AuthInfo runtime.ClientAuthInfoWriter
}

RESTClient is a subclient for handling registry related actions.

func NewClient

func NewClient(cl *client.Harbor, authInfo runtime.ClientAuthInfoWriter) *RESTClient

func (*RESTClient) DeleteRegistry

func (c *RESTClient) DeleteRegistry(ctx context.Context,
	r *model.Registry) error

Delete deletes a registry. Returns an error when no matching registry is found or when having difficulties talking to the API.

func (*RESTClient) GetRegistry

func (c *RESTClient) GetRegistry(ctx context.Context, name string) (*model.Registry, error)

Get returns a registry identified by name. Returns an error if it cannot find a matching registry or when having difficulties talking to the API.

func (*RESTClient) NewRegistry

func (c *RESTClient) NewRegistry(ctx context.Context, name, registryType, url string,
	credential *model.RegistryCredential, insecure bool) (*model.Registry, error)

NewRegistry creates a new project with name as project name. CountLimit and StorageLimit limits space and access for this project. Returns the registry as it is stored inside Harbor or an error, if it cannot be created.

func (*RESTClient) UpdateRegistry

func (c *RESTClient) UpdateRegistry(ctx context.Context, r *model.Registry) error

Jump to

Keyboard shortcuts

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