Skip to main content

incus_client/models/
instance_state.rs

1/*
2 * Incus external REST API
3 *
4 * This is the REST API used by all Incus clients. Internal endpoints aren't included in this documentation.  The Incus API is available over both a local unix+http and remote https API. Authentication for local users relies on group membership and access to the unix socket. For remote users, the default authentication method is TLS client certificates.
5 *
6 * The version of the OpenAPI document: 1.0
7 * Contact: lxc-devel@lists.linuxcontainers.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct InstanceState {
16    #[serde(rename = "cpu", skip_serializing_if = "Option::is_none")]
17    pub cpu: Option<Box<models::InstanceStateCpu>>,
18    /// Disk usage key/value pairs
19    #[serde(rename = "disk", skip_serializing_if = "Option::is_none")]
20    pub disk: Option<std::collections::HashMap<String, models::InstanceStateDisk>>,
21    #[serde(rename = "memory", skip_serializing_if = "Option::is_none")]
22    pub memory: Option<Box<models::InstanceStateMemory>>,
23    /// Network usage key/value pairs
24    #[serde(rename = "network", skip_serializing_if = "Option::is_none")]
25    pub network: Option<std::collections::HashMap<String, models::InstanceStateNetwork>>,
26    #[serde(rename = "os_info", skip_serializing_if = "Option::is_none")]
27    pub os_info: Option<Box<models::InstanceStateOsInfo>>,
28    /// PID of the runtime
29    #[serde(rename = "pid", skip_serializing_if = "Option::is_none")]
30    pub pid: Option<i64>,
31    /// Number of processes in the instance
32    #[serde(rename = "processes", skip_serializing_if = "Option::is_none")]
33    pub processes: Option<i64>,
34    /// The time that the instance started at  API extension: instance_state_started_at.
35    #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")]
36    pub started_at: Option<chrono::DateTime<chrono::FixedOffset>>,
37    /// Current status (Running, Stopped, Frozen or Error)
38    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
39    pub status: Option<String>,
40    #[serde(rename = "status_code", skip_serializing_if = "Option::is_none")]
41    pub status_code: Option<i64>,
42}
43
44impl InstanceState {
45    pub fn new() -> InstanceState {
46        InstanceState {
47            cpu: None,
48            disk: None,
49            memory: None,
50            network: None,
51            os_info: None,
52            pid: None,
53            processes: None,
54            started_at: None,
55            status: None,
56            status_code: None,
57        }
58    }
59}
60