Documentation ¶
Index ¶
- Constants
- type AccessAction
- type AccessResource
- type Client
- type Level
- type RESTClient
- func (c *RESTClient) DeleteRobotAccountByID(ctx context.Context, id int64) error
- func (c *RESTClient) DeleteRobotAccountByName(ctx context.Context, name string) error
- func (c *RESTClient) GetRobotAccountByID(ctx context.Context, id int64) (*modelv2.Robot, error)
- func (c *RESTClient) GetRobotAccountByName(ctx context.Context, name string) (*modelv2.Robot, error)
- func (c *RESTClient) ListRobotAccounts(ctx context.Context) ([]*modelv2.Robot, error)
- func (c *RESTClient) NewRobotAccount(ctx context.Context, r *modelv2.RobotCreate) (*modelv2.RobotCreated, error)
- func (c *RESTClient) RefreshRobotAccountSecretByID(ctx context.Context, id int64, sec string) (*modelv2.RobotSec, error)
- func (c *RESTClient) RefreshRobotAccountSecretByName(ctx context.Context, name string, sec string) (*modelv2.RobotSec, error)
- func (c *RESTClient) UpdateRobotAccount(ctx context.Context, r *modelv2.Robot) error
Constants ¶
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) (*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 RefreshRobotAccountSecretByID(ctx context.Context, id int64, sec string) (*modelv2.RobotSec, error) RefreshRobotAccountSecretByName(ctx context.Context, name string, sec string) (*modelv2.RobotSec, 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) 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 ¶
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 ¶
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) 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 ¶
UpdateRobotAccount updates the robot account 'r' with the provided specification. Note that modelv2.Robot.Name & modelv2.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.