#![allow(warnings)]
use serde_tuple::Deserialize_tuple;
use zbus::proxy;
use zbus::zvariant::Type;
use crate::dbus::zbus_machine::MachineProxy;
#[derive(Deserialize_tuple, PartialEq, Eq, Debug, Type)]
pub struct ListedMachine {
pub name: String,
pub class: String,
pub service: String,
pub path: zbus::zvariant::OwnedObjectPath,
}
#[proxy(
interface = "org.freedesktop.machine1.Manager",
default_service = "org.freedesktop.machine1",
default_path = "/org/freedesktop/machine1"
)]
pub trait Manager {
fn bind_mount_machine(
&self,
name: &str,
source: &str,
destination: &str,
read_only: bool,
mkdir: bool,
) -> zbus::Result<()>;
fn clean_pool(&self, mode: &str) -> zbus::Result<Vec<(String, u64)>>;
fn clone_image(&self, name: &str, new_name: &str, read_only: bool) -> zbus::Result<()>;
fn copy_from_machine(&self, name: &str, source: &str, destination: &str) -> zbus::Result<()>;
fn copy_from_machine_with_flags(
&self,
name: &str,
source: &str,
destination: &str,
flags: u64,
) -> zbus::Result<()>;
fn copy_to_machine(&self, name: &str, source: &str, destination: &str) -> zbus::Result<()>;
fn copy_to_machine_with_flags(
&self,
name: &str,
source: &str,
destination: &str,
flags: u64,
) -> zbus::Result<()>;
#[allow(clippy::too_many_arguments)]
fn create_machine(
&self,
name: &str,
id: &[u8],
service: &str,
class: &str,
leader: u32,
root_directory: &str,
scope_properties: &[&(&str, &zbus::zvariant::Value<'_>)],
) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
#[allow(clippy::too_many_arguments)]
fn create_machine_with_network(
&self,
name: &str,
id: &[u8],
service: &str,
class: &str,
leader: u32,
root_directory: &str,
ifindices: &[i32],
scope_properties: &[&(&str, &zbus::zvariant::Value<'_>)],
) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
fn get_image(&self, name: &str) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
fn get_image_hostname(&self, name: &str) -> zbus::Result<String>;
#[zbus(name = "GetImageMachineID")]
fn get_image_machine_id(&self, name: &str) -> zbus::Result<Vec<u8>>;
fn get_image_machine_info(
&self,
name: &str,
) -> zbus::Result<std::collections::HashMap<String, String>>;
#[zbus(name = "GetImageOSRelease")]
fn get_image_osrelease(
&self,
name: &str,
) -> zbus::Result<std::collections::HashMap<String, String>>;
#[zbus(object = "Machine")]
fn get_machine(&self, name: &str) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
fn get_machine_addresses(&self, name: &str) -> zbus::Result<Vec<(i32, Vec<u8>)>>;
#[zbus(name = "GetMachineByPID", object = "Machine")]
fn get_machine_by_pid(&self, pid: u32) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
#[zbus(name = "GetMachineOSRelease")]
fn get_machine_osrelease(
&self,
name: &str,
) -> zbus::Result<std::collections::HashMap<String, String>>;
#[zbus(name = "GetMachineUIDShift")]
fn get_machine_uidshift(&self, name: &str) -> zbus::Result<u32>;
fn kill_machine(&self, name: &str, who: &str, signal: i32) -> zbus::Result<()>;
fn list_images(
&self,
) -> zbus::Result<
Vec<(
String,
String,
bool,
u64,
u64,
u64,
zbus::zvariant::OwnedObjectPath,
)>,
>;
fn list_machines(&self) -> zbus::Result<Vec<ListedMachine>>;
fn map_from_machine_group(&self, name: &str, gid_inner: u32) -> zbus::Result<u32>;
fn map_from_machine_user(&self, name: &str, uid_inner: u32) -> zbus::Result<u32>;
fn map_to_machine_group(
&self,
gid_outer: u32,
) -> zbus::Result<(String, zbus::zvariant::OwnedObjectPath, u32)>;
fn map_to_machine_user(
&self,
uid_outer: u32,
) -> zbus::Result<(String, zbus::zvariant::OwnedObjectPath, u32)>;
fn mark_image_read_only(&self, name: &str, read_only: bool) -> zbus::Result<()>;
fn open_machine_login(&self, name: &str) -> zbus::Result<(zbus::zvariant::OwnedFd, String)>;
#[zbus(name = "OpenMachinePTY")]
fn open_machine_pty(&self, name: &str) -> zbus::Result<(zbus::zvariant::OwnedFd, String)>;
fn open_machine_root_directory(&self, name: &str) -> zbus::Result<zbus::zvariant::OwnedFd>;
#[allow(clippy::too_many_arguments)]
fn open_machine_shell(
&self,
name: &str,
user: &str,
path: &str,
args: &[&str],
environment: &[&str],
) -> zbus::Result<(zbus::zvariant::OwnedFd, String)>;
#[allow(clippy::too_many_arguments)]
fn register_machine(
&self,
name: &str,
id: &[u8],
service: &str,
class: &str,
leader: u32,
root_directory: &str,
) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
#[allow(clippy::too_many_arguments)]
fn register_machine_with_network(
&self,
name: &str,
id: &[u8],
service: &str,
class: &str,
leader: u32,
root_directory: &str,
ifindices: &[i32],
) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
fn remove_image(&self, name: &str) -> zbus::Result<()>;
fn rename_image(&self, name: &str, new_name: &str) -> zbus::Result<()>;
fn set_image_limit(&self, name: &str, size: u64) -> zbus::Result<()>;
fn set_pool_limit(&self, size: u64) -> zbus::Result<()>;
fn terminate_machine(&self, id: &str) -> zbus::Result<()>;
fn unregister_machine(&self, name: &str) -> zbus::Result<()>;
#[zbus(signal)]
fn machine_new(&self, machine: &str, path: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>;
#[zbus(signal)]
fn machine_removed(
&self,
machine: &str,
path: zbus::zvariant::ObjectPath<'_>,
) -> zbus::Result<()>;
#[zbus(property)]
fn pool_limit(&self) -> zbus::Result<u64>;
#[zbus(property)]
fn pool_path(&self) -> zbus::Result<String>;
#[zbus(property)]
fn pool_usage(&self) -> zbus::Result<u64>;
}