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

后续步骤

窗口概览

Agent Gateway 概览。

指南

了解如何配置内容政策和商家政策。

指南

了解如何测试政策。