]>
git.proxmox.com Git - pve-client.git/blob - PVE/APIClient/Commands/list.pm
10a8f7c5afd0831b994d17c2966aefc8e4693dea
1 package PVE
::APIClient
::Commands
::list
;
7 use PVE
::APIClient
::JSONSchema
qw(get_standard_option);
9 use PVE
::APIClient
::Helpers
;
10 use PVE
::APIClient
::Config
;
11 use PVE
::APIClient
::CLIHandler
;
13 use base
qw(PVE::APIClient::CLIHandler);
15 # define as array to keep ordering
16 my $list_returns_properties = [
17 'vmid' => get_standard_option
('pve-vmid'),
18 'node' => get_standard_option
('pve-node'),
19 'type' => { type
=> 'string' },
20 'status' => { type
=> 'string' },
21 'name' => { type
=> 'string', optional
=> 1 },
24 __PACKAGE__-
>register_method ({
28 description
=> "List containers.",
30 additionalProperties
=> 0,
32 remote
=> get_standard_option
('pveclient-remote-name'),
33 'format' => get_standard_option
('pve-output-format'),
40 properties
=> { @$list_returns_properties },
46 my $format = PVE
::APIClient
::Tools
::extract_param
($param, 'format');
47 PVE
::APIClient
::Helpers
::set_output_format
($format);
49 my $config = PVE
::APIClient
::Config-
>load();
50 my $conn = PVE
::APIClient
::Config-
>remote_conn($config, $param->{remote
});
52 return $conn->get('api2/json/cluster/resources', { type
=> 'vm' });
56 our $cmddef = [ __PACKAGE__
, 'list', ['remote'], {}, sub {
57 PVE
::APIClient
::Helpers
::print_ordered_result
($list_returns_properties, @_);