8.6. API を使用してラベルを追加および管理する
Red Hat Quay 管理者は、以下の手順を使用して、API を使用してタグのラベルを追加および管理できます。
前提条件
- OAuth アクセストークンを作成し ました。
手順
リポジトリー内の特定のマニフェストの詳細を取得するには
、GET/api/v1/repository/{repository}/manifest/{manifestref}
コマンドを使用します。curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>
$ curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 特定のマニフェストのラベルのリストを取得するには、
GET/api/v1/repository/{repository}/manifest/{manifestref}/labels
コマンドを使用します。curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>/labels
$ curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>/labels
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"labels": [{"id": "e9f717d2-c1dd-4626-802d-733a029d17ad", "key": "org.opencontainers.image.url", "value": "https://github.com/docker-library/busybox", "source_type": "manifest", "media_type": "text/plain"}, {"id": "2d34ec64-4051-43ad-ae06-d5f81003576a", "key": "org.opencontainers.image.version", "value": "1.36.1-glibc", "source_type": "manifest", "media_type": "text/plain"}]}
{"labels": [{"id": "e9f717d2-c1dd-4626-802d-733a029d17ad", "key": "org.opencontainers.image.url", "value": "https://github.com/docker-library/busybox", "source_type": "manifest", "media_type": "text/plain"}, {"id": "2d34ec64-4051-43ad-ae06-d5f81003576a", "key": "org.opencontainers.image.version", "value": "1.36.1-glibc", "source_type": "manifest", "media_type": "text/plain"}]}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 特定のマニフェストに関する情報を取得するには
、GET/api/v1/repository/{repository}/manifest/{manifestref}/labels/{labelid}
コマンドを使用します。curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>/labels/<label_id>
$ curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ -H "Accept: application/json" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>/labels/<label_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"id": "e9f717d2-c1dd-4626-802d-733a029d17ad", "key": "org.opencontainers.image.url", "value": "https://github.com/docker-library/busybox", "source_type": "manifest", "media_type": "text/plain"}
{"id": "e9f717d2-c1dd-4626-802d-733a029d17ad", "key": "org.opencontainers.image.url", "value": "https://github.com/docker-library/busybox", "source_type": "manifest", "media_type": "text/plain"}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow POST/api/v1/repository/{repository}/manifest/{manifestref}/labels
コマンドを使用して、特定のリポジトリー内のマニフェストに追加のラベルを追加できます。以下に例を示します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"label": {"id": "346593fd-18c8-49db-854f-4cb1fb76ff9c", "key": "example-key", "value": "example-value", "source_type": "api", "media_type": "text/plain"}}
{"label": {"id": "346593fd-18c8-49db-854f-4cb1fb76ff9c", "key": "example-key", "value": "example-value", "source_type": "api", "media_type": "text/plain"}}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow DELETE/api/v1/repository/{repository}/manifest/{manifestref}/labels/{labelid}
コマンドを使用してラベルを削除できます。curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>/labels/<labelid>
$ curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<repository>/manifest/<manifestref>/labels/<labelid>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow このコマンドは CLI に出力を返しません。上記のコマンドのいずれかを使用して、正常に削除されたことを確認できます。