Expand description
This crate provides the logic for Bulwark’s guest environment.
Macros§
- value
- Construct a
serde_json::Value
from a JSON literal.
Structs§
- Body
Chunk - The first chunk of an HTTP body.
- Decision
- A
Decision
represents evidence in favor of either accepting or restricting an operation under consideration. - Extensions
- A type map of protocol extensions.
- Map
- Represents a JSON key/value type.
- Method
- The Request Method (VERB)
- Status
Code - An HTTP status code (
status-code
in RFC 7230 et al.). - Uri
- The URI component of a request.
- Version
- Represents a version of the HTTP spec.
Enums§
- Breaker
Delta - The number of successes or failures to increment the breaker by.
- EnvVar
Error - Returned when there is an issue with the environment variable requested by the plugin.
- Http
Error - Returned when there is an issue with an http request sent by the plugin.
- Outcome
- 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. - Param
Error - Returned when there was an issue getting or setting a parameter.
- Parse
Counter Error - Returned when an attempt to parse a counter within a plugin environment fails.
- Remote
State Error - Returned when there is an issue with the remote state requested by the plugin.
- Threshold
Error - Returned when a threshold is either out-of-order or out-of-range.
- Value
- Represents any valid JSON value.
Constants§
- ACCEPT
- A decision representing acceptance with full certainty.
- NO_BODY
- An empty HTTP body
- RESTRICT
- A decision representing restriction with full certainty.
- UNAVAILABLE_
BODY - An unavailable HTTP body
- UNKNOWN
- A decision representing full uncertainty.
Functions§
- append_
tags - Records additional tags the plugin wants to associate with its decision.
- check_
breaker - Checks a circuit breaker, returning the generation count, success count, failure count, consecutive success count, consecutive failure count, and expiration time.
- check_
rate_ limit - Checks a rate limit, returning the number of attempts so far and the expiration time.
- get_
client_ ip - Returns the originating client’s IP address, if available.
- get_
combined_ decision - Returns the combined decision, if available.
- get_
combined_ tags - Returns the combined set of tags associated with a decision, if available.
- get_
config - Returns the guest environment’s configuration value as a JSON
Value
. - get_
config_ value - Returns a named guest environment configuration value as a JSON
Value
. - get_env
- Returns a named environment variable value as a
String
. - get_
env_ bytes - Returns a named environment variable value as bytes.
- get_
outcome - Returns the outcome of the combined decision, if available.
- get_
param_ value - Returns a named value from the request context’s params.
- get_
remote_ state - Returns the named state value retrieved from Redis.
- get_
request - Returns the incoming request.
- get_
response - Returns the response received from the interior service.
- increment_
breaker - Increments a circuit breaker, returning the generation count, success count, failure count, consecutive success count, consecutive failure count, and expiration time.
- increment_
rate_ limit - Increments a rate limit, returning the number of attempts so far and the expiration time.
- increment_
remote_ state - Increments a named counter in Redis.
- increment_
remote_ state_ by - Increments a named counter in Redis by a specified delta value.
- parse_
counter - Parses a counter value from state stored as a string.
- receive_
request_ body - Determines whether the
on_request_body_decision
handler will be called with a request body or not. - receive_
response_ body - Determines whether the
on_response_body_decision
handler will be called with a response body or not. - send_
request - Sends an outbound HTTP request.
- set_
accepted - Records a decision indicating that the plugin wants to accept a request.
- set_
decision - Records the decision value the plugin wants to return.
- set_
param_ value - Set a named value in the request context’s params.
- set_
remote_ state - Set a named value in Redis.
- set_
remote_ ttl - Sets an expiration on a named value in Redis.
- set_
restricted - Records a decision indicating that the plugin wants to restrict a request.
- set_
tags - Records the tags the plugin wants to associate with its decision.
Type Aliases§
- Breaker
- A
Breaker
contains the values needed to implement a circuit-breaker pattern within a plugin. - Error
- Generic error
- Rate
- A
Rate
contains the values needed to implement a rate-limiter pattern within a plugin. - Request
- An HTTP request combines a head consisting of a
Method
,Uri
, and headers with aBodyChunk
, which provides access to the first chunk of a request body. - Response
- 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. - Result
- Generic result
Attribute Macros§
- bulwark_
plugin - The
bulwark_plugin
attribute generates default implementations for all handler traits in a module and produces friendly errors for common mistakes.