pub struct MethodTable { /* private fields */ }Expand description
Every method of a service with its policy: the one source the local allowlist and a remote
route table are both derived from. ping is never listed and always allowed.
Implementations§
Source§impl MethodTable
impl MethodTable
pub fn new() -> Self
Sourcepub fn try_method(
self,
id: impl Into<String>,
policy: MethodPolicy,
) -> Result<Self, TableError>
pub fn try_method( self, id: impl Into<String>, policy: MethodPolicy, ) -> Result<Self, TableError>
Add or replace a method, refusing a bad id or a device-reachable policy with no scope
(TableError).
Sourcepub fn method(self, id: impl Into<String>, policy: MethodPolicy) -> Self
pub fn method(self, id: impl Into<String>, policy: MethodPolicy) -> Self
try_method for a table built in code: a bad id or an unscoped
device policy is a programming error and panics at construction, never later at a call.
pub fn get(&self, id: &str) -> Option<&MethodPolicy>
pub fn ids(&self) -> impl Iterator<Item = &str>
Sourcepub fn allowlist(&self) -> Allowlist
pub fn allowlist(&self) -> Allowlist
The local allowlist this table implies: each local-reachable method, per app. A "*"
app entry stays "*" and, as in Allowlist, applies only to apps with no entry of
their own.
Whether a device may call method through POST /v1/call/{method}: only a method
reachable on both transports, by a device holding one of its scopes. Anything else,
including an unknown method, is forbidden, so a device cannot probe which ids exist.
Whether caller may call method. ping is always allowed. A local app is refused with
request_not_allowed; a device lacking scope with forbidden.