aboutsummaryrefslogtreecommitdiff
path: root/src/colony.rs
blob: 2657fefac33986ff7d3f78c285661042d4e63c0a (plain) (blame)
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
/*!
 * A Colony is cloud-init data that can be used to set up a new planet
 **/

/*
 * Colonies basically need to store things like any files that need to be created in the VM and 
 * users that should be added. This needs to be serialized into a cloud-init document that can then
 * (somehow) be thrown into QEMU
 */

use serde::{Deserialize, Serialize};
use ulid::Ulid;

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Colony {
    pub user_data: UserData,
    pub meta_data: MetaData,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UserData {
    pub users: Vec<User>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct User {
    pub name: String,
    pub groups: Vec<String>,
    pub ssh_authorized_keys: Vec<String>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct MetaData {
    #[serde(rename = "instance-id")]
    pub instance_id: Ulid,
    #[serde(rename = "local-hostname")]
    pub hostname: String
}