pub struct NetworkCreate { /* private fields */ }Expand description
Create a network.
§Examples
use ironflow_ops_docker::networks::NetworkCreate;
use ironflow_ops_docker::DockerClient;
use ironflow_core::operation::Operation;
let client = DockerClient::connect_local().unwrap();
let op = NetworkCreate::new(&client, "my-network");
assert_eq!(op.kind(), "docker");Implementations§
Source§impl NetworkCreate
impl NetworkCreate
Sourcepub fn new(client: impl Into<DockerRef>, name: impl Into<String>) -> Self
pub fn new(client: impl Into<DockerRef>, name: impl Into<String>) -> Self
Create a new network-create operation.
Sourcepub fn driver(self, driver: impl Into<String>) -> Self
pub fn driver(self, driver: impl Into<String>) -> Self
Set the network driver (defaults to “bridge”).
Sourcepub async fn run(
&self,
_ctx: &OperationContext,
) -> Result<NetworkCreateOutput, OperationError>
pub async fn run( &self, _ctx: &OperationContext, ) -> Result<NetworkCreateOutput, OperationError>
Execute and return a typed result.
§Errors
Returns OperationError::External if the network cannot be created.
Trait Implementations§
Source§impl Operation for NetworkCreate
impl Operation for NetworkCreate
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 NetworkCreate
impl TypedOperation for NetworkCreate
Source§type Output = NetworkCreateOutput
type Output = NetworkCreateOutput
The concrete output type that
Operation::execute produces.Auto Trait Implementations§
impl !RefUnwindSafe for NetworkCreate
impl !UnwindSafe for NetworkCreate
impl Freeze for NetworkCreate
impl Send for NetworkCreate
impl Sync for NetworkCreate
impl Unpin for NetworkCreate
impl UnsafeUnpin for NetworkCreate
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