Google 会使用 AI 技术将内容翻译成您偏好的语言。AI 翻译可能包含错误。
适用于 IAM 访问权限政策的 CEL 属性
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本文档介绍了在为 Agent Gateway 编写 IAM Unified Access Policies(访问权限政策)中的条件表达式时,可以使用的通用表达式语言 (CEL) 属性和函数。
如需详细了解访问权限政策概念,请参阅
IAM 访问权限政策概览。
如需了解如何配置访问权限政策,请参阅
创建 IAM 访问权限政策。
可用的 CEL 属性
在访问权限政策中,您可以使用条件表达式定义条件。表达式可以包含多个子表达式。您在每个关系子条件中使用的目标资源类型决定了您可以使用的属性。
例如,在以下条件中,在子表达式 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-09-16。
[null,null,["最后更新时间 (UTC):2026-09-16。"],[],[]]