pub struct CommandsClient { /* private fields */ }Expand description
High-level client for invoking commands on Alien deployments.
Implementations§
Source§impl CommandsClient
impl CommandsClient
Sourcepub fn new(manager_url: &str, deployment_id: &str, token: &str) -> Self
pub fn new(manager_url: &str, deployment_id: &str, token: &str) -> Self
Create a new commands client with default config.
Sourcepub fn with_config(
manager_url: &str,
deployment_id: &str,
token: &str,
config: CommandsClientConfig,
) -> Self
pub fn with_config( manager_url: &str, deployment_id: &str, token: &str, config: CommandsClientConfig, ) -> Self
Create a new commands client with custom config.
Sourcepub fn with_http_client(
manager_url: &str,
deployment_id: &str,
http_client: Client,
config: CommandsClientConfig,
) -> Self
pub fn with_http_client( manager_url: &str, deployment_id: &str, http_client: Client, config: CommandsClientConfig, ) -> Self
Build a client over a caller-supplied HTTP client, reusing the headers
it already carries (the auth header, and the workspace header used in
platform mode). with_config builds a token-only client and can’t add
those.
Sourcepub async fn invoke<P: Serialize, R: DeserializeOwned>(
&self,
command: &str,
params: P,
) -> Result<R, CommandError>
pub async fn invoke<P: Serialize, R: DeserializeOwned>( &self, command: &str, params: P, ) -> Result<R, CommandError>
Invoke a command and wait for the result.
Sends params inline, polls for completion, and decodes the response.
Sourcepub async fn invoke_with_options<P: Serialize, R: DeserializeOwned>(
&self,
command: &str,
params: P,
options: Option<InvokeOptions>,
) -> Result<R, CommandError>
pub async fn invoke_with_options<P: Serialize, R: DeserializeOwned>( &self, command: &str, params: P, options: Option<InvokeOptions>, ) -> Result<R, CommandError>
Invoke a command with options and wait for the result.
Sourcepub async fn create<P: Serialize>(
&self,
command: &str,
params: P,
options: Option<&InvokeOptions>,
) -> Result<String, CommandError>
pub async fn create<P: Serialize>( &self, command: &str, params: P, options: Option<&InvokeOptions>, ) -> Result<String, CommandError>
Create a command without waiting for the result. Returns the command ID.
Auto Trait Implementations§
impl Freeze for CommandsClient
impl !RefUnwindSafe for CommandsClient
impl Send for CommandsClient
impl Sync for CommandsClient
impl Unpin for CommandsClient
impl UnsafeUnpin for CommandsClient
impl !UnwindSafe for CommandsClient
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