pub struct ContainerExec { /* private fields */ }Expand description
Execute a command inside a running container.
§Examples
use ironflow_ops_docker::containers::ContainerExec;
use ironflow_ops_docker::DockerClient;
use ironflow_core::operation::Operation;
let client = DockerClient::connect_local().unwrap();
let op = ContainerExec::new(&client, "my-container", vec!["echo", "hello"]);
assert_eq!(op.kind(), "docker");Implementations§
Source§impl ContainerExec
impl ContainerExec
Sourcepub fn new(
client: impl Into<DockerRef>,
container: impl Into<String>,
cmd: Vec<impl Into<String>>,
) -> Self
pub fn new( client: impl Into<DockerRef>, container: impl Into<String>, cmd: Vec<impl Into<String>>, ) -> Self
Create a new container-exec operation.
Sourcepub async fn run(
&self,
_ctx: &OperationContext,
) -> Result<ContainerExecOutput, OperationError>
pub async fn run( &self, _ctx: &OperationContext, ) -> Result<ContainerExecOutput, OperationError>
Execute and return a typed result.
§Errors
Returns OperationError::External if the container does not exist or
the command fails.
Trait Implementations§
Source§impl Operation for ContainerExec
impl Operation for ContainerExec
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the operation and return the result as JSON. Read more
Source§impl TypedOperation for ContainerExec
impl TypedOperation for ContainerExec
Source§type Output = ContainerExecOutput
type Output = ContainerExecOutput
The concrete output type that
Operation::execute produces.Auto Trait Implementations§
impl !RefUnwindSafe for ContainerExec
impl !UnwindSafe for ContainerExec
impl Freeze for ContainerExec
impl Send for ContainerExec
impl Sync for ContainerExec
impl Unpin for ContainerExec
impl UnsafeUnpin for ContainerExec
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