pub struct ControlPlaneClient { /* private fields */ }Expand description
Calls the control-plane API on behalf of the CLI.
Cheap to clone (reqwest::Client is an Arc inside). Holds the bearer token
the API requires; None is only useful against a --no-auth control plane.
Implementations§
Source§impl ControlPlaneClient
impl ControlPlaneClient
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Target the control plane at base_url (e.g. http://127.0.0.1:9090).
A trailing slash is trimmed, so a pasted URL and a typed one behave the same.
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Present this bearer token on every request.
Sourcepub fn with_optional_token(self, token: Option<impl Into<String>>) -> Self
pub fn with_optional_token(self, token: Option<impl Into<String>>) -> Self
Present token if there is one — the Option-shaped form of
with_token, so a caller resolving a flag or an env
var does not have to branch.
Sourcepub async fn deploy(
&self,
config_toml: impl Into<String>,
) -> Result<DeployedAgent, ControlPlaneClientError>
pub async fn deploy( &self, config_toml: impl Into<String>, ) -> Result<DeployedAgent, ControlPlaneClientError>
Deploy an agent from raw, unexpanded config TOML.
Deliberately takes the text as it sits on disk: ${VAR} refs are the
control plane’s to resolve, against its own environment and its
allowlist. Expanding them here would put the operator’s secrets on the
wire and require the deploying machine to hold them.
Sourcepub async fn list(
&self,
filter: ListFilter,
) -> Result<Vec<DeployedAgent>, ControlPlaneClientError>
pub async fn list( &self, filter: ListFilter, ) -> Result<Vec<DeployedAgent>, ControlPlaneClientError>
Deployed agents with their endpoint and current health.
ListFilter::Live hides agents that have been stopped; the control
plane keeps their entries (their logs are still readable) but they are
not part of what is running.
Sourcepub async fn status(
&self,
id: &AgentId,
) -> Result<AgentStatus, ControlPlaneClientError>
pub async fn status( &self, id: &AgentId, ) -> Result<AgentStatus, ControlPlaneClientError>
One agent’s current health.
Trait Implementations§
Source§impl Clone for ControlPlaneClient
impl Clone for ControlPlaneClient
Auto Trait Implementations§
impl !RefUnwindSafe for ControlPlaneClient
impl !UnwindSafe for ControlPlaneClient
impl Freeze for ControlPlaneClient
impl Send for ControlPlaneClient
impl Sync for ControlPlaneClient
impl Unpin for ControlPlaneClient
impl UnsafeUnpin for ControlPlaneClient
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more