6.10. Red Hat Quay API を使用したクォータの確立
組織は API エンドポイントを通じて作成および管理できます。Red Hat Quay API を使用すると、組織の作成、組織情報の表示、組織のプロキシーキャッシュの作成、組織へのアクセス権を持つユーザーの編集、組織の詳細の変更、組織の削除などを実行できます。
6.10.1. Red Hat Quay API を使用した組織の作成 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Quay API を使用して新しい組織を作成するには、次の手順に従います。
前提条件
- OAuth アクセストークンを作成 した。
-
config.yaml
ファイルでBROWSER_API_CALLS_XHR_ONLY: false
を設定している。
手順
次のコマンドを入力して、
POST /api/v1/organization/ エンドポイントを使用して新しい組織
を作成します。curl -X POST -H "Authorization: Bearer <bearer_token>" -H "Content-Type: application/json" -d '{
$ curl -X POST -H "Authorization: Bearer <bearer_token>" -H "Content-Type: application/json" -d '{ "name": "<new_organization_name>" }' "https://<quay-server.example.com>/api/v1/organization/"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
"Created"
"Created"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 作成後、
PUT /api/v1/organization/{orgname}
コマンドを使用して、メールアドレスの追加など、組織の詳細を変更できます。以下に例を示します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"name": "test", "email": "new-contact@test-org.com", "avatar": {"name": "test", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "user"}, "is_admin": true, "is_member": true, "teams": {"owners": {"name": "owners", "description": "", "role": "admin", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}, "can_view": true, "repo_count": 0, "member_count": 1, "is_synced": false}}, "ordered_teams": ["owners"], "invoice_email": true, "invoice_email_address": "billing@test-org.com", "tag_expiration_s": 1209600, "is_free_account": true, "quotas": [{"id": 2, "limit_bytes": 10737418240, "limits": [{"id": 1, "type": "Reject", "limit_percent": 90}]}], "quota_report": {"quota_bytes": 0, "configured_quota": 10737418240, "running_backfill": "complete", "backfill_status": "complete"}}
{"name": "test", "email": "new-contact@test-org.com", "avatar": {"name": "test", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "user"}, "is_admin": true, "is_member": true, "teams": {"owners": {"name": "owners", "description": "", "role": "admin", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}, "can_view": true, "repo_count": 0, "member_count": 1, "is_synced": false}}, "ordered_teams": ["owners"], "invoice_email": true, "invoice_email_address": "billing@test-org.com", "tag_expiration_s": 1209600, "is_free_account": true, "quotas": [{"id": 2, "limit_bytes": 10737418240, "limits": [{"id": 1, "type": "Reject", "limit_percent": 90}]}], "quota_report": {"quota_bytes": 0, "configured_quota": 10737418240, "running_backfill": "complete", "backfill_status": "complete"}}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.10.2. Red Hat Quay API を使用した組織の削除 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Quay API を使用して組織を削除するには、次の手順に従います。
前提条件
- OAuth アクセストークンを作成 した。
-
config.yaml
ファイルでBROWSER_API_CALLS_XHR_ONLY: false
を設定している。
手順
以下のコマンドを入力して、
DELETE /api/v1/organization/{orgname} エンドポイントを使用して組織
を削除します。curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ "https://<quay-server.example.com>/api/v1/organization/<organization_name>"
$ curl -X DELETE \ -H "Authorization: Bearer <bearer_token>" \ "https://<quay-server.example.com>/api/v1/organization/<organization_name>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow CLI から組織を削除する場合、CLI は情報を返しません。削除を確認するには、Red Hat Quay UI を確認するか、
GET /api/v1/organization/{orgname} コマンドを入力して、削除された組織
の詳細が返されているかどうかを確認します。curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ "<quay-server.example.com>/api/v1/organization/<organization_name>"
$ curl -X GET \ -H "Authorization: Bearer <bearer_token>" \ "<quay-server.example.com>/api/v1/organization/<organization_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
6.10.3. API を使用して組織メンバーの情報を取得する リンクのコピーリンクがクリップボードにコピーされました!
組織メンバーに関する情報は、Red Hat Quay API を使用して取得できます。
手順
GET /api/v1/organization/{orgname}/members
使用して、組織メンバーのリストを返します。curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/members" \ -H "Authorization: Bearer <access_token>"
$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/members" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"members": [{"name": "quayadmin", "kind": "user", "avatar": {"name": "quayadmin", "hash": "6d640d802fe23b93779b987c187a4b7a4d8fbcbd4febe7009bdff58d84498fba", "color": "#f7b6d2", "kind": "user"}, "teams": [{"name": "owners", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}}], "repositories": ["testrepo"]}, {"name": "testuser", "kind": "user", "avatar": {"name": "testuser", "hash": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a", "color": "#6b6ecf", "kind": "user"}, "teams": [{"name": "owners", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}}], "repositories": []}]}
{"members": [{"name": "quayadmin", "kind": "user", "avatar": {"name": "quayadmin", "hash": "6d640d802fe23b93779b987c187a4b7a4d8fbcbd4febe7009bdff58d84498fba", "color": "#f7b6d2", "kind": "user"}, "teams": [{"name": "owners", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}}], "repositories": ["testrepo"]}, {"name": "testuser", "kind": "user", "avatar": {"name": "testuser", "hash": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a", "color": "#6b6ecf", "kind": "user"}, "teams": [{"name": "owners", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}}], "repositories": []}]}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow GET /api/v1/organization/{orgname}/collaborators
使用して、組織の共同作業者のリストを返すことができます。curl -X GET "https://<quay-server.example.com>/api/v1/organization/{orgname}/collaborators" \ -H "Authorization: Bearer <access_token>"
$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/{orgname}/collaborators" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"collaborators": [user-test]}
{"collaborators": [user-test]}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ユーザーに関するより具体的な情報を取得するには、
GET /api/v1/organization/{orgname}/members/{membername}
エンドポイントを使用します。curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/members/<membername>" \ -H "Authorization: Bearer <access_token>"
$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/members/<membername>" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"name": "quayadmin", "kind": "user", "avatar": {"name": "quayadmin", "hash": "6d640d802fe23b93779b987c187a4b7a4d8fbcbd4febe7009bdff58d84498fba", "color": "#f7b6d2", "kind": "user"}, "teams": [{"name": "owners", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}}], "repositories": ["testrepo"]}
{"name": "quayadmin", "kind": "user", "avatar": {"name": "quayadmin", "hash": "6d640d802fe23b93779b987c187a4b7a4d8fbcbd4febe7009bdff58d84498fba", "color": "#f7b6d2", "kind": "user"}, "teams": [{"name": "owners", "avatar": {"name": "owners", "hash": "6f0e3a8c0eb46e8834b43b03374ece43a030621d92a7437beb48f871e90f8d90", "color": "#c7c7c7", "kind": "team"}}], "repositories": ["testrepo"]}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow チームメンバーを削除するには、
DELETE /api/v1/organization/{orgname}/members/{membername}
エンドポイントを使用します。curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/<orgname>/members/<membername>" \ -H "Authorization: Bearer <access_token>"
$ curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/<orgname>/members/<membername>" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow このコマンドは出力を返しません。
6.10.4. Red Hat Quay API を使用して組織アプリケーションを作成する リンクのコピーリンクがクリップボードにコピーされました!
組織アプリケーションは、Red Hat Quay UI を使用して作成できます。
組織アプリケーションは UI を使用して作成できますが、OAuth 2 アクセストークンは UI で作成する必要があります。
手順
組織用の新しいアプリケーションを作成するには、
POST /api/v1/organization/{orgname}/applications
エンドポイントを使用します。以下に例を示します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"name": "new-application", "description": "", "application_uri": "", "client_id": "E6GJSHOZMFBVNHTHNB53", "client_secret": "SANSWCWSGLVAUQ60L4Q4CEO3C1QAYGEXZK2VKJNI", "redirect_uri": "", "avatar_email": null}
{"name": "new-application", "description": "", "application_uri": "", "client_id": "E6GJSHOZMFBVNHTHNB53", "client_secret": "SANSWCWSGLVAUQ60L4Q4CEO3C1QAYGEXZK2VKJNI", "redirect_uri": "", "avatar_email": null}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow GET /api/v1/organization/{orgname}/applications
エンドポイントを使用して、すべての組織アプリケーションのリストを返します。以下に例を示します。curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/applications" \ -H "Authorization: Bearer <access_token>"
$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/applications" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"applications": [{"name": "test", "description": "", "application_uri": "", "client_id": "MCJ61D8KQBFS2DXM56S2", "client_secret": "J5G7CCX5QCA8Q5XZLWGI7USJPSM4M5MQHJED46CF", "redirect_uri": "", "avatar_email": null}, {"name": "new-token", "description": "", "application_uri": "", "client_id": "IG58PX2REEY9O08IZFZE", "client_secret": "2LWTWO89KH26P2CO4TWFM7PGCX4V4SUZES2CIZMR", "redirect_uri": "", "avatar_email": null}, {"name": "second-token", "description": "", "application_uri": "", "client_id": "6XBK7QY7ACSCN5XBM3GS", "client_secret": "AVKBOUXTFO3MXBBK5UJD5QCQRN2FWL3O0XPZZT78", "redirect_uri": "", "avatar_email": null}, {"name": "new-application", "description": "", "application_uri": "", "client_id": "E6GJSHOZMFBVNHTHNB53", "client_secret": "SANSWCWSGLVAUQ60L4Q4CEO3C1QAYGEXZK2VKJNI", "redirect_uri": "", "avatar_email": null}]}
{"applications": [{"name": "test", "description": "", "application_uri": "", "client_id": "MCJ61D8KQBFS2DXM56S2", "client_secret": "J5G7CCX5QCA8Q5XZLWGI7USJPSM4M5MQHJED46CF", "redirect_uri": "", "avatar_email": null}, {"name": "new-token", "description": "", "application_uri": "", "client_id": "IG58PX2REEY9O08IZFZE", "client_secret": "2LWTWO89KH26P2CO4TWFM7PGCX4V4SUZES2CIZMR", "redirect_uri": "", "avatar_email": null}, {"name": "second-token", "description": "", "application_uri": "", "client_id": "6XBK7QY7ACSCN5XBM3GS", "client_secret": "AVKBOUXTFO3MXBBK5UJD5QCQRN2FWL3O0XPZZT78", "redirect_uri": "", "avatar_email": null}, {"name": "new-application", "description": "", "application_uri": "", "client_id": "E6GJSHOZMFBVNHTHNB53", "client_secret": "SANSWCWSGLVAUQ60L4Q4CEO3C1QAYGEXZK2VKJNI", "redirect_uri": "", "avatar_email": null}]}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow GET/api/v1/organization/{orgname}/applications/{client_id}
エンドポイントを使用して、特定のクライアントのアプリケーションを返すこともできます。以下に例を示します。curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/applications/<client_id>" \ -H "Authorization: Bearer <access_token>"
$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/<orgname>/applications/<client_id>" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"name": "test", "description": "", "application_uri": "", "client_id": "MCJ61D8KQBFS2DXM56S2", "client_secret": "J5G7CCX5QCA8Q5XZLWGI7USJPSM4M5MQHJED46CF", "redirect_uri": "", "avatar_email": null}
{"name": "test", "description": "", "application_uri": "", "client_id": "MCJ61D8KQBFS2DXM56S2", "client_secret": "J5G7CCX5QCA8Q5XZLWGI7USJPSM4M5MQHJED46CF", "redirect_uri": "", "avatar_email": null}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 作成後に、組織アプリケーションを更新できます。たとえば、リダイレクト URI や新しい説明を追加する場合は、
PUT /api/v1/organization/{orgname}/applications/{client_id}
エンドポイントを使用します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 作成後、
GET /api/v1/app/{client_id}
エンドポイントを使用してアプリケーション情報を返すことができます。curl -X GET "https://<quay-server.example.com>/api/v1/app/<client_id>" \ -H "Authorization: Bearer <access_token>"
$ curl -X GET "https://<quay-server.example.com>/api/v1/app/<client_id>" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"name": "new-application3", "description": "", "uri": "", "avatar": {"name": "new-application3", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "app"}, "organization": {"name": "test", "email": "new-contact@test-org.com", "avatar": {"name": "test", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "user"}, "is_admin": true, "is_member": true, "teams": {}, "ordered_teams": [], "invoice_email": true, "invoice_email_address": "billing@test-org.com", "tag_expiration_s": 1209600, "is_free_account": true, "quotas": [{"id": 2, "limit_bytes": 10737418240, "limits": [{"id": 1, "type": "Reject", "limit_percent": 90}]}], "quota_report": {"quota_bytes": 0, "configured_quota": 10737418240, "running_backfill": "complete", "backfill_status": "complete"}}}
{"name": "new-application3", "description": "", "uri": "", "avatar": {"name": "new-application3", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "app"}, "organization": {"name": "test", "email": "new-contact@test-org.com", "avatar": {"name": "test", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "user"}, "is_admin": true, "is_member": true, "teams": {}, "ordered_teams": [], "invoice_email": true, "invoice_email_address": "billing@test-org.com", "tag_expiration_s": 1209600, "is_free_account": true, "quotas": [{"id": 2, "limit_bytes": 10737418240, "limits": [{"id": 1, "type": "Reject", "limit_percent": 90}]}], "quota_report": {"quota_bytes": 0, "configured_quota": 10737418240, "running_backfill": "complete", "backfill_status": "complete"}}}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 組織アプリケーション、
DELETE /api/v1/organization/{orgname}/applications/{client_id}
エンドポイントを使用して削除できます。以下に例を示します。curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/{orgname}/applications/{client_id}" \ -H "Authorization: Bearer <access_token>"
$ curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/{orgname}/applications/{client_id}" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow このコマンドは出力を返しません。
6.10.5. Red Hat Quay API を使用して組織のプロキシーキャッシュを設定する リンクのコピーリンクがクリップボードにコピーされました!
組織のプロキシーキャッシュは、Red Hat Quay API を使用して設定できます。
手順
組織のプロキシーキャッシュ設定を作成するには、
POST /api/v1/organization/{orgname}/proxycache
エンドポイントを使用します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow プロキシー設定を検証するには、
POST /api/v1/organization/{orgname}/validateproxycache
エンドポイントを使用します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow プロキシーキャッシュに関する情報を取得するには、
GET /api/v1/organization/{orgname}/proxycache
エンドポイントを使用します。以下に例を示します。curl -X GET "https://<quay-server.example.com>/api/v1/organization/{orgname}/proxycache" \ -H "Authorization: Bearer <access_token>"
$ curl -X GET "https://<quay-server.example.com>/api/v1/organization/{orgname}/proxycache" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
{"upstream_registry": "quay.io", "expiration_s": 86400, "insecure": false}
{"upstream_registry": "quay.io", "expiration_s": 86400, "insecure": false}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow DELETE /api/v1/organization/{orgname}/proxycache
エンドポイントを使用します。curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/{orgname}/proxycache" \ -H "Authorization: Bearer <access_token>"
$ curl -X DELETE "https://<quay-server.example.com>/api/v1/organization/{orgname}/proxycache" \ -H "Authorization: Bearer <access_token>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
"Deleted"
"Deleted"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow