mirror of
https://github.com/veeso/termscp.git
synced 2026-06-06 02:25:44 +02:00
docs: add core module and API documentation
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
//! ## Bookmark S3 Parameters
|
||||||
|
//!
|
||||||
|
//! Stores the bookmark-specific representation of AWS S3 connection settings.
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::filetransfer::params::AwsS3Params;
|
use crate::filetransfer::params::AwsS3Params;
|
||||||
@@ -5,13 +9,20 @@ use crate::filetransfer::params::AwsS3Params;
|
|||||||
/// Connection parameters for Aws s3 protocol
|
/// Connection parameters for Aws s3 protocol
|
||||||
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
|
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
|
||||||
pub struct S3Params {
|
pub struct S3Params {
|
||||||
|
/// Bucket name to open.
|
||||||
pub bucket: String,
|
pub bucket: String,
|
||||||
|
/// AWS region used for the bucket.
|
||||||
pub region: Option<String>,
|
pub region: Option<String>,
|
||||||
|
/// Custom endpoint URL for S3-compatible services.
|
||||||
pub endpoint: Option<String>,
|
pub endpoint: Option<String>,
|
||||||
|
/// Shared credentials profile name.
|
||||||
pub profile: Option<String>,
|
pub profile: Option<String>,
|
||||||
|
/// Static access key identifier.
|
||||||
pub access_key: Option<String>,
|
pub access_key: Option<String>,
|
||||||
|
/// Static secret access key.
|
||||||
pub secret_access_key: Option<String>,
|
pub secret_access_key: Option<String>,
|
||||||
/// NOTE: there are no session token and security token since they are always temporary
|
/// NOTE: there are no session token and security token since they are always temporary
|
||||||
|
/// Whether to force path-style bucket addressing.
|
||||||
pub new_path_style: Option<bool>,
|
pub new_path_style: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
//! ## Bookmark Kube Parameters
|
||||||
|
//!
|
||||||
|
//! Stores bookmark-specific Kubernetes connection settings.
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::filetransfer::params::KubeProtocolParams;
|
use crate::filetransfer::params::KubeProtocolParams;
|
||||||
@@ -5,10 +9,15 @@ use crate::filetransfer::params::KubeProtocolParams;
|
|||||||
/// Extra Connection parameters for Kube protocol
|
/// Extra Connection parameters for Kube protocol
|
||||||
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
|
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
|
||||||
pub struct KubeParams {
|
pub struct KubeParams {
|
||||||
|
/// Optional default namespace.
|
||||||
pub namespace: Option<String>,
|
pub namespace: Option<String>,
|
||||||
|
/// Optional cluster API URL.
|
||||||
pub cluster_url: Option<String>,
|
pub cluster_url: Option<String>,
|
||||||
|
/// Optional Kubernetes username override.
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
|
/// Optional client certificate path.
|
||||||
pub client_cert: Option<String>,
|
pub client_cert: Option<String>,
|
||||||
|
/// Optional client key path.
|
||||||
pub client_key: Option<String>,
|
pub client_key: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
//! ## Bookmark SMB Parameters
|
||||||
|
//!
|
||||||
|
//! Stores bookmark-specific SMB share configuration.
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::filetransfer::params::SmbParams as TransferSmbParams;
|
use crate::filetransfer::params::SmbParams as TransferSmbParams;
|
||||||
@@ -5,7 +9,9 @@ use crate::filetransfer::params::SmbParams as TransferSmbParams;
|
|||||||
/// Extra Connection parameters for SMB protocol
|
/// Extra Connection parameters for SMB protocol
|
||||||
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
|
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
|
||||||
pub struct SmbParams {
|
pub struct SmbParams {
|
||||||
|
/// SMB share name.
|
||||||
pub share: String,
|
pub share: String,
|
||||||
|
/// Optional SMB workgroup used on POSIX platforms.
|
||||||
pub workgroup: Option<String>,
|
pub workgroup: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
|
//! ## Host Bridge Builder
|
||||||
|
//!
|
||||||
|
//! Builds host bridge implementations from persisted host bridge parameters and
|
||||||
|
//! the active configuration client.
|
||||||
|
|
||||||
use super::{HostBridgeParams, RemoteFsBuilder};
|
use super::{HostBridgeParams, RemoteFsBuilder};
|
||||||
use crate::host::{HostBridge, Localhost, RemoteBridged};
|
use crate::host::{HostBridge, Localhost, RemoteBridged};
|
||||||
use crate::system::config_client::ConfigClient;
|
use crate::system::config_client::ConfigClient;
|
||||||
|
|
||||||
|
/// Builds the host-side filesystem bridge used during file transfer sessions.
|
||||||
pub struct HostBridgeBuilder;
|
pub struct HostBridgeBuilder;
|
||||||
|
|
||||||
impl HostBridgeBuilder {
|
impl HostBridgeBuilder {
|
||||||
/// Build Host Bridge from parms
|
/// Builds a host bridge from serialized parameters.
|
||||||
///
|
///
|
||||||
/// if protocol and parameters are inconsistent, the function will return an error.
|
/// Returns an error when the selected host protocol and parameters are inconsistent.
|
||||||
pub fn build(
|
pub fn build(
|
||||||
params: HostBridgeParams,
|
params: HostBridgeParams,
|
||||||
config_client: &ConfigClient,
|
config_client: &ConfigClient,
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
//! ## Temp Mapped File
|
||||||
|
//!
|
||||||
|
//! Provides a temporary local file that mirrors a remote file while keeping a
|
||||||
|
//! lazily opened read/write handle.
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
@@ -34,6 +39,7 @@ impl Read for TempMappedFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TempMappedFile {
|
impl TempMappedFile {
|
||||||
|
/// Creates an empty temporary file container for a downloaded remote file.
|
||||||
pub fn new() -> HostResult<Self> {
|
pub fn new() -> HostResult<Self> {
|
||||||
NamedTempFile::new()
|
NamedTempFile::new()
|
||||||
.map(|tempfile| TempMappedFile {
|
.map(|tempfile| TempMappedFile {
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ pub enum UpdateStatus {
|
|||||||
/// Info related to a github release
|
/// Info related to a github release
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Release {
|
pub struct Release {
|
||||||
|
/// Release version string returned by GitHub.
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
/// Release notes body returned by GitHub.
|
||||||
pub body: String,
|
pub body: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +50,7 @@ impl Update {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Installs the latest available release using the configured update options.
|
||||||
pub fn upgrade(self) -> Result<UpdateStatus, UpdateError> {
|
pub fn upgrade(self) -> Result<UpdateStatus, UpdateError> {
|
||||||
info!("Updating termscp...");
|
info!("Updating termscp...");
|
||||||
GithubUpdater::configure()
|
GithubUpdater::configure()
|
||||||
|
|||||||
Reference in New Issue
Block a user