harborctl icon indicating copy to clipboard operation
harborctl copied to clipboard

[NOTE] The parameters of API "PUT /projects/{project_id}" alters dramatically.

Open moooofly opened this issue 7 years ago • 1 comments

related:

  • https://github.com/moooofly/harbor-go-client/issues/19
  • https://github.com/moooofly/harbor-go-client/issues/20

by swagger file for harbor API v1.6.0, the content body of "PUT /projects/{project_id}" is

{
  "project_name": "temp_10",
  "metadata": {
    "public": "true",
    "enable_content_trust": "true",
    "prevent_vul": "false",
    "severity": "low",
    "auto_scan": "true"
  }
}

by swagger file for harbor API v1.4.0, the content body of "PUT /projects/{project_id}" is

  • original definition (will trigger "400 Invalid json request")
{
   "project_name": "temp_10",
   "metadata": {
      "public": 1,
      "enable_content_trust": false,
      "prevent_vulnerable_images_from_running": false,
      "prevent_vulnerable_images_from_running_severity": "",
      "automatically_scan_images_on_push": false
   }
}
  • the working one (change by me)
{
   "project_name": "temp_10",
   "public": 1,
   "enable_content_trust": false,
   "prevent_vulnerable_images_from_running": false,
   "prevent_vulnerable_images_from_running_severity": "",
   "automatically_scan_images_on_push": false
}

CONCLUSION

  • The name of the key has changed.
  • The type of the value has changed.
  • by API v1.4.0, this API dose not work as expect.
  • by API v.16.0, this API do work well.

moooofly avatar Nov 02 '18 10:11 moooofly

PS: one more thing to mention, the key of project_name is still not working as expect in API v1.6.0 (seems useless).

moooofly avatar Nov 02 '18 10:11 moooofly