robot

package
v5.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 8 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"
)

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) ([]*model.Robot, error)
	GetRobotAccountByName(ctx context.Context, name string) (*model.Robot, error)
	GetRobotAccountByID(ctx context.Context, id int64) (*model.Robot, error)
	NewRobotAccount(ctx context.Context, r *model.RobotCreate) (*model.RobotCreated, error)
	DeleteRobotAccountByName(ctx context.Context, name string) error
	DeleteRobotAccountByID(ctx context.Context, id int64) error
	UpdateRobotAccount(ctx context.Context, r *model.Robot) error
	RefreshRobotAccountSecretByID(ctx context.Context, id int64, sec string) (*model.RobotSec, error)
	RefreshRobotAccountSecretByName(ctx context.Context, name string, sec string) (*model.RobotSec, error)
}

type Level

type Level string

func (Level) String

func (in Level) String() string

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) 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) (*model.Robot, error)

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

func (*RESTClient) GetRobotAccountByName

func (c *RESTClient) GetRobotAccountByName(ctx context.Context, name string) (*model.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) ([]*model.Robot, error)

ListRobotAccounts ListProjectRobots returns a list of all robot accounts.

func (*RESTClient) NewRobotAccount

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

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

func (*RESTClient) RefreshRobotAccountSecretByID

func (c *RESTClient) RefreshRobotAccountSecretByID(ctx context.Context, id int64, sec string) (*model.RobotSec, error)

RefreshRobotAccountSecretByID updates the robot account secret with the provided string "sec", by its id and return a 'RobotSec' response.

func (*RESTClient) RefreshRobotAccountSecretByName

func (c *RESTClient) RefreshRobotAccountSecretByName(ctx context.Context, name string, sec string) (*model.RobotSec, error)

RefreshRobotAccountSecretByName updates the robot account secret with the provided string "sec", by its name and return a 'RobotSec' response.

func (*RESTClient) UpdateRobotAccount

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

UpdateRobotAccount updates the robot account 'r' with the provided specification. Note that model.Robot.Name & model.Robot.Level are immutable by API definitions. NOTE: Updating existing system-level robot accounts with wildcard access to all projects will fail until https://github.com/goharbor/harbor/pull/17117 is merged.

Jump to

Keyboard shortcuts

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