Expand description
§The Oxide Rust SDK
SDK for the Oxide API.
§Installation
The oxide crate is available on crates.io. You’ll probably want to use
tokio as well. Add them to your Cargo.toml file or use cargo add:
$ cargo add oxide
$ cargo add tokio§Authentication
To connect to the Oxide API, the SDK needs a host URL and a token. There are several ways to specify these:
- Configuration files: the CLI’s oxide auth logincommand generatesconfig.tomlandcredentials.tomlin$HOME/.config/oxide/. The credentials file contains sensitive information such as tokens and user IDs.
- Environment variables: You can set the OXIDE_HOSTandOXIDE_TOKENenvironment variables.
- Explicit host URL and token.
The simplest way to create an authenticated client is to use
oxide::Client::new_authenticated(), which uses the same credentials and
authentication logic as the CLI. By default, it reads data from configuration
files in $HOME/.config/oxide.
§Example
Create a new oxide::Client like this:
use futures::StreamExt;
use oxide::{Client, prelude::*};
#[tokio::main]
async fn main() {
    // Make a client from the on-disk configuration.
    let client = Client::new_authenticated()
        .expect("unable to create an authenticated client");
    // Start using the client!
    // For example we can look at the projects in our silo:
    let mut projects = client.project_list().stream();
    loop {
        match projects.next().await {
            // No more items.
            None => break,
            // Print the name of a project.
            Some(Ok(project)) => println!("project {}", *project.name),
            // Something went wrong
            Some(Err(err)) => println!("error {}", err),
        }
    }
}Modules§
- builder
- Types for composing operation parameters.
- prelude
- Items consumers will typically use such as the Client and extension traits.
- types
- Types used as operation parameters and responses.
Structs§
- BasicConfig File 
- Clients such as the CLI may specify additional configuration information;
authentication only relies on the value of default-profile.
- ByteStream 
- Untyped byte stream used for both success and error responses.
- Client
- Client for Oxide Region API
- ClientConfig 
- Configuration for creating an authenticated Client
- CredentialsFile 
- ProfileCredentials 
- Credentials for a particular profile.
- ResponseValue 
- Typed value returned by generated client methods.
Enums§
- Error
- Error produced by generated client methods.
- OxideAuth Error 
- Errors for interfaces related to authentication
Traits§
- ClientAffinity Ext 
- Anti-affinity groups give control over instance placement.
- ClientConsole Auth Ext 
- API for console authentication
- ClientCurrent User Ext 
- Information pertaining to the current user.
- ClientDisks Ext 
- Virtual disks are used to store instance-local data which includes the operating system.
- ClientExperimental Ext 
- Experimental, unstable interfaces, primarily for use by Oxide personnel
- ClientFloating IpsExt 
- Floating IPs allow a project to allocate well-known IPs to instances.
- ClientImages Ext 
- Images are read-only virtual disks that may be used to boot virtual machines.
- ClientInfo 
- Interface for which an implementation is generated for all clients.
- ClientInstances Ext 
- Virtual machine instances are the basic unit of computation. These operations are used for provisioning, controlling, and destroying instances.
- ClientLogin Ext 
- Authentication endpoints
- ClientMetrics Ext 
- Silo-scoped metrics
- ClientPolicy Ext 
- System-wide IAM policy
- ClientProjects Ext 
- Projects are a grouping of associated resources such as instances and disks within a silo for purposes of billing and access control.
- ClientSilos Ext 
- Silos represent a logical partition of users and resources.
- ClientSnapshots Ext 
- Snapshots of virtual disks at a particular point in time.
- ClientSystem Alerts Ext 
- Alerts deliver notifications for events that occur on the Oxide rack
- ClientSystem Audit LogExt 
- These endpoints relate to audit logs.
- ClientSystem Hardware Ext 
- These operations pertain to hardware inventory and management. Racks are the unit of expansion of an Oxide deployment. Racks are in turn composed of sleds, switches, power supplies, and a cabled backplane.
- ClientSystem IpPools Ext 
- IP pools are collections of external IPs that can be assigned to silos. When a pool is linked to a silo, users in that silo can allocate IPs from the pool for their instances.
- ClientSystem Metrics Ext 
- Metrics provide insight into the operation of the Oxide deployment. These include telemetry on hardware and software components that can be used to understand the current state as well as to diagnose issues.
- ClientSystem Networking Ext 
- This provides rack-level network configuration.
- ClientSystem Silos Ext 
- Silos represent a logical partition of users and resources.
- ClientSystem Status Ext 
- Endpoints related to system health
- ClientTokens Ext 
- API clients use device access tokens for authentication.
- ClientVpcs Ext 
- Virtual Private Clouds (VPCs) provide isolated network environments for managing and deploying services.