cel.yaml 2.7 KB

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