pub struct OperationContext { /* private fields */ }Expand description
Context provided to every Operation::execute call.
Carries a shared HTTP client and a secret resolver so that operations do not need to manage their own connections or credentials.
§Examples
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;
let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
let _client = ctx.http_client();Implementations§
Source§impl OperationContext
impl OperationContext
Sourcepub fn new(secrets: Arc<dyn SecretResolver>) -> OperationContext
pub fn new(secrets: Arc<dyn SecretResolver>) -> OperationContext
Create a new context with a default HTTP client.
§Examples
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;
let ctx = OperationContext::new(Arc::new(NoopSecretResolver));Sourcepub fn with_http_client(
http_client: Client,
secrets: Arc<dyn SecretResolver>,
) -> OperationContext
pub fn with_http_client( http_client: Client, secrets: Arc<dyn SecretResolver>, ) -> OperationContext
Create a new context with a custom HTTP client.
Use this to share a single Client across multiple operations
within the same workflow run.
§Examples
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use reqwest::Client;
use std::sync::Arc;
let client = Client::new();
let ctx = OperationContext::with_http_client(client, Arc::new(NoopSecretResolver));Sourcepub fn http_client(&self) -> &Client
pub fn http_client(&self) -> &Client
The shared HTTP client for this operation context.
Sourcepub fn secrets(&self) -> &dyn SecretResolver
pub fn secrets(&self) -> &dyn SecretResolver
The secret resolver for this operation context.
Auto Trait Implementations§
impl !RefUnwindSafe for OperationContext
impl !UnwindSafe for OperationContext
impl Freeze for OperationContext
impl Send for OperationContext
impl Sync for OperationContext
impl Unpin for OperationContext
impl UnsafeUnpin for OperationContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more