pub struct Middleware {Show 22 fields
pub authz: Option<Arc<dyn Authorizer>>,
pub auth: Dispatcher,
pub auditor: Option<Arc<dyn Auditor>>,
pub activity: Option<Arc<dyn ActivityEmitter>>,
pub app_id: String,
pub default_auth_provider: String,
pub output_format: String,
pub env: String,
pub verbose: String,
pub dry_run: bool,
pub fields: String,
pub filter: String,
pub expr: String,
pub limit: i64,
pub offset: i64,
pub reason: String,
pub schema: bool,
pub timeout: Option<Duration>,
pub debug: String,
pub search: String,
pub schema_registry: SchemaRegistry,
pub human_views: HumanViewRegistry,
}Expand description
Cross-cutting command execution state and dependencies.
Middleware is intentionally a plain, cloneable struct so tests and command
handlers can inspect what will be used for a run. Application setup usually
mutates it through CliConfig hooks or ModuleContext.
Fields§
§authz: Option<Arc<dyn Authorizer>>Optional authorization provider.
auth: DispatcherAuth provider dispatcher.
auditor: Option<Arc<dyn Auditor>>Optional audit sink.
activity: Option<Arc<dyn ActivityEmitter>>Optional activity sink.
app_id: StringApplication id used in output metadata.
default_auth_provider: StringFallback auth provider for commands without an explicit provider.
output_format: StringOutput format: json, human, or toon.
env: StringSelected environment.
verbose: StringMetadata verbosity selector.
dry_run: boolWhether mutating commands should short-circuit.
fields: StringUser field projection.
filter: StringJMESPath per-item list predicate.
expr: StringJMESPath whole-result expression.
limit: i64Client-side page size.
offset: i64Client-side page offset.
reason: StringUser reason passed to authorization and audit.
schema: boolWhether schema rendering was requested.
timeout: Option<Duration>Optional command deadline.
debug: StringDebug selector, interpreted by applications.
search: StringSearch query, interpreted before command execution.
schema_registry: SchemaRegistryOutput schema registry.
human_views: HumanViewRegistryHuman output view registry.
Implementations§
Source§impl Middleware
impl Middleware
Sourcepub async fn run<F, Fut, Output>(
&self,
request: MiddlewareRequest<'_>,
command: F,
) -> Result<MiddlewareOutput>where
F: FnOnce(Option<Credential>) -> Fut + Send,
Fut: Future<Output = Result<Output>> + Send,
Output: Into<CommandResult>,
pub async fn run<F, Fut, Output>(
&self,
request: MiddlewareRequest<'_>,
command: F,
) -> Result<MiddlewareOutput>where
F: FnOnce(Option<Credential>) -> Fut + Send,
Fut: Future<Output = Result<Output>> + Send,
Output: Into<CommandResult>,
Runs the middleware chain for a command.
Trait Implementations§
Source§impl Clone for Middleware
impl Clone for Middleware
Source§fn clone(&self) -> Middleware
fn clone(&self) -> Middleware
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more