docs: document parser and file transfer params

This commit is contained in:
Christian Visintin
2026-03-21 13:37:18 +01:00
parent 3905e8ed79
commit 663e1ec38b
6 changed files with 58 additions and 1 deletions

View File

@@ -1,14 +1,28 @@
//! ## AWS S3 Parameters
//!
//! Defines the runtime connection parameters used to build AWS S3 and
//! S3-compatible remote filesystem clients.
/// Connection parameters for AWS S3 protocol
#[derive(Debug, Clone)]
pub struct AwsS3Params {
/// Target bucket name.
pub bucket_name: String,
/// Target region.
pub region: Option<String>,
/// Optional custom endpoint URL.
pub endpoint: Option<String>,
/// Optional shared credentials profile.
pub profile: Option<String>,
/// Optional static access key.
pub access_key: Option<String>,
/// Optional static secret access key.
pub secret_access_key: Option<String>,
/// Optional security token for temporary credentials.
pub security_token: Option<String>,
/// Optional session token for temporary credentials.
pub session_token: Option<String>,
/// Whether to force path-style bucket addressing.
pub new_path_style: bool,
}

View File

@@ -1,22 +1,35 @@
//! ## Kubernetes Parameters
//!
//! Defines the runtime parameters used to construct Kubernetes-backed file
//! transfer clients.
use remotefs_kube::Config;
/// Protocol params used by WebDAV
/// Protocol params used by Kubernetes connections.
#[derive(Debug, Clone)]
pub struct KubeProtocolParams {
/// Optional namespace for the default pod context.
pub namespace: Option<String>,
/// Optional Kubernetes API URL.
pub cluster_url: Option<String>,
/// Optional username override.
pub username: Option<String>,
/// Optional client certificate path.
pub client_cert: Option<String>,
/// Optional client key path.
pub client_key: Option<String>,
}
impl KubeProtocolParams {
/// Kubernetes connections do not use the shared password secret flow.
pub fn set_default_secret(&mut self, _secret: String) {}
/// Kubernetes params never require the generic password prompt.
pub fn password_missing(&self) -> bool {
false
}
/// Converts bookmark/runtime parameters into a `remotefs_kube` config.
pub fn config(self) -> Option<Config> {
if let Some(cluster_url) = self.cluster_url {
let mut config = Config::new(cluster_url.parse().unwrap_or_default());

View File

@@ -1,13 +1,24 @@
//! ## SMB Parameters
//!
//! Defines the runtime connection parameters used to build SMB remote
//! filesystem clients.
/// Connection parameters for SMB protocol
#[derive(Debug, Clone)]
pub struct SmbParams {
/// Hostname or address of the SMB server.
pub address: String,
#[cfg(posix)]
/// SMB service port used on POSIX platforms.
pub port: u16,
/// Share name to mount.
pub share: String,
/// Optional username.
pub username: Option<String>,
/// Optional password.
pub password: Option<String>,
#[cfg(posix)]
/// Optional workgroup used on POSIX platforms.
pub workgroup: Option<String>,
}

View File

@@ -1,16 +1,25 @@
//! ## WebDAV Parameters
//!
//! Defines the runtime connection parameters used to build WebDAV clients.
/// Protocol params used by WebDAV
#[derive(Debug, Clone)]
pub struct WebDAVProtocolParams {
/// Base WebDAV endpoint URI.
pub uri: String,
/// Username used for authentication.
pub username: String,
/// Password used for authentication.
pub password: String,
}
impl WebDAVProtocolParams {
/// Stores the shared secret as the active WebDAV password.
pub fn set_default_secret(&mut self, secret: String) {
self.password = secret;
}
/// Returns whether the WebDAV password is currently missing.
pub fn password_missing(&self) -> bool {
self.password.is_empty()
}

View File

@@ -1,3 +1,8 @@
//! ## Parser Credential Helpers
//!
//! Shared capture-group helpers used by parser submodules when extracting
//! credentials and required fields from regex matches.
pub(super) fn optional_capture(groups: &regex::Captures<'_>, index: usize) -> Option<String> {
groups.get(index).map(|group| group.as_str().to_string())
}

View File

@@ -1,3 +1,8 @@
//! ## Parser Remote Helpers
//!
//! Implements protocol-specific parsing for remote connection strings while
//! keeping the public parser API stable.
use std::path::PathBuf;
#[cfg(smb)]