代表一般運算語言 (CEL) 語法的文字運算式。CEL 是一種類似 C 的運算式語言。如要瞭解 CEL 的語法和語意,請參閱 https://github.com/google/cel-spec。
範例 (比較):
title: "Summary size limit"
description: "Determines if a summary is less than 100 chars"
expression: "document.summary.size() < 100"
範例 (相等):
title: "Requestor is owner"
description: "Determines if requestor is the document owner"
expression: "document.owner == request.auth.claims.email"
範例 (邏輯):
title: "Public documents"
description: "Determine whether the document should be publicly visible"
expression: "document.type != 'private' && document.type != 'internal'"
範例 (資料操控):
title: "Notification string"
description: "Create a notification string with a timestamp."
expression: "'New message received at ' + string(document.create_time)"
運算式中可參照的確切變數和函式,取決於評估運算式的服務。詳情請參閱服務說明文件。
| JSON 表示法 | 
|---|
| { "expression": string, "title": string, "description": string, "location": string } | 
| 欄位 | |
|---|---|
| expression | 
 使用一般運算語言語法的運算式文字表示法。 | 
| title | 
 (選用步驟) 運算式的標題,即描述其用途的簡短字串。這可用在允許輸入運算式的 UI 中。 | 
| description | 
 選填。運算式的說明。這是一段較長的文字,用於描述運算式。舉例來說,使用者在 UI 中將游標懸停在運算式上方時,即可顯示說明文字。 | 
| location | 
 (選用步驟) 指出要提報錯誤的運算式所在位置,例如檔案名稱及檔案內的位置。 |