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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#![allow(non_snake_case)]
#![allow(missing_docs)]
use chrono::{DateTime, FixedOffset};
use reqwest::Url;
use serde::Deserialize;
use super::super::common;
protocol_enum! {
#[doc = "Possible image statuses."]
enum ImageStatus {
Queued = "queued",
Saving = "saving",
Active = "active",
Killed = "killed",
Deleted = "deleted",
PendingDelete = "pending_delete",
Deactivated = "deactivated"
}
}
protocol_enum! {
#[doc = "Possible image visibility values."]
enum ImageVisibility {
Public = "public",
Community = "community",
Shared = "shared",
Private = "private"
}
}
protocol_enum! {
#[doc = "Possible container formats."]
enum ImageContainerFormat {
AMI = "ami",
ARI = "ari",
AKI = "aki",
Bare = "bare",
OVF = "ovf",
OVA = "ova",
Docker = "docker"
}
}
protocol_enum! {
#[doc = "Possible disk formats."]
enum ImageDiskFormat {
AMI = "ami",
ARI = "ari",
AKI = "aki",
VHD = "vhd",
VHDX = "vhdx",
VMDK = "vmdk",
Raw = "raw",
QCOW2 = "qcow2",
VDI = "vdi",
ISO = "iso",
Ploop = "ploop"
}
}
protocol_enum! {
#[doc = "Available sort keys."]
enum ImageSortKey {
CreatedAt = "created_at",
Id = "id",
Name = "name",
UpdatedAt = "updated_at"
}
}
impl Default for ImageSortKey {
fn default() -> ImageSortKey {
ImageSortKey::CreatedAt
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct Image {
#[serde(default)]
pub architecture: Option<String>,
#[serde(default)]
pub checksum: Option<String>,
#[serde(default)]
pub container_format: Option<ImageContainerFormat>,
pub created_at: DateTime<FixedOffset>,
#[serde(deserialize_with = "common::protocol::deser_optional_url", default)]
pub direct_url: Option<Url>,
#[serde(default)]
pub disk_format: Option<ImageDiskFormat>,
pub id: String,
#[serde(default)]
pub min_disk: u32,
#[serde(default)]
pub min_ram: u32,
pub name: String,
#[serde(default)]
pub size: Option<u64>,
pub status: ImageStatus,
pub updated_at: DateTime<FixedOffset>,
#[serde(default)]
pub virtual_size: Option<u64>,
pub visibility: ImageVisibility,
}
#[derive(Debug, Clone, Deserialize)]
pub struct ImagesRoot {
pub images: Vec<Image>,
}