pub struct EnvironmentParams {
pub environment_name: EnvironmentName,
pub instance_name: InstanceName,
pub provider_config: ProviderConfig,
pub ssh_credentials: SshCredentials,
pub ssh_port: u16,
pub tracker_config: TrackerConfig,
pub prometheus_config: Option<PrometheusConfig>,
pub grafana_config: Option<GrafanaConfig>,
pub https_config: Option<HttpsConfig>,
pub backup_config: Option<BackupConfig>,
}Expand description
Parameters for creating a new Environment aggregate
This value object contains all validated domain objects needed to construct
an Environment<Created> aggregate. It serves as a “factory input” pattern,
grouping related parameters into a single, self-documenting type.
§Field Categories
- Identity:
environment_name,instance_name - Infrastructure:
provider_config,ssh_credentials,ssh_port - Application:
tracker_config - Observability:
prometheus_config,grafana_config - Security:
https_config
§Invariants
All fields are pre-validated domain types. Cross-field validation
(e.g., Grafana requires Prometheus) happens in Environment::create().
Fields§
§environment_name: EnvironmentNameValidated environment name (e.g., “production”, “staging”)
instance_name: InstanceNameValidated instance name for the VM/container
Either user-provided or auto-generated as torrust-tracker-vm-{env_name}
provider_config: ProviderConfigProvider-specific configuration (LXD, Hetzner, etc.)
ssh_credentials: SshCredentialsSSH credentials for remote access to the deployed instance
ssh_port: u16SSH port for remote connections (typically 22)
tracker_config: TrackerConfigTracker application configuration
prometheus_config: Option<PrometheusConfig>Optional Prometheus monitoring configuration
grafana_config: Option<GrafanaConfig>Optional Grafana dashboard configuration
Note: Requires prometheus_config to be set (validated in Environment::create())
https_config: Option<HttpsConfig>Optional HTTPS/TLS configuration for secure endpoints
backup_config: Option<BackupConfig>Optional backup service configuration
Implementations§
Source§impl EnvironmentParams
impl EnvironmentParams
Sourcepub fn new(
environment_name: EnvironmentName,
instance_name: InstanceName,
provider_config: ProviderConfig,
ssh_credentials: SshCredentials,
ssh_port: u16,
tracker_config: TrackerConfig,
prometheus_config: Option<PrometheusConfig>,
grafana_config: Option<GrafanaConfig>,
https_config: Option<HttpsConfig>,
backup_config: Option<BackupConfig>,
) -> Self
pub fn new( environment_name: EnvironmentName, instance_name: InstanceName, provider_config: ProviderConfig, ssh_credentials: SshCredentials, ssh_port: u16, tracker_config: TrackerConfig, prometheus_config: Option<PrometheusConfig>, grafana_config: Option<GrafanaConfig>, https_config: Option<HttpsConfig>, backup_config: Option<BackupConfig>, ) -> Self
Creates a new EnvironmentParams instance
This constructor is primarily used in domain tests. In production,
EnvironmentParams is typically constructed via TryFrom conversion
from a configuration DTO in the application layer.
§Arguments
environment_name- Validated environment nameinstance_name- Validated instance nameprovider_config- Provider configurationssh_credentials- SSH access credentialsssh_port- SSH port numbertracker_config- Tracker application configurationprometheus_config- Optional Prometheus configurationgrafana_config- Optional Grafana configurationhttps_config- Optional HTTPS configurationbackup_config- Optional backup configuration
Trait Implementations§
Source§impl Clone for EnvironmentParams
impl Clone for EnvironmentParams
Source§fn clone(&self) -> EnvironmentParams
fn clone(&self) -> EnvironmentParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EnvironmentParams
impl Debug for EnvironmentParams
Source§impl TryFrom<EnvironmentCreationConfig> for EnvironmentParams
impl TryFrom<EnvironmentCreationConfig> for EnvironmentParams
Source§fn try_from(config: EnvironmentCreationConfig) -> Result<Self, Self::Error>
fn try_from(config: EnvironmentCreationConfig) -> Result<Self, Self::Error>
Converts DTO configuration to validated domain parameters
This performs all validation and type conversion from string-based DTO fields to strongly-typed domain objects.
§Validation
- Environment name must follow naming rules
- Instance name (if provided) must follow instance naming rules
- Provider config must be valid (e.g., valid profile name for LXD)
- SSH username must follow Linux username requirements
- SSH key files must exist and be accessible
- SSH key paths must be absolute
§Instance Name Auto-Generation
If instance_name is not provided in the configuration, it will be
auto-generated using the format: torrust-tracker-vm-{env_name}
§Errors
Returns CreateConfigError if any validation fails. All error variants
implement .help() with detailed troubleshooting guidance.
Source§type Error = CreateConfigError
type Error = CreateConfigError
Auto Trait Implementations§
impl Freeze for EnvironmentParams
impl RefUnwindSafe for EnvironmentParams
impl Send for EnvironmentParams
impl Sync for EnvironmentParams
impl Unpin for EnvironmentParams
impl UnsafeUnpin for EnvironmentParams
impl UnwindSafe for EnvironmentParams
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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