IAM 統一存取政策的 CEL 屬性

本文說明在 Agent Gateway 的 IAM 統一存取政策 (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。

指南

瞭解如何設定內容和商家政策。

指南

瞭解如何測試政策。