pub struct RegisterCommandController { /* private fields */ }Expand description
Presentation layer controller for register command workflow
Coordinates user interaction, progress reporting, and input validation
before delegating to the application layer RegisterCommandHandler.
§Responsibilities
- Validate user input (environment name format, IP address 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
RegisterCommandHandler, maintaining clear separation of concerns.
Implementations§
Source§impl RegisterCommandController
impl RegisterCommandController
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 register command controller
Sourcepub async fn execute(
&mut self,
environment_name: &str,
instance_ip_str: &str,
ssh_port: Option<u16>,
output_format: OutputFormat,
) -> Result<Environment<Provisioned>, RegisterSubcommandError>
pub async fn execute( &mut self, environment_name: &str, instance_ip_str: &str, ssh_port: Option<u16>, output_format: OutputFormat, ) -> Result<Environment<Provisioned>, RegisterSubcommandError>
Execute the complete register workflow
Orchestrates all steps of the register command:
- Validate environment name
- Parse and validate IP address
- Create command handler
- Register the instance
- Complete with success message
§Arguments
environment_name- The name of the environment to register the instance withinstance_ip_str- The IP address string of the existing instancessh_port- Optional SSH port (overrides environment config if provided)output_format- Output format (text or JSON)
§Errors
Returns an error if:
- Environment name is invalid
- IP address format is invalid
- Environment is not found or not in Created state
- SSH connectivity validation fails
Auto Trait Implementations§
impl Freeze for RegisterCommandController
impl !RefUnwindSafe for RegisterCommandController
impl Send for RegisterCommandController
impl Sync for RegisterCommandController
impl Unpin for RegisterCommandController
impl UnsafeUnpin for RegisterCommandController
impl !UnwindSafe for RegisterCommandController
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