8 releases (2 stable)
1.0.1 | Jun 20, 2024 |
---|---|
1.0.0 | Jun 19, 2024 |
0.0.6 | Jun 19, 2024 |
0.0.1 | Apr 29, 2024 |
#359 in WebAssembly
317 downloads per month
41KB
996 lines
Otoroshi Types for writing Wasm plugin using Rust
mod main;
use extism_pdk::*;
use otoroshi_rust_types::*;
#[plugin_fn]
pub fn execute(Json(_context): Json<WasmAccessValidatorContext>) -> FnResult<Json<WasmAccessValidatorResponse>> {
let out = WasmAccessValidatorResponse {
result: false,
error: Some(WasmAccessValidatorError {
message: "you're not authorized".to_owned(),
status: 401
})
};
Ok(Json(out))
}
/*
// WasmRouteMatcher
#[plugin_fn]
pub fn matches_route(Json(_context): Json<WasmMatchRouteContext>) -> FnResult<Json<WasmMatchRouteResponse>> {
///
}
// -------------------------
// WasmPreRoute
#[plugin_fn]
pub fn pre_route(Json(_context): Json<WasmPreRouteContext>) -> FnResult<Json<WasmPreRouteResponse>> {
///
}
// -------------------------
// WasmAccessValidator
#[plugin_fn]
pub fn can_access(Json(_context): Json<WasmAccessValidatorContext>) -> FnResult<Json<WasmAccessValidatorResponse>> {
///
}
// -------------------------
// WasmRequestTransformer
#[plugin_fn]
pub fn transform_request(Json(_context): Json<WasmRequestTransformerContext>) -> FnResult<Json<WasmTransformerResponse>> {
///
}
// -------------------------
// WasmBackend
#[plugin_fn]
pub fn call_backend(Json(_context): Json<WasmQueryContext>) -> FnResult<Json<WasmQueryResponse>> {
///
}
// -------------------------
// WasmResponseTransformer
#[plugin_fn]
pub fn transform_response(Json(_context): Json<WasmResponseTransformerContext>) -> FnResult<Json<WasmTransformerResponse>> {
///
}
// -------------------------
// WasmSink
#[plugin_fn]
pub fn sink_matches(Json(_context): Json<WasmSinkContext>) -> FnResult<Json<WasmSinkMatchesResponse>> {
///
}
#[plugin_fn]
pub fn sink_handle(Json(_context): Json<WasmSinkContext>) -> FnResult<Json<WasmSinkHandleResponse>> {
///
}
// -------------------------
// WasmRequestHandler
#[plugin_fn]
pub fn handle_request(Json(_context): Json<WasmRequestHandlerContext>) -> FnResult<Json<WasmRequestHandlerResponse>> {
///
}
// -------------------------
// WasmJob
#[plugin_fn]
pub fn job_run(Json(_context): Json<WasmJobContext>) -> FnResult<Json<WasmJobResult>> {
///
}
*/
Dependencies
~2.8–4MB
~72K SLoC