]> git.proxmox.com Git - pve-client.git/blame - PVE/APIClient/Commands/lxc.pm
move config related code to PVE/APIClient/Config.pm
[pve-client.git] / PVE / APIClient / Commands / lxc.pm
CommitLineData
adf285bf
DM
1package PVE::APIClient::Commands::lxc;
2
3use strict;
4use warnings;
aa570b38 5use JSON;
adf285bf 6
84ba32e5 7use PVE::Tools;
3454a319 8use PVE::JSONSchema qw(get_standard_option);
adf285bf
DM
9use PVE::CLIHandler;
10
11use base qw(PVE::CLIHandler);
3454a319 12use PVE::APIClient::Config;
84ba32e5 13
adf285bf
DM
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 => {
3454a319 22 remote => get_standard_option('pveclient-remote-name'),
adf285bf
DM
23 vmid => {
24 description => "The container ID",
25 type => 'string',
26 },
27 },
28 },
29 returns => { type => 'null'},
30 code => sub {
31 my ($param) = @_;
32
aa570b38 33 my $conn = PVE::APIClient::Config::get_remote_connection($param->{remote});
84ba32e5
DM
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});
adf285bf
DM
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 => {
3454a319 53 remote => get_standard_option('pveclient-remote-name'),
adf285bf
DM
54 },
55 },
56 returns => { type => 'null'},
57 code => sub {
58 my ($param) = @_;
59
60 die "implement me";
61
62 }});
63
64
65our $cmddef = {
84ba32e5 66 enter => [ __PACKAGE__, 'enter', ['remote', 'vmid']],
adf285bf
DM
67 list => [ __PACKAGE__, 'list', ['remote']],
68};
69
701;