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_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,
timeout: Option<Duration>,
) -> Result<Sailbox, SailError>
pub async fn create_sailbox( &self, req: &CreateSailboxRequest, timeout: Option<Duration>, ) -> Result<Sailbox, SailError>
Create a sailbox. timeout bounds each attempt of the synchronous
create (which can take minutes server-side); the call retries
with one idempotency key so the backend can dedupe rather than
duplicate, and gives up after roughly max_attempts * timeout.
An interrupted or re-invoked create is a new request and may leave a
prior box behind under the same name. 10 minutes is a good default;
None leaves each attempt unbounded. If the budget is exhausted the
box may still be coming up server-side; find or terminate it by
name.
Sourcepub async fn list_sailboxes(
&self,
query: &ListSailboxesQuery,
) -> Result<SailboxPage, SailError>
pub async fn list_sailboxes( &self, query: &ListSailboxesQuery, ) -> Result<SailboxPage, SailError>
List sailboxes in the current org.
Sourcepub async fn sailbox_spend(
&self,
query: &SailboxSpendQuery,
) -> Result<SailboxSpendResponse, SailError>
pub async fn sailbox_spend( &self, query: &SailboxSpendQuery, ) -> Result<SailboxSpendResponse, SailError>
Estimate sailbox spend for the current organization over a time window.
Sourcepub async fn sailbox_metrics(
&self,
sailbox_id: &str,
query: &SailboxMetricsQuery,
) -> Result<SailboxMetricsResponse, SailError>
pub async fn sailbox_metrics( &self, sailbox_id: &str, query: &SailboxMetricsQuery, ) -> Result<SailboxMetricsResponse, SailError>
Fetch a sailbox’s resource-usage time series.
Sourcepub async fn create_from_checkpoint(
&self,
checkpoint_id: &str,
name: Option<&str>,
timeout: Option<Duration>,
) -> Result<Sailbox, SailError>
pub async fn create_from_checkpoint( &self, checkpoint_id: &str, name: Option<&str>, timeout: Option<Duration>, ) -> Result<Sailbox, SailError>
Create a new sailbox from a checkpoint.
Sourcepub async fn org_ssh_ca_public_key(&self) -> Result<String, SailError>
pub async fn org_ssh_ca_public_key(&self) -> Result<String, SailError>
The caller org’s SSH CA public key (created on first use).
Sourcepub async fn issue_user_cert(
&self,
public_key: &str,
timeout: Option<Duration>,
) -> Result<IssuedUserCert, SailError>
pub async fn issue_user_cert( &self, public_key: &str, timeout: Option<Duration>, ) -> Result<IssuedUserCert, SailError>
Sign public_key into a short-lived org-CA certificate (principal
root). timeout (seconds) bounds a single no-retry attempt; None
retries.
Sourcepub async fn get_volume(
&self,
name: &str,
mint_if_missing: bool,
) -> Result<VolumeInfo, SailError>
pub async fn get_volume( &self, name: &str, mint_if_missing: bool, ) -> Result<VolumeInfo, SailError>
Look up (optionally minting) an NFS volume by name.
Sourcepub async fn list_volumes(
&self,
max_objects: Option<i64>,
) -> Result<Vec<VolumeInfo>, SailError>
pub async fn list_volumes( &self, max_objects: Option<i64>, ) -> Result<Vec<VolumeInfo>, SailError>
List NFS volumes in the current org.
Sourcepub async fn delete_volume(
&self,
volume_id: &str,
allow_missing: bool,
) -> Result<Option<VolumeInfo>, SailError>
pub async fn delete_volume( &self, volume_id: &str, allow_missing: bool, ) -> Result<Option<VolumeInfo>, SailError>
Delete a volume by id.
Source§impl Client
impl Client
Sourcepub async fn build_image(
&self,
spec: &ImageSpec,
retry_timeout_secs: f64,
) -> Result<ImageBuild, SailError>
pub async fn build_image( &self, spec: &ImageSpec, retry_timeout_secs: f64, ) -> Result<ImageBuild, SailError>
Submit or resume a custom image build. Poll
Client::get_image_build_status until the status is ready or failed,
or use Client::build_image_definition for the whole pipeline.
Sourcepub async fn get_image_build_status(
&self,
image_id: &str,
retry_timeout_secs: f64,
) -> Result<ImageBuild, SailError>
pub async fn get_image_build_status( &self, image_id: &str, retry_timeout_secs: f64, ) -> Result<ImageBuild, SailError>
Poll one custom image build’s status.
Sourcepub async fn resolve_image(
&self,
def: &ImageDefinition,
) -> Result<ImageSpec, SailError>
pub async fn resolve_image( &self, def: &ImageDefinition, ) -> Result<ImageSpec, SailError>
Resolve an ImageDefinition into a content-addressed ImageSpec:
walk local directories, hash every file, and upload content the server
does not already have.
Sourcepub async fn build_image_definition(
&self,
def: &ImageDefinition,
timeout: Duration,
) -> Result<ImageSpec, SailError>
pub async fn build_image_definition( &self, def: &ImageDefinition, timeout: Duration, ) -> Result<ImageSpec, SailError>
Resolve an ImageDefinition and build it to ready, returning the
content-addressed ImageSpec to create sailboxes from. A bare
builtin base skips the build. timeout bounds the whole pipeline
(hashing, uploads, and the build); 30 minutes is a good default, and
Duration::MAX waits indefinitely.
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