Client library with golang for accessing Harbor API.

Client Types

There are 3 swagger files in this repo.

        legacy_swagger.yaml    # legacy client
        swagger.yaml           # v2 client
    swagger.yaml               # assist client contains version and chart healthcheck

Download swagger spec by version

Currently, the default Harbor version is v2.4.0.

NOTE Default version need to be updated manually inside Makefile

To download swagger spec:

make update-swagger-spec

To download swagger spec from previous Harbor version, add VERSION as an argument:

make update-swagger-spec VERSION=v2.3.4

Generate Clients

make gen-harbor-api

Check all available make commands


To use the Clients

There is ClientSet defined inside pkg/harbor/client.go to construct Clients

Create a Config first then use it to create ClientSet

For Example:

c := Config{
    URL: url,
	Transport: tr,
	AuthInfo: ai,

cs := NewClientSet(c)

cs.V2() // v2 client
cs.Legacy() // legacy client
cs.Assist() // assist client


View Github