Google 會運用 AI 技術將內容翻譯成你偏好的語言,但可能會出錯。
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 |
|
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間: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"]],["上次更新時間:2026-10-15 (世界標準時間)。"],[],[]]