1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Hetzner Cloud API
*
* Copied from the official API documentation for the Public Hetzner Cloud.
*
* The version of the OpenAPI document: 0.28.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// Action : Actions show the results and progress of asynchronous requests to the API.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Action {
/// Command executed in the Action.
#[serde(rename = "command")]
pub command: String,
/// Error message for the Action if an error occurred, otherwise null.
#[serde(rename = "error", deserialize_with = "Option::deserialize")]
pub error: Option<Box<models::Error>>,
/// Point in time when the Action was finished (in ISO-8601 format). Only set if the Action is finished otherwise null.
#[serde(rename = "finished", deserialize_with = "Option::deserialize")]
pub finished: Option<String>,
/// ID of the Action.
#[serde(rename = "id")]
pub id: i64,
/// Progress of the Action in percent.
#[serde(rename = "progress")]
pub progress: i32,
/// Resources the Action relates to.
#[serde(rename = "resources")]
pub resources: Vec<models::Resource>,
/// Point in time when the Action was started (in ISO-8601 format).
#[serde(rename = "started")]
pub started: String,
/// Status of the Action.
#[serde(rename = "status")]
pub status: Status,
}
impl Action {
/// Actions show the results and progress of asynchronous requests to the API.
pub fn new(
command: String,
error: Option<models::Error>,
finished: Option<String>,
id: i64,
progress: i32,
resources: Vec<models::Resource>,
started: String,
status: Status,
) -> Action {
Action {
command,
error: error.map(Box::new),
finished,
id,
progress,
resources,
started,
status,
}
}
}
/// Status of the Action.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "error")]
Error,
#[serde(rename = "running")]
Running,
#[serde(rename = "success")]
Success,
}
impl Default for Status {
fn default() -> Status {
Self::Error
}
}