mirror of https://github.com/istio/istio.io.git
Add two expressions. (#1840)
This commit is contained in:
parent
6cfbccc9b5
commit
82685030a4
|
@ -38,6 +38,8 @@ CEXL supports the following functions.
|
|||
|`.matches` | Regular expression match | `"svc.*".matches(destination.service)` | Matches `destination.service` against regular expression pattern `"svc.*"`.
|
||||
|`.startsWith` | string prefix match | `destination.service.startsWith("acme")` | Checks whether `destination.service` starts with `"acme"`.
|
||||
|`.endsWith` | string postfix match | `destination.service.endsWith("acme")` | Checks whether `destination.service` ends with `"acme"`.
|
||||
|`emptyStringMap` | Create an empty string map | `request.headers` <code>|</code> `emptyStringMap()`| Use `emptyStringMap` to create an empty string map for default value of `request.headers`.
|
||||
|`conditional` | Simulate ternary operator | `conditional((context.reporter.kind` <code>|</code> `"inbound") == "outbound", "client", "server")` | Returns `"client"` if report kind is `outbound` otherwise returns `"server"`.
|
||||
|
||||
## Type checking
|
||||
|
||||
|
@ -60,6 +62,6 @@ For example, the expression `request.auth.principal == "user1"` fails evaluation
|
|||
|-----------|------------|-----------|
|
||||
|`request.size` <code>| 200</code> | **int** | `request.size` if available, otherwise 200.
|
||||
|`request.headers["X-FORWARDED-HOST"] == "myhost"`| **boolean**
|
||||
|`(request.headers["x-user-group"] == "admin") <code>||</code> (request.auth.principal == "admin")`| **boolean**| True if the user is admin or in the admin group.
|
||||
|`(request.headers["x-user-group"] == "admin")` <code>||</code> `(request.auth.principal == "admin")`| **boolean**| True if the user is admin or in the admin group.
|
||||
|`(request.auth.principal` <code>|</code> `"nobody" ) == "user1"` | **boolean** | True if `request.auth.principal` is "user1", The expression will not error out if `request.auth.principal` is missing.
|
||||
|`source.labels["app"]=="reviews" && source.labels["version"]=="v3"`| **boolean** | True if app label is reviews and version label is v3, false otherwise.
|
||||
|
|
Loading…
Reference in New Issue