robot

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// LevelProject defines a project-wide access level for a robot account.
	LevelProject Level = "project"
	// LevelSystem defines a system-wide access level for a robot account.
	LevelSystem Level = "system"

	ResourceRepository       AccessResource = "repository"
	ResourceArtifact         AccessResource = "artifact"
	ResourceHelmChart        AccessResource = "helm-chart"
	ResourceHelmChartVersion AccessResource = "helm-chart-version"
	ResourceTag              AccessResource = "tag"
	ResourceArtifactLabel    AccessResource = "artifact-label"
	ResourceScan             AccessResource = "scan"

	ActionPush   AccessAction = "push"
	ActionPull   AccessAction = "pull"
	ActionCreate AccessAction = "create"
	ActionDelete AccessAction = "delete"
	ActionRead   AccessAction = "read"
)
View Source
const (
	// ErrRobotAccountInvalidMsg is the error message for ErrRobotAccountInvalid error.
	ErrRobotAccountInvalidMsg = "the robot account is invalid"
	// ErrRobotAccountUnauthorizedMsg is the error message for ErrRobotAccountUnauthorized error.
	ErrRobotAccountUnauthorizedMsg = "unauthorized"
	// ErrRobotAccountNoPermissionMsg is the error message for ErrRobotAccountNoPermission error.
	ErrRobotAccountNoPermissionMsg = "user does not have permission to the robot account"
	// ErrRobotAccountUnknownResourceMsg is the error message for ErrRobotAccountUnknownResource error.
	ErrRobotAccountUnknownResourceMsg = "resource unknown"
	// ErrRobotAccountInternalErrorsMsg is the error message for ErrRobotAccountInternalErrors error.
	ErrRobotAccountInternalErrorsMsg = "internal server error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessAction

type AccessAction string

func (AccessAction) String

func (in AccessAction) String() string

type AccessResource

type AccessResource string

func (AccessResource) String

func (in AccessResource) String() string

type Client

type Client interface {
	ListRobotAccounts(ctx context.Context) ([]*modelv2.Robot, error)
	GetRobotAccountByName(ctx context.Context, name string) (*modelv2.Robot, error)
	GetRobotAccountByID(ctx context.Context, id int64) (*modelv2.Robot, error)
	NewRobotAccount(ctx context.Context, r *modelv2.RobotCreate) (*modelv2.RobotCreated, error)
	DeleteRobotAccountByName(ctx context.Context, name string) error
	DeleteRobotAccountByID(ctx context.Context, id int64) error
	UpdateRobotAccount(ctx context.Context, r *modelv2.Robot) error
}

type ErrRobotAccountInternalErrors

type ErrRobotAccountInternalErrors struct{}

ErrRobotAccountInternalErrors describes server-sided internal errors.

func (*ErrRobotAccountInternalErrors) Error

Error returns the error message.

type ErrRobotAccountInvalid

type ErrRobotAccountInvalid struct{}

ErrRobotAccountInvalid describes an invalid robot account error.

func (*ErrRobotAccountInvalid) Error

func (e *ErrRobotAccountInvalid) Error() string

Error returns the error message.

type ErrRobotAccountNoPermission

type ErrRobotAccountNoPermission struct{}

ErrRobotAccountNoPermission describes a request error without permission.

func (*ErrRobotAccountNoPermission) Error

Error returns the error message.

type ErrRobotAccountUnauthorized

type ErrRobotAccountUnauthorized struct{}

ErrRobotAccountUnauthorized describes an unauthorized request to the 'robots' API.

func (*ErrRobotAccountUnauthorized) Error

Error returns the error message.

type ErrRobotAccountUnknownResource

type ErrRobotAccountUnknownResource struct{}

ErrRobotAccountUnknownResource describes an error when the specified robot account could not be found.

func (*ErrRobotAccountUnknownResource) Error

Error returns the error message.

type Level

type Level string

func (Level) String

func (in Level) String() string

type RESTClient

type RESTClient struct {
	// 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, authInfo runtime.ClientAuthInfoWriter) *RESTClient

func (*RESTClient) DeleteRobotAccountByID

func (c *RESTClient) DeleteRobotAccountByID(ctx context.Context, id int64) error

DeleteRobotAccountByID DeleteProjectRobotByID deletes a robot account identified by its id.

func (*RESTClient) DeleteRobotAccountByName

func (c *RESTClient) DeleteRobotAccountByName(ctx context.Context, name string) error

DeleteRobotAccountByName deletes a robot account identified by its 'name'. Note that the generic 'robot$'-prefix of the robot name is implicitly used for deletion.

func (*RESTClient) GetRobotAccountByID

func (c *RESTClient) GetRobotAccountByID(ctx context.Context, id int64) (*modelv2.Robot, error)

GetRobotAccountByID GetRobotByID returns a robot account identified by its 'id'.

func (*RESTClient) GetRobotAccountByName

func (c *RESTClient) GetRobotAccountByName(ctx context.Context, name string) (*modelv2.Robot, error)

GetRobotAccountByName GetRobotByName lists all existing robot accounts and returns the one matching the provided name. Note that the generic 'robot$'-prefix of the robot name is implicitly used for getting the resource.

func (*RESTClient) ListRobotAccounts

func (c *RESTClient) ListRobotAccounts(ctx context.Context) ([]*modelv2.Robot, error)

ListRobotAccounts ListProjectRobots returns a list of all robot accounts.

func (*RESTClient) NewRobotAccount

func (c *RESTClient) NewRobotAccount(ctx context.Context, r *modelv2.RobotCreate) (*modelv2.RobotCreated, error)

NewRobotAccount creates a new robot account from the specification of 'r' and returns a 'RobotCreated' response.

func (*RESTClient) UpdateRobotAccount

func (c *RESTClient) UpdateRobotAccount(ctx context.Context, r *modelv2.Robot) error

UpdateRobotAccount updates the robot account 'r' with the provided specification. Note that modelv2.Robot.Name & modelv2.Robot.Level are immutable by API definitions.

Jump to

Keyboard shortcuts

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