project

package
v5.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewProject(ctx context.Context, projectRequest *modelv2.ProjectReq) error
	DeleteProject(ctx context.Context, nameOrID string) error
	GetProject(ctx context.Context, nameOrID string) (*modelv2.Project, error)
	ListProjects(ctx context.Context, nameFilter string) ([]*modelv2.Project, error)
	UpdateProject(ctx context.Context, p *modelv2.Project, storageLimit *int64) error
	ProjectExists(ctx context.Context, nameOrID string) (bool, error)
}

type RESTClient

type RESTClient struct {
	// Options contains optional configuration when making API calls.
	Options *config.Options

	// 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(v2Client *v2client.Harbor, opts *config.Options, authInfo runtime.ClientAuthInfoWriter) *RESTClient

func (*RESTClient) DeleteProject

func (c *RESTClient) DeleteProject(ctx context.Context, nameOrID string) error

DeleteProject deletes the specified project. Returns an error when no matching project is found or when having difficulties talking to the API.

func (*RESTClient) GetProject

func (c *RESTClient) GetProject(ctx context.Context, nameOrID string) (*modelv2.Project, error)

GetProject returns an existing project identified by nameOrID. nameOrID may contain a unique project name or its unique ID. Returns an error if it cannot find a matching project or when having difficulties talking to the API.

func (*RESTClient) ListProjects

func (c *RESTClient) ListProjects(ctx context.Context, nameFilter string) ([]*modelv2.Project, error)

ListProjects returns a list of projects based on a name filter. Returns all projects if name is an empty string. Returns an error if no projects were found.

func (*RESTClient) NewProject

func (c *RESTClient) NewProject(ctx context.Context, projectRequest *modelv2.ProjectReq) error

NewProject creates a new project with the given request params. Referencing an existing registry via projectRequest.RegistryID will create a "Proxy Cache" project.

func (*RESTClient) ProjectExists

func (c *RESTClient) ProjectExists(ctx context.Context, nameOrID string) (bool, error)

ProjectExists returns true, if p matches a project on server side. Returns false, if not found. Returns an error in case of communication problems.

func (*RESTClient) UpdateProject

func (c *RESTClient) UpdateProject(ctx context.Context, p *modelv2.Project, storageLimit *int64) error

UpdateProject updates a project with the specified data. Returns an error if name/ID pair of p does not match a stored project. Note: Only positive values of storageLimit are supported through this method. If you want to set an infinite storageLimit (-1), please refer to the quota client's 'UpdateStorageQuotaByProjectID' method.

Jump to

Keyboard shortcuts

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