robot

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: 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) ([]*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) error
	DeleteRobotAccountByName(ctx context.Context, name string) error
	DeleteRobotAccountByID(ctx context.Context, id int64) error
	UpdateRobotAccount(ctx context.Context, r *modelv2.Robot) error
	RefreshRobotAccountSecretByID(ctx context.Context, id int64, sec string) (*modelv2.RobotSec, error)
	RefreshRobotAccountSecretByName(ctx context.Context, name string, sec string) (*modelv2.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) (*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) 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) (*modelv2.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) (*modelv2.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 *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