use PVE::JSONSchema qw(get_standard_option);
use PVE::Firewall;
-
+use PVE::API2::Firewall::Rules;
use Data::Dumper; # fixme: remove
path => '',
method => 'GET',
description => "List security groups.",
- proxyto => 'node',
parameters => {
additionalProperties => 0,
- properties => {
- node => get_standard_option('pve-node'),
- },
},
returns => {
type => 'array',
items => {
type => "object",
- properties => {},
+ properties => {
+ name => {
+ description => "Security group name.",
+ type => 'string',
+ },
+ },
},
links => [ { rel => 'child', href => "{name}" } ],
},
code => sub {
my ($param) = @_;
- my $groups_conf = PVE::Firewall::load_security_groups();
+ my $cluster_conf = PVE::Firewall::load_clusterfw_conf();
my $res = [];
- foreach my $group (keys %{$groups_conf->{rules}}) {
- push @$res, { name => $group };
+ foreach my $group (keys %{$cluster_conf->{groups}}) {
+ push @$res, { name => $group, count => scalar(@{$cluster_conf->{groups}->{$group}}) };
}
return $res;
}});
+__PACKAGE__->register_method ({
+ subclass => "PVE::API2::Firewall::GroupRules",
+ path => '{group}',
+});
+
1;