Skip to content

A CLI tool for the Docker Registry Harbor. This project offer a command-line interface to the Harbor API, you can use it to manager your users, projects, repositories, etc.

License

Notifications You must be signed in to change notification settings

moooofly/harbor-go-client

Repository files navigation

Go Report Card Build Status License

harbor-go-client

 __ __   ____  ____   ____    ___   ____          ____   ___            __  _      ____    ___  ____   ______
 |  |  | /    ||    \ |    \  /   \ |    \        /    | /   \          /  ]| |    |    |  /  _]|    \ |      |
 |  |  ||  o  ||  D  )|  o  )|     ||  D  )_____ |   __||     | _____  /  / | |     |  |  /  [_ |  _  ||      |
 |  _  ||     ||    / |     ||  O  ||    /|     ||  |  ||  O  ||     |/  /  | |___  |  | |    _]|  |  ||_|  |_|
 |  |  ||  _  ||    \ |  O  ||     ||    \|_____||  |_ ||     ||_____/   \_ |     | |  | |   [_ |  |  |  |  |
 |  |  ||  |  ||  .  \|     ||     ||  .  \      |     ||     |      \     ||     | |  | |     ||  |  |  |  |
 |__|__||__|__||__|\_||_____| \___/ |__|\_|      |___,_| \___/        \____||_____||____||_____||__|__|  |__|

A CLI tool for the Docker Registry Harbor.

This project offer a command-line interface to the Harbor API, you can use it to manager your users, projects, repositories, etc.

NOTE

  • Currently, the implementation of harbor-go-client is based on harbor v1.5.0-d59c257e and swagger api version 1.4.0. If you want to use this CLI tool with Harbro v1.6.0+, you may encounter incompatible issues. See "The issue with API version" for more details.
  • Another project named harborctl is under developement now, which is based on harbor v1.6.0-66709daa and swagger api version 1.6.0.

Features

Current Harbor API support status:

  • Login
    • POST /login
  • Logout
    • GET /logout
  • search
    • GET /api/search
  • projects
    • GET /api/projects
    • HEAD /api/projects
    • POST /api/projects
    • DELETE /api/projects/{prject_id}
    • GET /api/projects/{prject_id}
    • PUT /api/projects/{prject_id}
    • GET /api/projects/{prject_id}/logs
    • GET /api/projects/{prject_id}/metadatas
    • POST /api/projects/{prject_id}/metadatas
    • DELETE /api/projects/{prject_id}/metadatas/{meta_name}
    • GET /api/projects/{prject_id}/metadatas/{meta_name}
    • PUT /api/projects/{prject_id}/metadatas/{meta_name}
    • GET /api/projects/{prject_id}/members
    • POST /api/projects/{prject_id}/members
    • DELETE /api/projects/{prject_id}/members/{mid}
    • GET /api/projects/{prject_id}/members/{mid}
    • PUT /api/projects/{prject_id}/members/{mid}
  • statistics
    • GET /api/statistics
  • users
    • GET /api/users
    • POST /api/users
    • GET /api/users/current
    • DELETE /api/users/{user_id}
    • GET /api/users/{user_id}
    • PUT /api/users/{user_id}
    • PUT /api/users/{user_id}/password
    • PUT /api/users/{user_id}/sysadmin
  • repositories
    • GET /api/repositories
    • DELETE /api/repositories/{repo_name}
    • PUT /api/repositories/{repo_name}
    • GET /api/repositories/{repo_name}/labels
    • POST /api/repositories/{repo_name}/labels
    • DELETE /api/repositories/{repo_name}/labels/{label_id}
    • DELETE /api/repositories/{repo_name}/tags/{tag}
    • GET /api/repositories/{repo_name}/tags/{tag}
    • GET /api/repositories/{repo_name}/tags
    • GET /api/repositories/{repo_name}/tags/{tag}/labels
    • POST /api/repositories/{repo_name}/tags/{tag}/labels
    • DELETE /api/repositories/{repo_name}/tags/{tag}/labels/{label_id}
    • GET /api/repositories/{repo_name}/tags/{tag}/manifest
    • POST /api/repositories/{repo_name}/tags/{tag}/scan
    • GET /api/repositories/{repo_name}/tags/{tag}/vulnerability/details
    • GET /repositories/{repo_name}/signatures
    • GET /api/repositories/top
  • logs
    • GET /api/logs
  • jobs
    • GET /api/jobs/replication
    • PUT /api/jobs/replication
    • DELETE /api/jobs/replication/{id}
    • GET /api/jobs/replication/{id}/log
    • GET /api/jobs/scan/{id}/log
  • policies
    • GET /api/policies/replication
    • POST /api/policies/replication
    • GET /api/policies/replication/{id}
    • PUT /api/policies/replication/{id}
  • labels
    • GET /api/labels
    • POST /api/labels
    • DELETE /api/labels/{id}
    • GET /api/labels/{id}
    • PUT /api/labels/{id}
  • replications
    • POST /api/replications
  • targets
    • GET /api/targets
    • POST /api/targets
    • POST /api/targets/ping
    • POST /api/targets/{id}/ping (deprecated)
    • DELETE /api/targets/{id}
    • GET /api/targets/{id}
    • PUT /api/targets/{id}
    • GET /api/targets/{id}/policies/
  • internal
    • POST /api/internal/syncregistry
  • systeminfo
    • GET /api/systeminfo
    • GET /api/systeminfo/volumes
    • GET /api/systeminfo/getcert
  • ldap
    • POST /api/ldap/ping
    • GET /api/ldap/groups/search
    • GET /api/ldap/users/search
    • POST /api/ldap/users/import
  • usergroups
    • GET /api/usergroups
    • POST /api/usergroups
    • DELETE /api/usergroups/{group_id}
    • GET /api/usergroups/{group_id}
    • PUT /api/usergroups/{group_id}
  • configurations
    • GET /api/configurations
    • PUT /api/configurations
    • POST /api/configurations/reset
  • email
    • POST /api/email/ping

Additional features supported:

  • rp_tags: Do tags deletion on repositories according to retention policy.
  • rp_repos: Do soft deletion on repositories according to retention policy (prompt user performing a GC after that).

Installation

go get -u github.com/moooofly/harbor-go-client

Quick Start

  • lint + build + test
make
  • install the package into $GOPATH
make install
  • remove the corresponding installed archive or binary (what 'go install' would create)
make clean
  • do some tests
make test

Documentation

See docs

Testing

You can run integration test with scripts/regression_test.sh (Assuming local Harbor installation)

Auxiliaries Coverage

  • go test
  • integration test (by scripts/*.sh)
  • CI (by travis-ci)
  • dockerization
  • godoc (need to optimize)
  • go module support
  • sql-like result output

Credits

License

harbor-go-client is licensed under the MIT License. See LICENSE for the full license text.

This project uses open source components which have additional licensing terms. The licensing terms for these open source components can be found at the following locations:

About

A CLI tool for the Docker Registry Harbor. This project offer a command-line interface to the Harbor API, you can use it to manager your users, projects, repositories, etc.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •