4.2. 使用 Red Hat Quay API 创建机构


使用以下步骤使用 Red Hat Quay API 创建新机构。

先决条件

  • 您已创建了 OAuth 访问令牌
  • 您已在 config.yaml 文件中设置了 BROWSER_API_CALLS_XHR_ONLY: false

流程

  1. 输入以下命令使用 POST /api/v1/organization/ 端点创建新机构:

    $ 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/"

    输出示例

    "Created"
  2. 创建后,可以更改机构详情,如添加电子邮件地址,带有 PUT /api/v1/organization/{orgname} 命令。例如:

    $ curl -X PUT "https://<quay-server.example.com>/api/v1/organization/<orgname>" \
      -H "Authorization: Bearer <access_token>" \
      -H "Content-Type: application/json" \
      -d '{
            "email": "<org_email>",
            "invoice_email": <true/false>,
            "invoice_email_address": "<billing_email>"
          }'

    输出示例

    {"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"}}

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.