|
| 1 | +use serde::{Deserialize, Serialize}; |
| 2 | +use utoipa::ToSchema; |
| 3 | + |
| 4 | +#[derive(Serialize, Deserialize, ToSchema, Debug, Clone)] |
| 5 | +pub struct OrionVmImageResponse { |
| 6 | + pub id: String, |
| 7 | + pub digest: String, |
| 8 | + pub object_key: String, |
| 9 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 10 | + pub info_object_key: Option<String>, |
| 11 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 12 | + pub image_name: Option<String>, |
| 13 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 14 | + pub built_at: Option<String>, |
| 15 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 16 | + pub rust: Option<String>, |
| 17 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 18 | + pub buck2: Option<String>, |
| 19 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 20 | + pub python: Option<String>, |
| 21 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 22 | + pub kernel: Option<String>, |
| 23 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 24 | + pub size_bytes: Option<i64>, |
| 25 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 26 | + pub label: Option<String>, |
| 27 | + pub created_at: String, |
| 28 | +} |
| 29 | + |
| 30 | +#[derive(Serialize, Deserialize, ToSchema, Debug, Clone)] |
| 31 | +pub struct OrionVmImageListResponse { |
| 32 | + pub count: usize, |
| 33 | + pub images: Vec<OrionVmImageResponse>, |
| 34 | +} |
| 35 | + |
| 36 | +#[derive(Serialize, Deserialize, ToSchema, Debug, Clone)] |
| 37 | +pub struct RegisterOrionVmImageRequest { |
| 38 | + /// Content digest, e.g. `sha256:<hex>`. |
| 39 | + pub digest: String, |
| 40 | + /// Key under the `orion-images/` namespace, e.g. `{hex}/debian-13-buck2.qcow2`. |
| 41 | + pub object_key: String, |
| 42 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 43 | + pub info_object_key: Option<String>, |
| 44 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 45 | + pub image_name: Option<String>, |
| 46 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 47 | + pub built_at: Option<String>, |
| 48 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 49 | + pub rust: Option<String>, |
| 50 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 51 | + pub buck2: Option<String>, |
| 52 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 53 | + pub python: Option<String>, |
| 54 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 55 | + pub kernel: Option<String>, |
| 56 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 57 | + pub size_bytes: Option<i64>, |
| 58 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 59 | + pub label: Option<String>, |
| 60 | +} |
| 61 | + |
| 62 | +#[derive(Serialize, Deserialize, ToSchema, Debug, Clone)] |
| 63 | +pub struct PresignOrionVmImageRequest { |
| 64 | + /// Content digest, e.g. `sha256:<hex>`. |
| 65 | + pub digest: String, |
| 66 | + /// Base name used in the object key (default `debian-13-buck2`). |
| 67 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 68 | + pub image_name: Option<String>, |
| 69 | + /// When true, also return a PUT URL for `{hex}/image-info.json`. |
| 70 | + #[serde(default)] |
| 71 | + pub with_info: bool, |
| 72 | +} |
| 73 | + |
| 74 | +#[derive(Serialize, Deserialize, ToSchema, Debug, Clone)] |
| 75 | +pub struct PresignOrionVmImageResponse { |
| 76 | + pub object_key: String, |
| 77 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 78 | + pub info_object_key: Option<String>, |
| 79 | + pub qcow2_put_url: String, |
| 80 | + #[serde(default, skip_serializing_if = "Option::is_none")] |
| 81 | + pub info_put_url: Option<String>, |
| 82 | + pub expires_in_secs: u64, |
| 83 | +} |
0 commit comments