kw service
Reserved keyword
The list of words: §1.4
Syntax
Service = [ "extern" ] "service" Ident "{" { { Attr } RpcSig } "}" ;Grammar: App. A
Defined in
- 10.1 Services — A service declares a contract
- 2.4 Entry points and start-up order — A program is a package that contains at least one of
- 3.4 Declared types — data — a product type with named fields (§4.2).
- 9.2 Field numbers and schema — Every field of a data and every variant of an enum has a stable tag (the number in the wire format).
- 13.2 Authentication — Providers are set in cluster { auth { …
- 13.4 Authorisation and policies — The subject of a policy
- 1.4 Keywords — Reserved (cannot be used as names)
- 16.3 gRPC and protobuf — import proto "payments.proto" generates an extern service and types; calls are as to ordinary services through connect.
Examples
policy Orders {
allow get(id) if caller.isUser(db.find(Order, id)?.userId)
allow list, recent if caller.has(role: .Support)
allow * if caller.service("billing")
deny delete unless caller.has(role: .Admin) && caller is .User(mfa: true, ..)
}
@public rpc health() -> Ok
@allow(role: .Admin) rpc purge() -> Ok
@internal rpc create(…) -> Order— 13.4 Authorisation and policies
Related diagnostics
duplicate-impl, impl-signature-mismatch, missing-impl, missing-rpc-impl, unknown-rpc, bad-main, no-entry-point, unknown-type, schema-attr, schema-break, cluster-auth, data-rights, missing-policy, unknown-policy-target