harbor-go-client icon indicating copy to clipboard operation
harbor-go-client copied to clipboard

[NOTE] API "PUT /api/projects/{project_id}" not work properly

Open moooofly opened this issue 5 years ago • 0 comments

Even if changing the format of content body as #19 , this API still dose not work as it should.

[#398#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$./harborctl project get -i 96
==> GET https://localhost/api/projects/96
<==
<== Rsp Status: 200 OK
<== Rsp Body: {
  "project_id": 96,
  "owner_id": 1,
  "name": "ppp",
  "creation_time": "2018-10-30T03:53:00Z",
  "update_time": "2018-10-30T03:53:00Z",
  "deleted": 0,
  "owner_name": "",
  "togglable": true,
  "current_user_role_id": 1,
  "repo_count": 0,
  "metadata": {
    "public": "false"
  }
}
[#399#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$
[#399#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$
[#399#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$
[#399#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$./harborctl project update -h
This endpoint is aimed to update the properties of a project.

Usage:
  harborctl project update [flags]

Flags:
  -a, --automatically_scan_images_on_push                        Whether scan images automatically when pushing.
  -t, --enable_content_trust                                     Whether content trust is enabled or not. If it is enabled, user cann't pull unsigned images from this project.
  -h, --help                                                     help for update
  -r, --prevent_vulnerable_images_from_running                   Whether prevent the vulnerable images from running.
  -s, --prevent_vulnerable_images_from_running_severity string   If the vulnerability is high than severity defined here, the images cann't be pulled.
  -i, --project_id int32                                         (REQUIRED) Project ID of project which will be update.
  -n, --project_name string                                      The name of the project.
  -k, --public int32                                             The public status of the project, public(1) or private(0). (default 1)

Global Flags:
      --config string   config file (default is $HOME/, working dir (.), and ./conf dir)
[#400#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$
[#400#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$
[#400#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$./harborctl project update -i 96 -n qqq -k 1
==> PUT https://localhost/api/projects/96
==> project update: {"project_name":"qqq","public":1,"enable_content_trust":false,"prevent_vulnerable_images_from_running":false,"prevent_vulnerable_images_from_running_severity":"","automatically_scan_images_on_push":false}
<==
<== Rsp Status: 200 OK
<== Rsp Body:
[#401#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$
[#401#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$./harborctl project get -i 96
==> GET https://localhost/api/projects/96
<==
<== Rsp Status: 200 OK
<== Rsp Body: {
  "project_id": 96,
  "owner_id": 1,
  "name": "ppp",
  "creation_time": "2018-10-30T03:53:00Z",
  "update_time": "2018-10-30T03:53:00Z",
  "deleted": 0,
  "owner_name": "",
  "togglable": true,
  "current_user_role_id": 1,
  "repo_count": 0,
  "metadata": {
    "public": "false"
  }
}
[#402#root@ubuntu-1604 /go/src/github.com/moooofly/harborctl]$

moooofly avatar Oct 30 '18 07:10 moooofly