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
use std::fmt;
use std::borrow::Cow;
use response::region::Region;
use response::NamedResponse;
use response;
#[derive(Deserialize, Debug)]
pub struct Action {
id: f64,
status: String,
#[serde(rename="type")]
action_type: String,
started_at: String,
completed_at: String,
resource_id: f64,
resource_type: String,
region: Region,
region_slug: Option<String>
}
impl response::NotArray for Action {}
impl fmt::Display for Action {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "ID: {}\n\
Status: {}\n\
Type: {}\n\
Started At: {}\n\
Completed At: {}\n\
Resource ID: {}\n\
Resource Type: {}\n\
Region Slug: {}\n\
Region:\n\t{}",
self.id,
self.status,
self.action_type,
self.started_at,
self.completed_at,
self.resource_id,
self.resource_type,
if self.region_slug.is_some() { self.region_slug.clone().unwrap() } else { "None".to_owned() },
self.region.to_string().replace("\n", "\n\t"))
}
}
pub type Actions = Vec<Action>;
impl NamedResponse for Action {
fn name<'a>() -> Cow<'a, str> {
"action".into()
}
}