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 アクセストークンを作成 した。
-
config.yaml
ファイルでBROWSER_API_CALLS_XHR_ONLY: false
を設定している。
手順
以下の
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