|
|
|
@ -18,6 +18,9 @@ use crate::{
|
|
|
|
|
MonitorCheckListResponse,
|
|
|
|
|
MonitorCheckTypesResponse,
|
|
|
|
|
MonitorContactListResponse,
|
|
|
|
|
VmStartResponse,
|
|
|
|
|
VmStopResponse,
|
|
|
|
|
VmRebootResponse,
|
|
|
|
|
},
|
|
|
|
|
types::{
|
|
|
|
|
LNError,
|
|
|
|
@ -93,6 +96,12 @@ pub enum RecordSubArgs {
|
|
|
|
|
pub enum VmSubArgs {
|
|
|
|
|
/// List all VMs on my account.
|
|
|
|
|
List(VMListRequest),
|
|
|
|
|
/// Restart a VM, given an ID.
|
|
|
|
|
Reboot(VmRebootRequest),
|
|
|
|
|
/// Stop a VM, given an ID.
|
|
|
|
|
Stop(VmStopRequest),
|
|
|
|
|
/// Turn on a VM, given an ID.
|
|
|
|
|
Start(VmStartRequest),
|
|
|
|
|
}
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug, clap::Subcommand)]
|
|
|
|
|
#[serde(untagged)]
|
|
|
|
@ -210,6 +219,9 @@ impl Args {
|
|
|
|
|
Self::Network(NetworkSubArgs::List(net_list)) => print_req(net_list)?,
|
|
|
|
|
Self::Floating(FloatingSubArgs::List(ip_list)) => print_req(ip_list)?,
|
|
|
|
|
Self::Vm(VmSubArgs::List(vm_list)) => print_req(vm_list)?,
|
|
|
|
|
Self::Vm(VmSubArgs::Start(vm_to_start)) => print_req(vm_to_start)?,
|
|
|
|
|
Self::Vm(VmSubArgs::Stop(vm_to_stop)) => print_req(vm_to_stop)?,
|
|
|
|
|
Self::Vm(VmSubArgs::Reboot(vm_to_reboot)) => print_req(vm_to_reboot)?,
|
|
|
|
|
Self::Volume(VolumeSubArgs::List(vol_list)) => print_req(vol_list)?,
|
|
|
|
|
Self::Image(ImageSubArgs::List(image_list)) => print_req(image_list)?,
|
|
|
|
|
Self::Billing(BillingSubArgs::Credit(billing_credit)) => print_req(billing_credit)?,
|
|
|
|
@ -291,3 +303,18 @@ pub struct MonitorContactListRequest {}
|
|
|
|
|
pub struct EmailUserListRequest {
|
|
|
|
|
domain_id: i32,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[lunanode_request(response="VmStartResponse", endpoint="vm/start/")]
|
|
|
|
|
pub struct VmStartRequest {
|
|
|
|
|
vm_id: String,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[lunanode_request(response="VmStopResponse", endpoint="vm/stop/")]
|
|
|
|
|
pub struct VmStopRequest {
|
|
|
|
|
vm_id: String,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[lunanode_request(response="VmRebootResponse", endpoint="vm/reboot/")]
|
|
|
|
|
pub struct VmRebootRequest {
|
|
|
|
|
vm_id: String,
|
|
|
|
|
}
|
|
|
|
|