vultr 0.4.3

A pure Rust Vultr API binding.
Documentation
use serde::Deserialize;

#[derive(Deserialize, Debug)]
pub struct VultrAccountRoot {
    pub account: VultrAccount,
}

/// Billing and profile information for a Vultr account.
#[derive(Deserialize, Debug)]
pub struct VultrAccount {
    /// Full name associated with the account.
    pub name: String,
    /// Email address of the account owner.
    pub email: String,
    /// Current account balance in USD.
    pub balance: f32,
    /// Charges that have not yet been billed.
    pub pending_charges: f32,
    /// ISO 8601 date of the last payment.
    pub last_payment_date: String,
    /// Amount of the last payment in USD.
    pub last_payment_amount: f32,
    /// Access control permissions granted to this account.
    pub acls: Vec<String>,
}

#[derive(Deserialize, Debug)]
pub struct VultrRegionsRoot {
    pub regions: Vec<VultrRegion>,
}

/// A Vultr data center region where instances can be deployed.
#[derive(Deserialize, Debug)]
pub struct VultrRegion {
    /// Short region identifier (e.g. `"ewr"`).
    pub id: String,
    /// City where the data center is located.
    pub city: String,
    /// ISO 3166-1 alpha-2 country code (e.g. `"US"`).
    pub country: String,
    /// Continent name (e.g. `"North America"`).
    pub continent: String,
    /// Additional capabilities available in this region (e.g. `"ddos_protection"`).
    pub options: Vec<String>,
}

#[derive(Deserialize, Debug)]
pub struct VultrPlansRoot {
    pub plans: Vec<VultrPlan>,
}

/// A Vultr instance plan defining hardware configuration and pricing.
#[derive(Deserialize, Debug)]
pub struct VultrPlan {
    /// Plan identifier used when creating instances (e.g. `"vc2-1c-1gb"`).
    pub id: String,
    /// Number of virtual CPUs.
    pub vcpu_count: u8,
    /// RAM in megabytes.
    pub ram: u32,
    /// Disk size in gigabytes.
    pub disk: f32,
    /// Monthly bandwidth allowance in gigabytes.
    pub bandwidth: f32,
    /// Monthly price in USD.
    pub monthly_cost: f32,
    /// Plan category (e.g. `"vc2"`, `"vhf"`).
    #[serde(rename = "type")]
    pub plan_type: String,
    /// Region IDs where this plan is available.
    pub locations: Vec<String>,
}

#[derive(Deserialize, Debug)]
pub struct VultrOSRoot {
    pub os: Vec<VultrOS>,
}

/// An operating system image available for Vultr instances.
#[derive(Deserialize, Debug)]
pub struct VultrOS {
    /// Numeric OS ID used when creating instances.
    pub id: u32,
    /// Human-readable OS name (e.g. `"Ubuntu 22.04 LTS x64"`).
    pub name: String,
    /// CPU architecture (e.g. `"x64"`).
    pub arch: String,
    /// OS family (e.g. `"ubuntu"`).
    pub family: String,
}

#[derive(Deserialize, Debug)]
pub struct VultrSSHKeyRoot {
    pub ssh_key: VultrSSHKey,
}

#[derive(Deserialize, Debug)]
pub struct VultrSSHKeysRoot {
    pub ssh_keys: Vec<VultrSSHKey>,
}

/// An SSH public key stored in a Vultr account.
#[derive(Deserialize, Debug)]
pub struct VultrSSHKey {
    /// Unique identifier for this SSH key.
    pub id: String,
    /// ISO 8601 date when the key was added.
    pub date_created: String,
    /// User-supplied label for this key.
    pub name: String,
    /// The SSH public key string.
    pub ssh_key: String,
}

#[derive(Deserialize, Debug)]
pub struct VultrInstanceRoot {
    pub instance: VultrInstance,
}

#[derive(Deserialize, Debug)]
pub struct VultrInstancesRoot {
    pub instances: Vec<VultrInstance>,
}

/// A deployed Vultr compute instance.
#[derive(Deserialize, Debug)]
pub struct VultrInstance {
    /// Unique instance ID.
    pub id: String,
    /// Operating system name.
    pub os: String,
    /// RAM in megabytes.
    pub ram: f32,
    /// Disk size in gigabytes.
    pub disk: f32,
    /// Primary IPv4 address.
    pub main_ip: String,
    /// Number of virtual CPUs.
    pub vcpu_count: u32,
    /// Region ID where this instance is deployed.
    pub region: String,
    /// Plan ID for this instance.
    pub plan: String,
    /// ISO 8601 creation date.
    pub date_created: String,
    /// Provisioning status (e.g. `"active"`).
    pub status: String,
    /// Monthly bandwidth allowance in gigabytes.
    pub allowed_bandwidth: f32,
    /// IPv4 netmask.
    pub netmask_v4: String,
    /// IPv4 default gateway.
    pub gateway_v4: String,
    /// Power state of the instance (e.g. `"running"`).
    pub power_status: String,
    /// Server health status (e.g. `"ok"`).
    pub server_status: String,
    /// IPv6 network address.
    pub v6_network: String,
    /// Primary IPv6 address.
    pub v6_main_ip: String,
    /// IPv6 network prefix length.
    pub v6_network_size: u64,
    /// User-supplied label.
    pub label: String,
    /// Private network IP address.
    pub internal_ip: String,
    /// URL to the KVM console for this instance.
    pub kvm: String,
    /// Hostname of the instance.
    pub hostname: String,
    /// Numeric OS ID.
    pub os_id: u32,
    /// Marketplace application ID, or `0` if not applicable.
    pub app_id: u32,
    /// Custom image ID, or empty string if not applicable.
    pub image_id: String,
    /// ID of the attached firewall group, or empty string if none.
    pub firewall_group_id: String,
    /// Enabled features on this instance.
    pub features: Vec<String>,
    /// User-supplied tags.
    pub tags: Vec<String>,
    /// Linux user scheme used for login (`"root"` or `"limited"`).
    pub user_scheme: String,
}