X-Git-Url: https://git.proxmox.com/?p=pve-client.git;a=blobdiff_plain;f=PVE%2FAPIClient%2FCommands%2Fremote.pm;h=080934fd52450b6a81a5d6521a57d64fd0df651a;hp=b8b1465321064762474294d05d4e66c7fa258282;hb=e2ca543cee2c735ede0ee4e4dd541c4831df1d82;hpb=2d0ebe218c6945ed6c935afc6232abc841cda5b8 diff --git a/PVE/APIClient/Commands/remote.pm b/PVE/APIClient/Commands/remote.pm index b8b1465..080934f 100644 --- a/PVE/APIClient/Commands/remote.pm +++ b/PVE/APIClient/Commands/remote.pm @@ -30,6 +30,29 @@ sub read_password { return PVE::PTY::read_password("Remote password: ") } +__PACKAGE__->register_method ({ + name => 'list', + path => 'list', + method => 'GET', + description => "List remotes from your config file.", + parameters => { + additionalProperties => 0, + }, + returns => { type => 'null' }, + code => sub { + my $config = PVE::APIClient::Config->new(); + my $known_remotes = $config->remote_names; + + printf("%10s %10s %10s %10s %100s\n", "Name", "Host", "Port", "Username", "Fingerprint"); + for my $name (@$known_remotes) { + my $remote = $config->lookup_remote($name); + printf("%10s %10s %10s %10s %100s\n", $name, $remote->{'host'}, + $remote->{'port'}, $remote->{'username'}, $remote->{'fingerprint'}); + } + + return undef; + }}); + __PACKAGE__->register_method ({ name => 'add', path => 'add', @@ -114,6 +137,7 @@ __PACKAGE__->register_method ({ our $cmddef = { add => [ __PACKAGE__, 'add', ['name', 'host', 'username']], remove => [ __PACKAGE__, 'remove', ['name']], + list => [__PACKAGE__, 'list'], }; 1;