Documentation ¶
Index ¶
- type ProjectsCache
- type Repository
- func (r *Repository) BaseURL() string
- func (r *Repository) CreateRobotAccount(name string, pushAccess bool, project harbor.Project) (*harbor.CreateRobotResponse, error)
- func (r *Repository) DeleteRobotAccount(project harbor.Project, robotID int) error
- func (r *Repository) GetRobotAccounts(project harbor.Project) ([]harbor.Robot, error)
- func (r *Repository) ListProjects() ([]harbor.Project, error)
- func (r *Repository) Start(stop <-chan struct{}) error
- func (r *Repository) Sync() <-chan struct{}
- func (r *Repository) Update() error
- func (r *Repository) UpdateHash() error
- type RobotsCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProjectsCache ¶
type ProjectsCache struct {
// contains filtered or unexported fields
}
ProjectsCache is a cache for harbor projects it is protected against concurrent access with a mutex
func (*ProjectsCache) Set ¶
func (p *ProjectsCache) Set(project harbor.Project)
Set sets the cache item
type Repository ¶
type Repository struct { Client harbor.API PollInterval time.Duration // StateHash is a uniqe number which is computed // with the projects and robots structs. // This is used to compare the old/new version of data StateHash uint64 ProjectsCache *ProjectsCache RobotsCache *RobotsCache // contains filtered or unexported fields }
Repository implements the harbor.API interface it caches the API resources using a polling mechanism in the background
func (*Repository) BaseURL ¶
func (r *Repository) BaseURL() string
BaseURL returns the harbor base url
func (*Repository) CreateRobotAccount ¶
func (r *Repository) CreateRobotAccount(name string, pushAccess bool, project harbor.Project) (*harbor.CreateRobotResponse, error)
CreateRobotAccount creates a robot account and updates the internal cache
func (*Repository) DeleteRobotAccount ¶
func (r *Repository) DeleteRobotAccount(project harbor.Project, robotID int) error
DeleteRobotAccount deletes the robot account and updates the internal cache
func (*Repository) GetRobotAccounts ¶
GetRobotAccounts returns a list of robot accounts for the given project
func (*Repository) ListProjects ¶
func (r *Repository) ListProjects() ([]harbor.Project, error)
ListProjects implements the harbor.API it returns all harbor projects
func (*Repository) Start ¶ added in v1.3.4
func (r *Repository) Start(stop <-chan struct{}) error
Start starts the goroutine which polls the API for changes The component will stop running when the channel is closed. Start blocks until the channel is closed
func (*Repository) Sync ¶
func (r *Repository) Sync() <-chan struct{}
Sync returns a channel which notifies the user when the underlying data has changed
func (*Repository) Update ¶
func (r *Repository) Update() error
Update fetches the projects and robot accounts
func (*Repository) UpdateHash ¶
func (r *Repository) UpdateHash() error
UpdateHash recalculates the StateHash
type RobotsCache ¶
type RobotsCache struct {
// contains filtered or unexported fields
}
RobotsCache is a cache for robot accounts it is protected against concurrent access with a mutex