Skip to main content

Crate nubis_sdk

Crate nubis_sdk 

Source
Expand description

Official Nubis SDK for Rust

This SDK provides a type-safe interface to the Nubis API.

§Example

use nubis_sdk::NubisClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = NubisClient::new(
        std::env::var("NUBIS_API_KEY")?
    );

    // List all VMs in a project
    let vms = client
        .vms()
        .list("proj_01J5X...")
        .await?;

    // Create a new VM
    use nubis_sdk::types::CreateVmRequest;
    let vm = client
        .vms()
        .create(CreateVmRequest {
            project_id: "proj_01J5X...".into(),
            name: "api-server".into(),
            size: "s-1vcpu-1gb".into(),
            region: "nyc1".into(),
            image: "ubuntu-24.04-x64".into(),
            ssh_keys: vec![],
            ssh_public_key: None,
            ssh_public_key_id: None,
            network_id: None,
            firewall_id: None,
            public_ip: Some(true),
            tags: None,
            enable_password_auth: None,
            admin_password: None,
            ssh_allowed_cidrs: vec![],
        })
        .await?;

    println!("Created VM: {}", vm.id);
    Ok(())
}

Re-exports§

pub use client::NubisClient;
pub use error::NubisError;
pub use error::Result;
pub use types::*;

Modules§

client
error
resources
types