Loading...
Loading...
Vetted, compilable Rust templates for common Omni Gateway Policy Development Kit (PDK) features — JWT validation/generation, OAuth2 introspection, header/body manipulation, body streaming, rate limiting, spike control, CORS, IP filtering, JSON/XML validators, HTTP outbound calls, gRPC, DataWeave evaluation, caching, distributed locks, worker variables, request data, control flow, contracts, data storage, timers, logging, metadata, policy violations, stop_iteration, outbound policies, and PDK unit testing. Use whenever the user asks "how do I X in PDK?", "show me a PDK template for Y", "PDK Rust snippet for Z", "JWT template", "rate limit template", "header manipulation example", "PDK gRPC", "PDK DataWeave", or any prompt mapping to one of the 30 template files under templates/. Read the matching file and adapt it into the user's `src/lib.rs` (and companion files for multi-file features). For project scaffolding, build, and publish lifecycle, defer to `develop-pdk-policy`.
npx skill4agent add mulesoft/mulesoft-dx pdk-templatestemplates/rate_limitingheader_manipulationpdk-prerequisitesdevelop-pdk-policyanypoint-cli-v4 pdk policy-project createmake setupmake buildmake runmake publishmake releasesrc/tests/UnitTestBuilderpdk-unitpdk-unittemplates/unit_testing.mdmulesoft-mcp-serverlib.rsrequest_filterresponse_filterconfigureConfiggcl.yamlexampleServiceexampleDateweavePropertyexample-hmac-secret-with-256-bits-longdataweavehttp_callgrpcdefinition/gcl.yamlproperties:header_manipulationbody_manipulationbody_streamdataweavehttp_callgrpccorsrequest_filterresponse_filter.on_response(...).on_request(...)lib.rsgcl.yamlmake build-asset-filesgcl.yamlsrc/generated/config.rsmake build| Feature | Template | Summary |
|---|---|---|
| | Read, set, add, remove, and bulk-replace request and response headers. |
| | Read and replace request/response bodies. |
| | Stream request/response bodies in chunks. |
| | Read method, scheme, host, path, query, and authority from a request. |
| | Short-circuit a request with a synthetic response ( |
| Feature | Template | Summary |
|---|---|---|
| | Read and set the request's resolved authentication principal. |
| | Validate a JWT signature and extract claims/headers. |
| | Mint a new signed JWT from claims. |
| | Introspect an OAuth2 access token (RFC 7662). |
| | Allow/deny by client IP / CIDR. |
| | Validate Anypoint API contracts ( |
| Feature | Template | Summary |
|---|---|---|
| | Outbound HTTP requests against a configured |
| | Outbound gRPC against a |
| | Evaluate a DataWeave expression against |
| | Marker |
| Feature | Template | Summary |
|---|---|---|
| | Validate a JSON body against a JSON Schema. |
| | Validate an XML body against an XSD. |
| Feature | Template | Summary |
|---|---|---|
| | Token-bucket rate limiter with quota windows. |
| | Spike arrest with queueing. |
| | Per-policy in-memory cache for response or computed values. |
| | Distributed advisory lock for a critical section. |
| Feature | Template | Summary |
|---|---|---|
| | Emit structured logs at |
| | Read policy/runtime metadata (org, env, API instance, gateway). |
| | Emit a structured policy-violation event for analytics. |
| | Schedule a timer callback after N milliseconds. |
| Feature | Template | Summary |
|---|---|---|
| | Persistent KV store shared across workers. |
| | Per-worker variable (no cross-worker sharing). |
| Feature | Template | Summary |
|---|---|---|
| | Handle CORS preflight and response headers. |
| | Mutate body and headers in a single state transition (multi-file: |
| | |
src/lib.rsdataweave/templates/dataweave/lib.rssrc/lib.rsgcl.yamlproperties.exampleDateweavePropertyformat: dataweavebindingsdefinition/gcl.yamlconfig.example_dateweave_property.evaluator()Configmake build-asset-fileshttp_call/templates/http_call/lib.rssrc/lib.rsgcl.yamlproperties.serviceformat: servicedefinition/gcl.yamlserviceclient.request(&config.service)make build-asset-filesstop_iteration/templates/stop_iteration/lib.rssrc/lib.rsCargo.toml.snippetCargo.tomlpdk>= 1.8.0features = ["enable_stop_iteration"]develop-pdk-policygrpc/templates/grpc/lib.rssrc/lib.rsgcl.yamlproperties.exampleServiceformat: servicedefinition/gcl.yamlbuild.rsbuild.rsproto/example.protoproto/example.protoproto/example.protoExampleServiceCargo.toml.snippet[dependencies]protobuf = "3.5.0"[build-dependencies]protobuf-codegen = "3.5.0"make build-asset-filesmake buildproto/example.protoproto/user.protoUserService.protobuild.rs.input("proto/<name>.proto")lib.rsuse crate::<name>::{...};protobuf-codegen.protooutbound/templates/outbound/gcl.yamlgcl.yamldefinition/gcl.yamlmetadata/capabilities/injectionPoint: outboundheader_manipulationhttp_calldevelop-pdk-policy