6.13. Red Hat Quay API を使用してリポジトリーを作成および設定する
Red Hat Quay API を使用して、リポジトリーを作成、取得、変更、削除できます。
6.13.1. Red Hat Quay API を使用してリポジトリーを作成および設定する リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Quay API を使用して、リポジトリーを作成、取得、変更、削除できます。
手順
次のコマンドを入力し、
POST /api/v1/repository
エンドポイントを使用してリポジトリーを作成します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"namespace": "quayadmin", "name": "<new_repository_name>", "kind": "image"}
{"namespace": "quayadmin", "name": "<new_repository_name>", "kind": "image"}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow GET /api/v1/repository
エンドポイントを使用して、リポジトリーをリスト表示できます。以下に例を示します。curl -X GET \ -H "Authorization: Bearer <ACCESS_TOKEN>" \ "https://quay-server.example.com/api/v1/repository?public=true&starred=false&namespace=<NAMESPACE>"
$ curl -X GET \ -H "Authorization: Bearer <ACCESS_TOKEN>" \ "https://quay-server.example.com/api/v1/repository?public=true&starred=false&namespace=<NAMESPACE>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"repositories": [{"namespace": "quayadmin", "name": "busybox", "description": null, "is_public": false, "kind": "image", "state": "MIRROR", "is_starred": false, "quota_report": {"quota_bytes": 2280675, "configured_quota": 2199023255552}}]}
{"repositories": [{"namespace": "quayadmin", "name": "busybox", "description": null, "is_public": false, "kind": "image", "state": "MIRROR", "is_starred": false, "quota_report": {"quota_bytes": 2280675, "configured_quota": 2199023255552}}]}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 可視性は、
POST /api/v1/repository/{repository}/changevisibility
エンドポイントを使用してパブリックからプライベートに変更できます。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"success": true}
{"success": true}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Red Hat Quay UI を確認するか、次の
GET /api/v1/repository/{repository}
コマンドを入力してリポジトリーの詳細を返せます。curl -X GET -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
$ curl -X GET -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"detail": "Not Found", "error_message": "Not Found", "error_type": "not_found", "title": "not_found", "type": "http://quay-server.example.com/api/v1/error/not_found", "status": 404}
{"detail": "Not Found", "error_message": "Not Found", "error_type": "not_found", "title": "not_found", "type": "http://quay-server.example.com/api/v1/error/not_found", "status": 404}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow リポジトリーの説明は、
PUT /api/v1/repository/{repository}
エンドポイントを使用して更新できます。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"success": true}
{"success": true}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 次のコマンドを入力し、
DELETE /api/v1/repository/{repository}
エンドポイントを使用してリポジトリーを削除します。curl -X DELETE -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
$ curl -X DELETE -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow このコマンドは CLI に出力を返しません。
6.13.2. API を使用した通知の作成 リンクのコピーリンクがクリップボードにコピーされました!
通知を追加するには、次の手順を実行します。
前提条件
- リポジトリーが作成済みである。
- リポジトリーの管理者権限がある。
- OAuth アクセストークンを作成 している。
手順
次の
POST /api/v1/repository/{repository}/notification
コマンドを入力し、リポジトリーに関する通知を作成します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow このコマンドは CLI に出力を返しません。次の
GET /api/v1/repository/{repository}/notification/{uuid}
コマンドを入力すると、リポジトリー通知に関する情報を取得できます。{"uuid": "240662ea-597b-499d-98bb-2b57e73408d6", "title": null, "event": "repo_push", "method": "quay_notification", "config": {"target": {"name": "quayadmin", "kind": "user", "is_robot": false, "avatar": {"name": "quayadmin", "hash": "b28d563a6dc76b4431fc7b0524bbff6b810387dac86d9303874871839859c7cc", "color": "#17becf", "kind": "user"}}}, "event_config": {}, "number_of_failures": 0}
{"uuid": "240662ea-597b-499d-98bb-2b57e73408d6", "title": null, "event": "repo_push", "method": "quay_notification", "config": {"target": {"name": "quayadmin", "kind": "user", "is_robot": false, "avatar": {"name": "quayadmin", "hash": "b28d563a6dc76b4431fc7b0524bbff6b810387dac86d9303874871839859c7cc", "color": "#17becf", "kind": "user"}}}, "event_config": {}, "number_of_failures": 0}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 次の
POST /api/v1/repository/{repository}/notification/{uuid}/test
コマンドを入力すると、リポジトリー通知をテストできます。curl -X POST \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<repository>/notification/<uuid>/test
$ curl -X POST \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<repository>/notification/<uuid>/test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{}
{}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 次の
POST /api/v1/repository/{repository}/notification/{uuid}
コマンドを入力すると、リポジトリー通知の失敗を 0 にリセットできます。curl -X POST \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<repository>/notification/<uuid>
$ curl -X POST \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<repository>/notification/<uuid>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow リポジトリー通知を削除するには、次の
DELETE /api/v1/repository/{repository}/notification/{uuid}
コマンドを入力します。curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>/notification/<uuid>
$ curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>/notification/<uuid>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow このコマンドは CLI に出力を返しません。次の
GET /api/v1/repository/{repository}/notification/
コマンドを入力すると、すべての通知のリストを取得できます。curl -X GET -H "Authorization: Bearer <bearer_token>" -H "Accept: application/json" https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>/notification
$ curl -X GET -H "Authorization: Bearer <bearer_token>" -H "Accept: application/json" https://<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>/notification
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"notifications": []}
{"notifications": []}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow