pub struct ConfigureCommandHandler { /* private fields */ }Expand description
ConfigureCommandHandler orchestrates the complete infrastructure configuration workflow
The ConfigureCommandHandler orchestrates the complete infrastructure configuration workflow.
This command handles all steps required to configure infrastructure:
- Install Docker
- Install Docker Compose
- Configure automatic security updates
- Configure UFW firewall
§State Management
The command integrates with the type-state pattern for environment lifecycle:
- Accepts
Environment<Provisioned>as input - Transitions to
Environment<Configuring>at start - Returns
Environment<Configured>on success - Transitions to
Environment<ConfigureFailed>on error
State is persisted after each transition using the injected repository. Persistence failures are logged but don’t fail the command (state remains valid in memory).
Implementations§
Source§impl ConfigureCommandHandler
impl ConfigureCommandHandler
Sourcepub fn new(
clock: Arc<dyn Clock>,
repository: Arc<dyn EnvironmentRepository>,
) -> Self
pub fn new( clock: Arc<dyn Clock>, repository: Arc<dyn EnvironmentRepository>, ) -> Self
Create a new ConfigureCommandHandler
Sourcepub fn execute(
&self,
env_name: &EnvironmentName,
listener: Option<&dyn CommandProgressListener>,
) -> Result<Environment<Configured>, ConfigureCommandHandlerError>
pub fn execute( &self, env_name: &EnvironmentName, listener: Option<&dyn CommandProgressListener>, ) -> Result<Environment<Configured>, ConfigureCommandHandlerError>
Execute the complete configuration workflow
§Arguments
env_name- The name of the environment to configurelistener- Optional progress listener for reporting step-level progress. When provided, the handler reports progress at each of the 4 configuration steps. WhenNone, the handler executes silently (backward compatible).
§Returns
Returns the configured environment
§Errors
Returns an error if any step in the configuration workflow fails:
- Environment not found or not in
Provisionedstate - Docker installation fails
- Docker Compose installation fails
- Security updates configuration fails
- Firewall configuration fails
On error, the environment transitions to ConfigureFailed state and is persisted.
Auto Trait Implementations§
impl !RefUnwindSafe for ConfigureCommandHandler
impl !Send for ConfigureCommandHandler
impl !Sync for ConfigureCommandHandler
impl !UnwindSafe for ConfigureCommandHandler
impl Freeze for ConfigureCommandHandler
impl Unpin for ConfigureCommandHandler
impl UnsafeUnpin for ConfigureCommandHandler
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
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> ⓘ
Converts
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> ⓘ
Converts
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>
Wrap the input message
T in a tonic::Request