harbor

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleProjectAdmin int = 1
	RoleDeveloper    int = 2
	RoleGuest        int = 3
)

Harbor project role IDs.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// EnsureProject ensures a Harbor project with the given name exists.
	EnsureProject(ctx context.Context, projectName string) error

	// ReconcileProjectMembers synchronizes the Harbor project membership to match
	// the desired list of members. It adds missing members, updates roles that
	// have changed, and removes members that are no longer desired.
	ReconcileProjectMembers(ctx context.Context, projectName string, desired []ProjectMember) error

	// EnsureRobotAccount ensures a robot account exists for the given project.
	// Returns the credentials and whether the robot was newly created.
	// If the robot already exists, created is false and credentials are nil.
	EnsureRobotAccount(ctx context.Context, projectName string, robotName string) (creds *RobotCredentials, created bool, err error)
}

Client defines the operations needed for workspace Harbor integration.

func NewClient

func NewClient(baseURL, username, password string) Client

NewClient creates a new Harbor API client.

type ProjectMember added in v0.8.7

type ProjectMember struct {
	Username string
	RoleID   int
}

ProjectMember represents a desired Harbor project member.

type RobotCredentials

type RobotCredentials struct {
	Name   string // full robot name, e.g. robot$workspace-mynamespace
	Secret string // the token/password
}

RobotCredentials holds the credentials returned by Harbor for a robot account.

Jump to

Keyboard shortcuts

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