RunbeamClient

Struct RunbeamClient 

Source
pub struct RunbeamClient { /* private fields */ }
Expand description

HTTP client for Runbeam Cloud API

This client handles all communication with the Runbeam Cloud control plane, including gateway authorization and future component loading.

Implementations§

Source§

impl RunbeamClient

Source

pub fn new(base_url: impl Into<String>) -> Self

Create a new Runbeam Cloud API client

§Arguments
  • base_url - The Runbeam Cloud API base URL (extracted from JWT iss claim)
§Example
use runbeam_sdk::RunbeamClient;

let client = RunbeamClient::new("http://runbeam.lndo.site");
Source

pub async fn authorize_gateway( &self, user_token: impl Into<String>, gateway_code: impl Into<String>, machine_public_key: Option<String>, metadata: Option<Vec<String>>, ) -> Result<AuthorizeResponse, RunbeamError>

Authorize a gateway and obtain a machine-scoped token

This method exchanges a user authentication token (either JWT or Laravel Sanctum) for a machine-scoped token that the gateway can use for autonomous API access. The machine token has a 30-day expiry (configured server-side).

§Authentication

This method accepts both JWT tokens and Laravel Sanctum API tokens:

  • JWT tokens: Validated locally with RS256 signature verification (legacy behavior)
  • Sanctum tokens: Passed directly to server for validation (format: {id}|{token})

The token is passed to the Runbeam Cloud API in both the Authorization header and request body, where final validation and authorization occurs.

§Arguments
  • user_token - The user’s JWT or Sanctum API token from CLI authentication
  • gateway_code - The gateway instance ID
  • machine_public_key - Optional public key for secure communication
  • metadata - Optional metadata about the gateway (array of strings)
§Returns

Returns Ok(AuthorizeResponse) with machine token and gateway details, or Err(RunbeamError) if authorization fails.

§Example
use runbeam_sdk::RunbeamClient;

let client = RunbeamClient::new("http://runbeam.lndo.site");

// Using JWT token
let response = client.authorize_gateway(
    "eyJhbGci...",
    "gateway-123",
    None,
    None
).await?;

// Using Sanctum token
let response = client.authorize_gateway(
    "1|abc123def456...",
    "gateway-123",
    None,
    None
).await?;

println!("Machine token: {}", response.machine_token);
println!("Expires at: {}", response.expires_at);
Source

pub fn base_url(&self) -> &str

Get the base URL for this client

Source

pub async fn list_gateways( &self, token: impl Into<String>, ) -> Result<PaginatedResponse<Gateway>, RunbeamError>

List all gateways for the authenticated team

Returns a paginated list of gateways.

§Authentication

Accepts either JWT tokens or Laravel Sanctum API tokens. The token is passed to the server for validation without local verification.

§Arguments
  • token - JWT or Sanctum API token for authentication
Source

pub async fn get_gateway( &self, token: impl Into<String>, gateway_id: impl Into<String>, ) -> Result<ResourceResponse<Gateway>, RunbeamError>

Get a specific gateway by ID or code

§Authentication

Accepts JWT tokens, Sanctum API tokens, or machine tokens. The token is passed to the server for validation without local verification.

§Arguments
  • token - JWT, Sanctum API token, or machine token for authentication
  • gateway_id - The gateway ID or code
Source

pub async fn list_services( &self, token: impl Into<String>, ) -> Result<PaginatedResponse<Service>, RunbeamError>

List all services for the authenticated team

Returns a paginated list of services across all gateways.

§Authentication

Accepts either JWT tokens or Laravel Sanctum API tokens. The token is passed to the server for validation without local verification.

§Arguments
  • token - JWT or Sanctum API token for authentication
Source

pub async fn get_service( &self, token: impl Into<String>, service_id: impl Into<String>, ) -> Result<ResourceResponse<Service>, RunbeamError>

Get a specific service by ID

§Authentication

Accepts JWT tokens, Sanctum API tokens, or machine tokens. The token is passed to the server for validation without local verification.

§Arguments
  • token - JWT, Sanctum API token, or machine token for authentication
  • service_id - The service ID
Source

pub async fn list_endpoints( &self, token: impl Into<String>, ) -> Result<PaginatedResponse<Endpoint>, RunbeamError>

List all endpoints for the authenticated team

§Authentication

Accepts either JWT tokens or Laravel Sanctum API tokens. The token is passed to the server for validation without local verification.

§Arguments
  • token - JWT or Sanctum API token for authentication
Source

pub async fn list_backends( &self, token: impl Into<String>, ) -> Result<PaginatedResponse<Backend>, RunbeamError>

List all backends for the authenticated team

§Authentication

Accepts either JWT tokens or Laravel Sanctum API tokens. The token is passed to the server for validation without local verification.

§Arguments
  • token - JWT or Sanctum API token for authentication
Source

pub async fn list_pipelines( &self, token: impl Into<String>, ) -> Result<PaginatedResponse<Pipeline>, RunbeamError>

List all pipelines for the authenticated team

§Authentication

Accepts either JWT tokens or Laravel Sanctum API tokens. The token is passed to the server for validation without local verification.

§Arguments
  • token - JWT or Sanctum API token for authentication

Trait Implementations§

Source§

impl Clone for RunbeamClient

Source§

fn clone(&self) -> RunbeamClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RunbeamClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,