codecamp

OpenAI 创建工作负载身份联邦规则

创建工作负载身份联邦规则

post /organization/workload_identity_providers/{workload_identity_provider_id}/federation_rules

将验证过的令牌属性绑定到现有项目服务账户。

路径参数

  • workload_identity_provider_id: string

minLength: 1

请求体参数

内容类型为 application/json。

  • attribute_matchers: map[string or boolean or number or number]

  • string

  • boolean

  • number or number

  • number

  • number

  • project_id: string

minLength: 1

  • service_account_id: string

minLength: 1

  • description: optional string

  • enabled: optional boolean

  • name: optional string

  • permissions: optional DefaultPermissionsParam { type } or RestrictedPermissionsParam { scopes, type }

  • DefaultPermissionsParam object { type }

  • type: "service_account_default" (default: "service_account_default")

  • "service_account_default"

  • RestrictedPermissionsParam object { scopes, type }

  • scopes: array of string

minItems: 1

  • type: "restricted" (default: "restricted")

  • "restricted"

返回值

  • FederationRule object { id, attribute_matchers, created_at, 9 more }

  • id: string

  • attribute_matchers: map[string or boolean or number or number]

  • string

  • boolean

  • number or number

  • number

  • number

  • created_at: integer

  • description: string or null

  • enabled: boolean

  • name: string or null

  • object: "organization.workload_identity_federation_rule" (default: "organization.workload_identity_federation_rule")

  • "organization.workload_identity_federation_rule"

  • permissions: DefaultPermissions { type } or RestrictedPermissions { scopes, type }

  • DefaultPermissions object { type }

  • type: "service_account_default" (default: "service_account_default")

  • "service_account_default"

  • RestrictedPermissions object { scopes, type }

  • scopes: array of string

  • type: "restricted" (default: "restricted")

  • "restricted"

  • project_id: string

  • service_account_id: string

  • updated_at: integer

  • workload_identity_provider_id: string

示例

## 从环境变量读取管理员密钥。核对创建请求的参数(身份联邦规则)
curl -X POST "https://api.openai.com/v1/organization/workload_identity_providers/wip_example/federation_rules" \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "project_id": "proj_example",
  "service_account_id": "svc_acct_example",
  "attribute_matchers": {
    "sub": "ci:release"
  }
}'

响应示例

{
  "object": "organization.workload_identity_federation_rule",
  "id": "wifr_example",
  "workload_identity_provider_id": "wip_example",
  "project_id": "proj_example",
  "service_account_id": "svc_acct_example",
  "name": null,
  "description": null,
  "attribute_matchers": {
    "sub": "ci:release"
  },
  "permissions": {
    "type": "service_account_default"
  },
  "enabled": true,
  "created_at": 1793664000,
  "updated_at": 1793664000
}
OpenAI 列出工作负载身份提供商
OpenAI 获取工作负载身份联邦规则
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

其他能力与进阶指南

Embeddings 接口参考

审计日志接口参考

项目管理及子资源接口参考

Agents 接口及子资源

Decisions 接口参考

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }