]> git.proxmox.com Git - pve-network.git/blame - PVE/API2/Network/SDN/Content.pm
trailing whitespace cleanup
[pve-network.git] / PVE / API2 / Network / SDN / Content.pm
CommitLineData
903e2f5e
AD
1package PVE::API2::Network::SDN::Content;
2
3use strict;
4use warnings;
5use Data::Dumper;
6
7use PVE::SafeSyslog;
8use PVE::Cluster;
9use PVE::Storage;
10use PVE::INotify;
11use PVE::Exception qw(raise_param_exc);
12use PVE::RPCEnvironment;
13use PVE::RESTHandler;
14use PVE::JSONSchema qw(get_standard_option);
15use PVE::Network::SDN;
16
17use base qw(PVE::RESTHandler);
18
19__PACKAGE__->register_method ({
7d35eaf5 20 name => 'index',
903e2f5e
AD
21 path => '',
22 method => 'GET',
23 description => "List transportzone content.",
7d35eaf5 24# permissions => {
903e2f5e
AD
25# check => ['perm', '/sdn/{sdn}', ['SDN.Audit'], any => 1],
26# },
27 protected => 1,
28 proxyto => 'node',
29 parameters => {
30 additionalProperties => 0,
7d35eaf5 31 properties => {
903e2f5e
AD
32 node => get_standard_option('pve-node'),
33 sdn => get_standard_option('pve-sdn-id', {
34 completion => \&PVE::Network::SDN::complete_sdn,
35 }),
36 },
37 },
38 returns => {
39 type => 'array',
40 items => {
41 type => "object",
7d35eaf5 42 properties => {
903e2f5e
AD
43 vnet => {
44 description => "Vnet identifier.",
45 type => 'string',
46 },
47 status => {
48 description => "Status.",
49 type => 'string',
50 optional => 1,
51 },
52 },
53 },
54 links => [ { rel => 'child', href => "{vnet}" } ],
55 },
56 code => sub {
57 my ($param) = @_;
58
59 my $rpcenv = PVE::RPCEnvironment::get();
60
61 my $authuser = $rpcenv->get_user();
62
63 my $transportid = $param->{sdn};
64
65 my $res = [];
66
67 my ($transport_status, $vnet_status) = PVE::Network::SDN::status();
68
69 foreach my $id (keys %{$vnet_status}) {
70 if ($vnet_status->{$id}->{transportzone} eq $transportid) {
71 my $item->{vnet} = $id;
72 $item->{status} = $vnet_status->{$id}->{'status'};
73 push @$res,$item;
74 }
75 }
76
7d35eaf5 77 return $res;
903e2f5e
AD
78 }});
79
801;