pub struct CoderHttpClient { /* private fields */ }Expand description
The Coder-shaped HTTP client (production SubstrateClient): base URL +
session token, Coder’s Coder-Session-Token auth header, one bounded
timeout per call. Wire mapping (the documented v1 substrate shape —
validated against a loopback mock only, no live Coder deployment):
create_workspace→POST {base}/api/v2/users/me/workspaceswith body{"template_id", "name", "env_names"}(names only — the substrate injects the named secrets from its own store), plus"idle_after_hours"whenworkspace.remote.idleAfterHoursis configured (the substrate owns the idle policy; a substrate without support ignores the key). Response:{"id", "urls"?, "takeover"?}—urls/takeoveroptional so a stock Coder create response (which carries the id but not flattened app URLs) degrades honestly to “no previews reported.”workspace_status→GET {base}/api/v2/workspaces/{id}; reads top-levelstatusorlatest_build.status:"running"→ ready,"failed"→ failed, anything else (starting/stopping/unknown) → pending (keep polling, bounded).delete_workspace/stop_workspace→POST {base}/api/v2/workspaces/{id}/buildswith{"transition": "delete" | "stop"}(Coder models both as workspace builds).
Implementations§
Trait Implementations§
Source§impl SubstrateClient for CoderHttpClient
impl SubstrateClient for CoderHttpClient
Source§fn create_workspace<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 SubstrateWorkspaceSpec,
) -> Pin<Box<dyn Future<Output = Result<SubstrateWorkspace>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_workspace<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 SubstrateWorkspaceSpec,
) -> Pin<Box<dyn Future<Output = Result<SubstrateWorkspace>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create (and start) one workspace from a pinned template, injecting
the named secrets — NAMES only, never values.
Source§fn workspace_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<SubstrateStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn workspace_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<SubstrateStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The workspace’s current lifecycle state.
Auto Trait Implementations§
impl !RefUnwindSafe for CoderHttpClient
impl !UnwindSafe for CoderHttpClient
impl Freeze for CoderHttpClient
impl Send for CoderHttpClient
impl Sync for CoderHttpClient
impl Unpin for CoderHttpClient
impl UnsafeUnpin for CoderHttpClient
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
Mutably borrows from an owned value. Read more