pub struct Client { /* private fields */ }Expand description
A configured Sail client. Cheap to clone; shares transport across clones.
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder(api_key: impl Into<String>) -> ClientBuilder
pub fn builder(api_key: impl Into<String>) -> ClientBuilder
Start a ClientBuilder.
Sourcepub fn from_env() -> Result<Client, SailError>
pub fn from_env() -> Result<Client, SailError>
Build a client from the environment (SAIL_MODE, SAIL_API_KEY, …).
Sourcepub fn from_config(config: Config) -> Result<Client, SailError>
pub fn from_config(config: Config) -> Result<Client, SailError>
Build a client from an already-resolved Config.
Sourcepub async fn create_sailbox(
&self,
req: &CreateSailboxRequest,
) -> Result<SailboxHandle, SailError>
pub async fn create_sailbox( &self, req: &CreateSailboxRequest, ) -> Result<SailboxHandle, SailError>
Create a sailbox.
Sourcepub async fn get_sailbox(
&self,
sailbox_id: &str,
) -> Result<SailboxInfo, SailError>
pub async fn get_sailbox( &self, sailbox_id: &str, ) -> Result<SailboxInfo, SailError>
Fetch a single sailbox.
Sourcepub async fn list_sailboxes(
&self,
query: &ListQuery,
) -> Result<SailboxPage, SailError>
pub async fn list_sailboxes( &self, query: &ListQuery, ) -> Result<SailboxPage, SailError>
List sailboxes in the current org.
Sourcepub async fn terminate_sailbox(&self, sailbox_id: &str) -> Result<(), SailError>
pub async fn terminate_sailbox(&self, sailbox_id: &str) -> Result<(), SailError>
Terminate a sailbox (idempotent).
Sourcepub async fn resume_sailbox(
&self,
sailbox_id: &str,
) -> Result<SailboxHandle, SailError>
pub async fn resume_sailbox( &self, sailbox_id: &str, ) -> Result<SailboxHandle, SailError>
Resume a paused/sleeping sailbox.
Sourcepub async fn checkpoint_sailbox(
&self,
sailbox_id: &str,
) -> Result<SailboxCheckpoint, SailError>
pub async fn checkpoint_sailbox( &self, sailbox_id: &str, ) -> Result<SailboxCheckpoint, SailError>
Checkpoint a running sailbox.
Sourcepub async fn create_from_checkpoint(
&self,
checkpoint_id: &str,
name: Option<&str>,
timeout_seconds: Option<i64>,
) -> Result<SailboxHandle, SailError>
pub async fn create_from_checkpoint( &self, checkpoint_id: &str, name: Option<&str>, timeout_seconds: Option<i64>, ) -> Result<SailboxHandle, SailError>
Create a new sailbox from a checkpoint.
Sourcepub async fn upgrade_sailbox(
&self,
sailbox_id: &str,
) -> Result<UpgradeOutcome, SailError>
pub async fn upgrade_sailbox( &self, sailbox_id: &str, ) -> Result<UpgradeOutcome, SailError>
Upgrade the in-guest agent (applies now if running, else at next wake).
Sourcepub async fn expose_listener(
&self,
sailbox_id: &str,
guest_port: u32,
protocol: &str,
allowlist: &[String],
) -> Result<Value, SailError>
pub async fn expose_listener( &self, sailbox_id: &str, guest_port: u32, protocol: &str, allowlist: &[String], ) -> Result<Value, SailError>
Expose a guest port at runtime; returns the add-listener response.
Sourcepub async fn unexpose_listener(
&self,
sailbox_id: &str,
guest_port: u32,
) -> Result<(), SailError>
pub async fn unexpose_listener( &self, sailbox_id: &str, guest_port: u32, ) -> Result<(), SailError>
Remove a runtime ingress port.
Sourcepub async fn list_listeners(
&self,
sailbox_id: &str,
) -> Result<Vec<Listener>, SailError>
pub async fn list_listeners( &self, sailbox_id: &str, ) -> Result<Vec<Listener>, SailError>
List a sailbox’s ingress listeners without resuming (waking) the box.
Sourcepub async fn get_listener(
&self,
sailbox_id: &str,
guest_port: u32,
) -> Result<Listener, SailError>
pub async fn get_listener( &self, sailbox_id: &str, guest_port: u32, ) -> Result<Listener, SailError>
Fetch one ingress listener by guest port without resuming (waking) the
box; a missing port is a SailError::NotFound.
Sourcepub async fn ingress_auth_headers(
&self,
sailbox_id: &str,
) -> Result<Vec<(String, String)>, SailError>
pub async fn ingress_auth_headers( &self, sailbox_id: &str, ) -> Result<Vec<(String, String)>, SailError>
Ingress-identity headers for this sailbox.
Sourcepub async fn get_volume(
&self,
name: &str,
mint_if_missing: bool,
) -> Result<NfsVolume, SailError>
pub async fn get_volume( &self, name: &str, mint_if_missing: bool, ) -> Result<NfsVolume, SailError>
Look up (optionally minting) an NFS volume by name.
Sourcepub async fn list_volumes(
&self,
max_objects: Option<i64>,
) -> Result<Vec<NfsVolume>, SailError>
pub async fn list_volumes( &self, max_objects: Option<i64>, ) -> Result<Vec<NfsVolume>, SailError>
List NFS volumes in the current org.
Sourcepub async fn delete_volume(
&self,
volume_id: &str,
allow_missing: bool,
) -> Result<Option<NfsVolume>, SailError>
pub async fn delete_volume( &self, volume_id: &str, allow_missing: bool, ) -> Result<Option<NfsVolume>, SailError>
Delete a volume by id.
Sourcepub async fn find_app(
&self,
name: &str,
mint_if_missing: bool,
) -> Result<App, SailError>
pub async fn find_app( &self, name: &str, mint_if_missing: bool, ) -> Result<App, SailError>
Find an app by name on the central API, optionally minting it.
Sourcepub async fn list_apps(&self) -> Result<Vec<AppOverview>, SailError>
pub async fn list_apps(&self) -> Result<Vec<AppOverview>, SailError>
List apps in the current org with rollup usage.
Sourcepub async fn exec(
&self,
sailbox_id: &str,
argv: Vec<String>,
options: ExecOptions,
) -> Result<ExecProcess, SailError>
pub async fn exec( &self, sailbox_id: &str, argv: Vec<String>, options: ExecOptions, ) -> Result<ExecProcess, SailError>
Run a command in a sailbox and return a handle to the live process.
Resumes (wakes) the sailbox to reach it. The returned ExecProcess
streams output, accepts stdin, and resolves the exit status; dropping it
detaches without killing the command.
§Runtime
Spawns the output pump on the calling task’s tokio runtime (see
ExecProcess::start).
Sourcepub async fn download_file(
&self,
sailbox_id: &str,
remote_path: &str,
) -> Result<FileReader, SailError>
pub async fn download_file( &self, sailbox_id: &str, remote_path: &str, ) -> Result<FileReader, SailError>
Open a streaming read of a guest file. Resumes (wakes) the sailbox to
reach it; the returned FileReader yields chunks until end of file.
§Runtime
Spawns the read pump on the calling task’s tokio runtime (see
[crate::worker::WorkerProxy::read_file]).
Sourcepub async fn upload_file(
&self,
sailbox_id: &str,
remote_path: &str,
options: UploadOptions,
) -> Result<FileWriter, SailError>
pub async fn upload_file( &self, sailbox_id: &str, remote_path: &str, options: UploadOptions, ) -> Result<FileWriter, SailError>
Open a streaming write to a guest file. Resumes (wakes) the sailbox to
reach it; feed the returned FileWriter with write_chunk and end with
finish, so a large source is never buffered whole.
§Runtime
Spawns the write RPC on the calling task’s tokio runtime (see
[crate::worker::WorkerProxy::write_file]).
Source§impl Client
impl Client
Sourcepub async fn enable_ssh(
&self,
sailbox_id: &str,
public_key: &str,
wait: bool,
timeout: Duration,
) -> Result<Option<SshEndpoint>, SailError>
pub async fn enable_ssh( &self, sailbox_id: &str, public_key: &str, wait: bool, timeout: Duration, ) -> Result<Option<SshEndpoint>, SailError>
Make a running sailbox reachable over SSH, returning the endpoint when
wait is set (else None). Resumes (wakes) the sailbox to reach it,
reserves guest port 22 as TCP ingress if not already exposed, installs
public_key, and (re)starts sshd. Idempotent and safe to re-run.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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