OpenAI 创建工作负载身份联邦规则
2026-11-19 17:50 更新
创建工作负载身份联邦规则
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
}以上内容是否对您有帮助:

TRAE-AI编程


更多建议: