policies
Execute stored policies and flows over REST or gRPC using API keys only.
This SDK mirrors the narrow scope of the TypeScript package:
- execute policies
- execute flows
- authenticate with
x-api-key - choose REST or gRPC transport
It does not support creating, updating, publishing, or administering resources.
Install
[]
= "0.1"
= "1"
= { = "1", = ["macros", "rt-multi-thread"] }
Reference::Base is the default. Use Reference::Version only when you want to execute a specific version ID.
Usage
use ;
use json;
async
Examples
Call init_bugfixes()? during startup to enable Bugfixes logging and the panic hook for the process.
If unset, the SDK defaults REST execution to https://api.policy2.net/run and gRPC execution to shuttle.proxy.rlwy.net:27179. REST requests append /policy... or /flow... automatically based on the operation. Set transport.base_url or transport.address to override them.
Execution reference rules:
-
Base policy:
reference: Reference::Base -
Base flow:
reference: Reference::Base -
Versioned policy:
reference: Reference::Version -
Versioned flow:
reference: Reference::Version -
If a caller uses
Reference::default(), it resolves toReference::Base -
REST policy execution:
examples/policy_rest.rs -
REST flow execution:
examples/flow_rest.rs -
RPC policy execution:
examples/policy_rpc.rs -
RPC flow execution:
examples/flow_rpc.rs