14.4. 使用 API 管理配额限制


首次创建机构时,它没有建立的配额。您可以使用 API 检查、创建、更改或删除机构的配额限制。

先决条件

  • 您已生成了 OAuth 访问令牌。

14.4.1. 使用 API 设置配额

使用以下步骤使用 Red Hat Quay API 设置配额限制。

流程

  1. 要为机构设置配额,您可以使用 POST /api/v1/organization/{orgname}/quota 端点:

    $ curl -X POST "https://<quay-server.example.com>/api/v1/organization/<orgname>/quota" \
         -H "Authorization: Bearer <access_token>" \
         -H "Content-Type: application/json" \
         -d '{
             "limit_bytes": 10737418240,
             "limits": "10 Gi"
         }'

    输出示例

    "Created"

  2. 使用 GET /api/v1/organization/{orgname}/quota 命令查看您的机构是否已建立的配额:

    $ curl -k -X GET -H "Authorization: Bearer <token>" -H 'Content-Type: application/json'  https://<quay-server.example.com>/api/v1/organization/<organization_name>/quota  | jq

    输出示例

    [{"id": 1, "limit_bytes": 10737418240, "limit": "10.0 GiB", "default_config": false, "limits": [], "default_config_exists": false}]

  3. 您可以使用 PUT /api/v1/organization/{orgname}/quota/{quota_id} 命令修改现有的配额限制。例如:

    $ curl -X PUT "https://<quay-server.example.com>/api/v1/organization/<orgname>/quota/<quota_id>" \
         -H "Authorization: Bearer <access_token>" \
         -H "Content-Type: application/json" \
         -d '{
             "limit_bytes": <limit_in_bytes>
         }'

    输出示例

    {"id": 1, "limit_bytes": 21474836480, "limit": "20.0 GiB", "default_config": false, "limits": [], "default_config_exists": false}

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部