X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FAPIClient%2FCommands%2FGuestStatus.pm;h=8ae6c757c601c161b4e7b8f0506ba2a5e38426fd;hb=9305b2c986b8743013b522cb22c8bfaec351d315;hp=57784e58b17400ab66a434cb900c6f1c9d0b4c75;hpb=c9138c03bcb92d01e8c7d9f195ac2f9b4d5458b3;p=pve-client.git diff --git a/PVE/APIClient/Commands/GuestStatus.pm b/PVE/APIClient/Commands/GuestStatus.pm index 57784e5..8ae6c75 100644 --- a/PVE/APIClient/Commands/GuestStatus.pm +++ b/PVE/APIClient/Commands/GuestStatus.pm @@ -61,6 +61,12 @@ __PACKAGE__->register_method ({ properties => { remote => get_standard_option('pveclient-remote-name'), vmid => get_standard_option('pve-vmid'), + timeout => { + description => "Timeout in seconds", + type => 'integer', + minimum => 1, + optional => 1, + }, }, }, returns => { type => 'null'}, @@ -75,6 +81,89 @@ __PACKAGE__->register_method ({ return undef; }}); +__PACKAGE__->register_method ({ + name => 'shutdown', + path => 'shutdown', + method => 'POST', + description => "Stop a guest (VM/Container).", + parameters => { + additionalProperties => 0, + properties => { + remote => get_standard_option('pveclient-remote-name'), + vmid => get_standard_option('pve-vmid'), + force => { + description => "Make sure the Container/VM stops.", + type => 'boolean', + optional => 1, + }, + timeout => { + description => "Timeout in seconds", + type => 'integer', + minimum => 1, + optional => 1, + }, + }, + }, + returns => { type => 'null'}, + code => sub { + my ($param) = @_; + + my $remote = PVE::APIClient::Tools::extract_param($param, 'remote'); + my $vmid = PVE::APIClient::Tools::extract_param($param, 'vmid'); + + $guest_status_command->($remote, $vmid, 'shutdown', $param); + + return undef; + }}); + +__PACKAGE__->register_method ({ + name => 'suspend', + path => 'suspend', + method => 'POST', + description => "Suspend a guest VM.", + parameters => { + additionalProperties => 0, + properties => { + remote => get_standard_option('pveclient-remote-name'), + vmid => get_standard_option('pve-vmid'), + }, + }, + returns => { type => 'null'}, + code => sub { + my ($param) = @_; + + my $remote = PVE::APIClient::Tools::extract_param($param, 'remote'); + my $vmid = PVE::APIClient::Tools::extract_param($param, 'vmid'); + + $guest_status_command->($remote, $vmid, 'suspend', $param); + + return undef; + }}); + +__PACKAGE__->register_method ({ + name => 'resume', + path => 'resume', + method => 'POST', + description => "Resume a guest VM.", + parameters => { + additionalProperties => 0, + properties => { + remote => get_standard_option('pveclient-remote-name'), + vmid => get_standard_option('pve-vmid'), + }, + }, + returns => { type => 'null'}, + code => sub { + my ($param) = @_; + + my $remote = PVE::APIClient::Tools::extract_param($param, 'remote'); + my $vmid = PVE::APIClient::Tools::extract_param($param, 'vmid'); + + $guest_status_command->($remote, $vmid, 'resume', $param); + + return undef; + }}); + __PACKAGE__->register_method ({ name => 'spice', path => 'spice',