Documentation ¶
Index ¶
- Constants
- type AccessAction
- type AccessResource
- type Client
- type ErrRobotAccountInternalErrors
- type ErrRobotAccountInvalid
- type ErrRobotAccountNoPermission
- type ErrRobotAccountUnauthorized
- type ErrRobotAccountUnknownResource
- 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) 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" )
const ( // ErrRobotAccountInvalidMsg is the error message for ErrRobotAccountInvalid error. ErrRobotAccountInvalidMsg = "the robot account is invalid" 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 ¶
func (e *ErrRobotAccountInternalErrors) Error() string
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 ¶
func (e *ErrRobotAccountNoPermission) Error() string
Error returns the error message.
type ErrRobotAccountUnauthorized ¶
type ErrRobotAccountUnauthorized struct{}
ErrRobotAccountUnauthorized describes an unauthorized request to the 'robots' API.
func (*ErrRobotAccountUnauthorized) Error ¶
func (e *ErrRobotAccountUnauthorized) Error() string
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 ¶
func (e *ErrRobotAccountUnknownResource) Error() string
Error returns the error message.
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 ¶
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) UpdateRobotAccount ¶
UpdateRobotAccount updates the robot account 'r' with the provided specification. Note that modelv2.Robot.Name & modelv2.Robot.Level are immutable by API definitions.