pub struct ProvisionCommandController { /* private fields */ }Expand description
Presentation layer controller for provision command workflow
Coordinates user interaction, progress reporting, and input validation
before delegating to the application layer ProvisionCommandHandler.
§Responsibilities
- Validate user input (environment name format)
- Show progress updates to the user
- Format success/error messages for display
- Delegate business logic to application layer
§Architecture
This controller sits in the presentation layer and handles all user-facing
concerns. It delegates actual business logic to the application layer’s
ProvisionCommandHandler, maintaining clear separation of concerns.
Implementations§
Source§impl ProvisionCommandController
impl ProvisionCommandController
Sourcepub fn new(
repository: Arc<dyn EnvironmentRepository + Send + Sync>,
clock: Arc<dyn Clock>,
user_output: Arc<ReentrantMutex<RefCell<UserOutput>>>,
) -> Self
pub fn new( repository: Arc<dyn EnvironmentRepository + Send + Sync>, clock: Arc<dyn Clock>, user_output: Arc<ReentrantMutex<RefCell<UserOutput>>>, ) -> Self
Create a new provision command controller
Creates a ProvisionCommandController with direct service injection.
This follows the single container architecture pattern.
Sourcepub async fn execute(
&mut self,
environment_name: &str,
output_format: OutputFormat,
) -> Result<Environment<Provisioned>, ProvisionSubcommandError>
pub async fn execute( &mut self, environment_name: &str, output_format: OutputFormat, ) -> Result<Environment<Provisioned>, ProvisionSubcommandError>
Execute the complete provision workflow
Orchestrates all steps of the provision command:
- Validate environment name
- Load and validate environment state
- Create command handler
- Provision infrastructure
- Complete with success message
- Display provision results (connection details + DNS reminder)
§Arguments
environment_name- The name of the environment to provisionoutput_format- Output format for results (Text or Json)
§Errors
Returns an error if:
- Environment name is invalid (format validation fails)
- Environment cannot be loaded from repository
- Environment is not in “Created” state
- Infrastructure provisioning fails
- Progress reporting encounters a poisoned mutex
§Returns
Returns Ok(Environment<Provisioned>) on success, or a ProvisionSubcommandError if any step fails.
Auto Trait Implementations§
impl !RefUnwindSafe for ProvisionCommandController
impl !UnwindSafe for ProvisionCommandController
impl Freeze for ProvisionCommandController
impl Send for ProvisionCommandController
impl Sync for ProvisionCommandController
impl Unpin for ProvisionCommandController
impl UnsafeUnpin for ProvisionCommandController
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request