Skip to main content

VpsRecord

Struct VpsRecord 

Source
pub struct VpsRecord {
Show 22 fields pub name: VpsName, pub host: SshHost, pub port: SshPort, pub username: SshUser, pub password: SecretString, pub key_path: Option<KeyPath>, pub key_passphrase: Option<SecretString>, pub use_agent: bool, pub agent_socket: Option<String>, pub timeout_ms: TimeoutMs, pub max_command_chars: CharLimit, pub max_output_chars: CharLimit, pub sudo_password: Option<SecretString>, pub su_password: Option<SecretString>, pub disable_sudo: bool, pub schema_version: u32, pub added_at: Rfc3339Utc, pub tags: Vec<HostTag>, pub tls: bool, pub tls_sni: Option<String>, pub tls_client_cert: Option<String>, pub tls_client_key: Option<String>,
}
Expand description

VPS host record in the configuration file.

Wire format (serialize): English field names. Legacy Portuguese keys remain readable via serde(alias = …).

Field types are domain newtypes — invalid host/port/user/name cannot be constructed after a successful deserialize or Self::try_new.

Fields§

§name: VpsName

Logical unique VPS name.

§host: SshHost

Server hostname or IP.

§port: SshPort

SSH port.

§username: SshUser

SSH username.

§password: SecretString

SSH password (empty when key-only auth).

§key_path: Option<KeyPath>

Absolute or expandable OpenSSH private key path.

§key_passphrase: Option<SecretString>

Private key passphrase (optional).

§use_agent: bool

Use ssh-agent for publickey auth (G-SSH-04). Socket from agent_socket / CLI.

§agent_socket: Option<String>

Agent Unix socket or Windows named pipe path (XDG; never env-as-store).

§timeout_ms: TimeoutMs

Timeout in milliseconds.

§max_command_chars: CharLimit

Command character limit (input). 0 = unlimited at runtime.

§max_output_chars: CharLimit

Stdout/stderr character limit. Accepts legacy alias max_chars.

§sudo_password: Option<SecretString>

Password for sudo (optional).

§su_password: Option<SecretString>

Password for su - (optional).

§disable_sudo: bool

If true, sudo-exec and su-exec are rejected for this host.

§schema_version: u32

Schema version for this record.

§added_at: Rfc3339Utc

RFC 3339 inclusion timestamp (DateTime<Utc> newtype).

§tags: Vec<HostTag>

Optional host tags for fleet selection (G-O2). Empty on legacy records.

§tls: bool

When true, wrap SSH in TLS (SSH-over-TLS via rustls) before the SSH handshake.

§tls_sni: Option<String>

SNI / certificate name for TLS (defaults to host when empty/None).

§tls_client_cert: Option<String>

Client certificate PEM path for mTLS (optional).

§tls_client_key: Option<String>

Client private key PEM path for mTLS (optional; required with cert).

Implementations§

Source§

impl VpsRecord

Source

pub fn try_new( name: impl AsRef<str>, host: impl AsRef<str>, port: u16, username: impl AsRef<str>, password: SecretString, key_path: Option<impl AsRef<str>>, key_passphrase: Option<SecretString>, timeout_ms: Option<u64>, max_command_chars: Option<usize>, max_output_chars: Option<usize>, sudo_password: Option<SecretString>, su_password: Option<SecretString>, disable_sudo: bool, ) -> Result<Self, String>

Creates a new record applying defaults (validated — G-TYPE-06).

§Errors

Returns a message when any field fails domain parse.

Source

pub fn has_any_tag(&self, wanted: &[HostTag]) -> bool

Returns true if this host has any of the requested tags (OR match, G-O2).

Source

pub fn has_password(&self) -> bool

Returns true if there is a non-empty password (G-TYPE-12).

Source

pub fn has_key(&self) -> bool

Returns true if there is a private key path.

Source

pub fn validate_credentials(&self) -> Result<(), DomainError>

Validates primary authentication: exactly one of password / key / agent (G-AUD-07).

§Errors

crate::domain::DomainError when zero or more than one primary method is set.

Source

pub fn validate_structure(&self) -> Result<(), DomainError>

Structural validation (G-SERDE-04 / G-TYPE): tags cardinality + field proofs already in types.

§Errors

crate::domain::DomainError when tag cardinality exceeds the limit.

Source

pub fn validate(&self) -> Result<(), DomainError>

Full record validation at the write boundary (add/edit/import).

§Errors

Propagates crate::domain::DomainError from structure or credentials checks.

Source

pub fn normalize_schema(&mut self)

Normalizes schema after deserialization (v1 → v2 migration).

Source

pub fn set_tags_from_raw( &mut self, raw: impl IntoIterator<Item = impl AsRef<str>>, ) -> Result<(), DomainError>

Sets tags from raw strings (validated).

Trait Implementations§

Source§

impl Clone for VpsRecord

Source§

fn clone(&self) -> VpsRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VpsRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for VpsRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&VpsRecord> for MaskedVpsJson

Source§

fn from(r: &VpsRecord) -> Self

Converts to this type from the input type.
Source§

impl Serialize for VpsRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more