1type: google.api.Service 2config_version: 3 3name: cel.googleapis.com 4title: Common Expression Language 5 6apis: 7- name: google.api.expr.v1alpha1.ConformanceService 8- name: google.api.expr.v1alpha1.CelService 9 10documentation: 11 summary: Defines common types for the Common Expression Language. 12 overview: |- 13 # Common Expression Language 14 15 The Common Expression Language (CEL) implements common semantics for 16 expression evaluation, enabling different applications to more easily 17 interoperate. 18 19 Key Applications 20 21 * Security policy: organization have complex infrastructure and need 22 common tooling to reason about the system as a whole * Protocols: 23 expressions are a useful data type and require interoperability across 24 programming languages and platforms. 25 26 27 28 Guiding philosophy: 29 30 1. Keep it small & fast. * CEL evaluates in linear time, is mutation 31 free, and not Turing-complete. This limitation is a feature of the language 32 design, which allows the implementation to evaluate orders of magnitude 33 faster than equivalently sandboxed JavaScript. 2. Make it extensible. * 34 CEL is designed to be embedded in applications, and allows for extensibility 35 via its context which allows for functions and data to be provided by the 36 software that embeds it. 3. Developer-friendly * The language is 37 approachable to developers. The initial spec was based on the experience of 38 developing Firebase Rules and usability testing many prior iterations. * 39 The library itself and accompanying toolings should be easy to adopt by 40 teams that seek to integrate CEL into their platforms. 41 42 The required components of a system that supports CEL are: 43 44 * The textual representation of an expression as written by a developer. 45 It is of similar syntax of expressions in C/C++/Java/JavaScript * A binary 46 representation of an expression. It is an abstract syntax tree (AST). * A 47 compiler library that converts the textual representation to the binary 48 representation. This can be done ahead of time (in the control plane) or 49 just before evaluation (in the data plane). * A context containing one or 50 more typed variables, often protobuf messages. Most use-case will use 51 attribute_context.proto * An evaluator library that takes the binary 52 format in the context and produces a result, usually a Boolean. 53 54 Example of boolean conditions and object construction: 55 56 ``` c // Condition account.balance >= transaction.withdrawal || 57 (account.overdraftProtection && account.overdraftLimit >= 58 transaction.withdrawal - account.balance) 59 60 // Object construction common.GeoPoint{ latitude: 10.0, longitude: -5.5 } 61 ``` 62