Crate bulwark_wasm_sdk
source ·Expand description
This crate provides the logic for Bulwark’s guest environment.
Macros
- Construct a
serde_json::Value
from a JSON literal.
Structs
- The first chunk of an HTTP body.
- A
Decision
represents evidence in favor of either accepting or restricting an operation under consideration. - A type map of protocol extensions.
- Represents a JSON key/value type.
- The Request Method (VERB)
- An HTTP status code (
status-code
in RFC 7230 et al.). - The URI component of a request.
- Represents a version of the HTTP spec.
Enums
- The number of successes or failures to increment the breaker by.
- Returned when there is an issue with the environment variable requested by the plugin.
- Returned when there is an issue with an http request sent by the plugin.
- Represents a value from a continuous range taken from the
pignistic
transformation as a category that can be used to select a response to an operation. - Returned when there was an issue getting or setting a parameter.
- Returned when an attempt to parse a counter within a plugin environment fails.
- Returned when there is an issue with the remote state requested by the plugin.
- Returned when a threshold is either out-of-order or out-of-range.
- Represents any valid JSON value.
Constants
- A decision representing acceptance with full certainty.
- An empty HTTP body
- A decision representing restriction with full certainty.
- An unavailable HTTP body
- A decision representing full uncertainty.
Functions
- Records additional tags the plugin wants to associate with its decision.
- Checks a circuit breaker, returning the generation count, success count, failure count, consecutive success count, consecutive failure count, and expiration time.
- Checks a rate limit, returning the number of attempts so far and the expiration time.
- Returns the originating client’s IP address, if available.
- Returns the combined decision, if available.
- Returns the combined set of tags associated with a decision, if available.
- Returns the guest environment’s configuration value as a JSON
Value
. - Returns a named guest environment configuration value as a JSON
Value
. - Returns a named environment variable value as a
String
. - Returns a named environment variable value as bytes.
- Returns the outcome of the combined decision, if available.
- Returns a named value from the request context’s params.
- Returns the named state value retrieved from Redis.
- Returns the incoming request.
- Returns the response received from the interior service.
- Increments a circuit breaker, returning the generation count, success count, failure count, consecutive success count, consecutive failure count, and expiration time.
- Increments a rate limit, returning the number of attempts so far and the expiration time.
- Increments a named counter in Redis.
- Increments a named counter in Redis by a specified delta value.
- Parses a counter value from state stored as a string.
- Determines whether the
on_request_body_decision
handler will be called with a request body or not. - Determines whether the
on_response_body_decision
handler will be called with a response body or not. - Sends an outbound HTTP request.
- Records a decision indicating that the plugin wants to accept a request.
- Records the decision value the plugin wants to return.
- Set a named value in the request context’s params.
- Set a named value in Redis.
- Sets an expiration on a named value in Redis.
- Records a decision indicating that the plugin wants to restrict a request.
- Records the tags the plugin wants to associate with its decision.
Type Aliases
- A
Breaker
contains the values needed to implement a circuit-breaker pattern within a plugin. - Generic error
- A
Rate
contains the values needed to implement a rate-limiter pattern within a plugin. - An HTTP response combines a head consisting of a
StatusCode
and headers with aBodyChunk
, which provides access to the first chunk of a response body. - Generic result
Attribute Macros
- The
bulwark_plugin
attribute generates default implementations for all handler traits in a module and produces friendly errors for common mistakes.