Google 会使用 AI 技术将内容翻译成您偏好的语言。AI 翻译可能包含错误。
IAM Unified Access Policies 的 CEL 属性
本文档介绍了在为 Agent Gateway 编写 IAM Unified Access Policies (UAP) 中的条件表达式时可以使用的通用表达式语言 (CEL) 属性和函数。
如需详细了解 UAP 概念,请参阅 IAM UAP 概览。
如需了解如何配置 UAP,请参阅创建 IAM UAP。
可用的 CEL 属性
在 UAP 中,您可以使用条件表达式定义条件。表达式可以包含多个子表达式。您在每个关系子条件中使用的目标资源类型决定了您可以使用的属性。
例如,在以下条件中,在子表达式 destination.unregistered.path.startsWith('/v1/statements') 中,资源类型是未注册的目标,属性是 destination.unregistered.path,而 startsWith() 是 CEL 函数。
destination.unregistered.host == 'finance.example.com' &&
destination.unregistered.path.startsWith('/v1/statements')
下表中所述的属性适用于每种资源类型:
| 目标资源类型 |
属性 |
详细信息 |
Agent Registry |
destination.is_registered |
| 值类型 |
布尔值 |
| 支持的值 |
true,false |
| 支持的操作 |
==,!= |
|
destination.agent_registry.resource_type |
| 值类型 |
字符串 |
| 支持的值 |
'AGENT'、'ENDPOINT'、'MCP_SERVER'、'SKILL'
|
| 支持的操作 |
==、!=、in
|
|
destination.agent_registry.location |
| 值类型 |
字符串 |
| 支持的值 |
Google Cloud 位置 ID(例如 'global'、'us-central1')
|
| 支持的操作 |
==、!=、in
|
|
destination.agent_registry.project_id |
| 值类型 |
字符串 |
| 支持的值 |
Google Cloud 项目 ID |
| 支持的操作 |
==、!=、in
|
|
代理 |
destination.agent_registry.agent.name |
| 值类型 |
字符串 |
| 支持的值 |
代理资源名称 (projects/PROJECT_ID/locations/LOCATION/agents/AGENT_NAME)
|
| 支持的操作 |
==、!=、in
|
|
MCP 服务器 |
destination.agent_registry.mcp_server.name |
| 值类型 |
字符串 |
| 支持的值 |
MCP 服务器资源名称 (projects/PROJECT_ID/locations/LOCATION/mcpServers/MCP_SERVER_NAME)
|
| 支持的操作 |
==、!=、in
|
|
destination.agent_registry.mcp_server.method |
| 值类型 |
字符串 |
| 支持的值 |
MCP 方法名称(例如,'tools'、'prompts'、'resources')
|
| 支持的操作 |
==、!=、in
|
|
destination.agent_registry.mcp_server.tool.name |
| 值类型 |
字符串 |
| 支持的值 |
工具名称(例如,'search_code'、'execute')
|
| 支持的操作 |
==、!=、in
|
|
destination.agent_registry.mcp_server.tool.annotations.read_only_hint
|
| 值类型 |
布尔值 |
| 支持的值 |
true,false |
| 支持的操作 |
==,!= |
|
destination.agent_registry.mcp_server.tool.annotations.destructive_hint
|
| 值类型 |
布尔值 |
| 支持的值 |
true,false |
| 支持的操作 |
==,!= |
|
destination.agent_registry.mcp_server.tool.annotations.idempotent_hint
|
| 值类型 |
布尔值 |
| 支持的值 |
true,false |
| 支持的操作 |
==,!= |
|
destination.agent_registry.mcp_server.tool.annotations.open_world_hint
|
| 值类型 |
布尔值 |
| 支持的值 |
true,false |
| 支持的操作 |
==,!= |
|
destination.agent_registry.mcp_server.prompt.name |
| 值类型 |
字符串 |
| 支持的值 |
提示名称 |
| 支持的操作 |
==、!=、in
|
|
destination.agent_registry.mcp_server.resource.name |
| 值类型 |
字符串 |
| 支持的值 |
资源名称 |
| 支持的操作 |
==、!=、in
|
|
端点 |
destination.agent_registry.endpoint.name |
| 值类型 |
字符串 |
| 支持的值 |
端点资源名称
(projects/PROJECT_ID/locations/LOCATION/endpoints/ENDPOINT_NAME)
|
| 支持的操作 |
==、!=、in
|
|
未注册的目标 |
destination.unregistered.host |
| 值类型 |
字符串 |
| 支持的值 |
主机名(例如,'google.com'、'example.com')
|
| 支持的操作 |
==、!=、in、.startsWith()、.endsWith()、.contains()
|
|
destination.unregistered.path |
| 值类型 |
字符串 |
| 支持的值 |
请求路径(例如 '/admin'、'/api/v1')
|
| 支持的操作 |
==、!=、in、.startsWith()、.endsWith()、.contains()
|
|
destination.unregistered.method |
| 值类型 |
字符串 |
| 支持的值 |
HTTP 方法(例如,'get'、'post'、'put'、'delete')
|
| 支持的操作 |
==、!=、in
|
|
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-10-15。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2026-10-15。"],[],[]]