]> git.proxmox.com Git - pve-firewall.git/blobdiff - src/PVE/API2/Firewall/Groups.pm
start cluster wide firewall API
[pve-firewall.git] / src / PVE / API2 / Firewall / Groups.pm
index 4ea2f77eff66f85dca1ebb04c194e7d04825eb90..6a07fd09d1a294c96deff43075ad937d4feab9d2 100644 (file)
@@ -16,12 +16,8 @@ __PACKAGE__->register_method({
     path => '',
     method => 'GET',
     description => "List security groups.",
-    proxyto => 'node',
     parameters => {
        additionalProperties => 0,
-       properties => {
-           node => get_standard_option('pve-node'),
-       },
     },
     returns => {
        type => 'array',
@@ -42,8 +38,8 @@ __PACKAGE__->register_method({
        my $cluster_conf = PVE::Firewall::load_clusterfw_conf();
 
        my $res = [];
-       foreach my $group (keys %{$cluster_conf->{rules}}) {
-           push @$res, { name => $group, count => scalar(@{$cluster_conf->{rules}->{$group}}) };
+       foreach my $group (keys %{$cluster_conf->{groups}}) {
+           push @$res, { name => $group, count => scalar(@{$cluster_conf->{groups}->{$group}}) };
        }
 
        return $res;
@@ -54,11 +50,9 @@ __PACKAGE__->register_method({
     path => '{group}',
     method => 'GET',
     description => "List security groups rules.",
-    proxyto => 'node',
     parameters => {
        additionalProperties => 0,
        properties => {
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
@@ -82,7 +76,7 @@ __PACKAGE__->register_method({
 
        my $cluster_conf = PVE::Firewall::load_clusterfw_conf();
 
-       my $rules = $cluster_conf->{rules}->{$param->{group}};
+       my $rules = $cluster_conf->{groups}->{$param->{group}};
        die "no such security group\n" if !defined($rules);
 
        my $digest = $cluster_conf->{digest};
@@ -102,11 +96,9 @@ __PACKAGE__->register_method({
     path => '{group}/{pos}',
     method => 'GET',
     description => "Get single rule data.",
-    proxyto => 'node',
     parameters => {
        additionalProperties => 0,
        properties => {
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
@@ -131,7 +123,7 @@ __PACKAGE__->register_method({
 
        my $cluster_conf = PVE::Firewall::load_clusterfw_conf();
 
-       my $rules = $cluster_conf->{rules}->{$param->{group}};
+       my $rules = $cluster_conf->{groups}->{$param->{group}};
        die "no such security group\n" if !defined($rules);
 
        my $digest = $cluster_conf->{digest};
@@ -150,12 +142,10 @@ __PACKAGE__->register_method({
     path => '{group}',
     method => 'POST',
     description => "Create new rule.",
-    proxyto => 'node',
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => PVE::Firewall::add_rule_properties({
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
@@ -168,7 +158,7 @@ __PACKAGE__->register_method({
 
        my $cluster_conf = PVE::Firewall::load_clusterfw_conf();
 
-       my $rules = $cluster_conf->{rules}->{$param->{group}};
+       my $rules = $cluster_conf->{groups}->{$param->{group}};
        die "no such security group\n" if !defined($rules);
 
        my $digest = $cluster_conf->{digest};
@@ -189,12 +179,10 @@ __PACKAGE__->register_method({
     path => '{group}/{pos}',
     method => 'PUT',
     description => "Modify rule data.",
-    proxyto => 'node',
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => PVE::Firewall::add_rule_properties({
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
@@ -213,7 +201,7 @@ __PACKAGE__->register_method({
 
        my $cluster_conf = PVE::Firewall::load_clusterfw_conf();
 
-       my $rules = $cluster_conf->{rules}->{$param->{group}};
+       my $rules = $cluster_conf->{groups}->{$param->{group}};
        die "no such security group\n" if !defined($rules);
 
        my $digest = $cluster_conf->{digest};
@@ -235,7 +223,7 @@ __PACKAGE__->register_method({
            }
            push @$newrules, $rule if $moveto >= scalar(@$rules);
 
-           $cluster_conf->{rules}->{$param->{group}} = $newrules;
+           $cluster_conf->{groups}->{$param->{group}} = $newrules;
        } else {
            PVE::Firewall::copy_rule_data($rule, $param);
        }
@@ -250,12 +238,10 @@ __PACKAGE__->register_method({
     path => '{group}/{pos}',
     method => 'DELETE',
     description => "Delete rule.",
-    proxyto => 'node',
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => {
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
@@ -273,7 +259,7 @@ __PACKAGE__->register_method({
 
        my $cluster_conf = PVE::Firewall::load_clusterfw_conf();
 
-       my $rules = $cluster_conf->{rules}->{$param->{group}};
+       my $rules = $cluster_conf->{groups}->{$param->{group}};
        die "no such security group\n" if !defined($rules);
 
        my $digest = $cluster_conf->{digest};