]> git.proxmox.com Git - pve-client.git/blob - PVE/APIClient/Commands/lxc.pm
move config related code to PVE/APIClient/Config.pm
[pve-client.git] / PVE / APIClient / Commands / lxc.pm
1 package PVE::APIClient::Commands::lxc;
2
3 use strict;
4 use warnings;
5 use JSON;
6
7 use PVE::Tools;
8 use PVE::JSONSchema qw(get_standard_option);
9 use PVE::CLIHandler;
10
11 use base qw(PVE::CLIHandler);
12 use PVE::APIClient::Config;
13
14 __PACKAGE__->register_method ({
15 name => 'enter',
16 path => 'enter',
17 method => 'POST',
18 description => "Enter container console.",
19 parameters => {
20 additionalProperties => 0,
21 properties => {
22 remote => get_standard_option('pveclient-remote-name'),
23 vmid => {
24 description => "The container ID",
25 type => 'string',
26 },
27 },
28 },
29 returns => { type => 'null'},
30 code => sub {
31 my ($param) = @_;
32
33 my $conn = PVE::APIClient::Config::get_remote_connection($param->{remote});
34 my $node = 'localhost'; # ??
35
36 my $api_path = "api2/json/nodes/$node/lxc/$param->{vmid}";
37
38 my $res = $conn->get($api_path, {});
39
40 print to_json($res, { pretty => 1, canonical => 1});
41 die "implement me";
42
43 }});
44
45 __PACKAGE__->register_method ({
46 name => 'list',
47 path => 'list',
48 method => 'GET',
49 description => "List containers.",
50 parameters => {
51 additionalProperties => 0,
52 properties => {
53 remote => get_standard_option('pveclient-remote-name'),
54 },
55 },
56 returns => { type => 'null'},
57 code => sub {
58 my ($param) = @_;
59
60 die "implement me";
61
62 }});
63
64
65 our $cmddef = {
66 enter => [ __PACKAGE__, 'enter', ['remote', 'vmid']],
67 list => [ __PACKAGE__, 'list', ['remote']],
68 };
69
70 1;