]> git.proxmox.com Git - pve-firewall.git/commitdiff
start cluster wide firewall API
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 1 Apr 2014 08:25:25 +0000 (10:25 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 1 Apr 2014 08:25:25 +0000 (10:25 +0200)
src/PVE/API2/Firewall/Cluster.pm [new file with mode: 0644]
src/PVE/API2/Firewall/Groups.pm
src/PVE/API2/Firewall/Makefile

diff --git a/src/PVE/API2/Firewall/Cluster.pm b/src/PVE/API2/Firewall/Cluster.pm
new file mode 100644 (file)
index 0000000..2296baa
--- /dev/null
@@ -0,0 +1,47 @@
+package PVE::API2::Firewall::Cluster;
+
+use strict;
+use warnings;
+use PVE::JSONSchema qw(get_standard_option);
+
+use PVE::Firewall;
+use PVE::API2::Firewall::Groups;
+
+use Data::Dumper; # fixme: remove
+
+use base qw(PVE::RESTHandler);
+
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::Firewall::Groups",  
+    path => 'groups',
+});
+
+__PACKAGE__->register_method({
+    name => 'index',
+    path => '',
+    method => 'GET',
+    permissions => { user => 'all' },
+    description => "Directory index.",
+    parameters => {
+       additionalProperties => 0,
+    },
+    returns => {
+       type => 'array',
+       items => {
+           type => "object",
+           properties => {},
+       },
+       links => [ { rel => 'child', href => "{name}" } ],
+    },
+    code => sub {
+       my ($param) = @_;
+
+       my $result = [
+           { name => 'rules' },
+           { name => 'options' },
+           { name => 'groups' },
+           { name => 'netgroups' },
+           ];
+
+       return $result;
+    }});
index 241585b9d9baf020e3a28ca248af3b7a49c5ed90..6a07fd09d1a294c96deff43075ad937d4feab9d2 100644 (file)
@@ -16,12 +16,8 @@ __PACKAGE__->register_method({
     path => '',
     method => 'GET',
     description => "List security groups.",
     path => '',
     method => 'GET',
     description => "List security groups.",
-    proxyto => 'node',
     parameters => {
        additionalProperties => 0,
     parameters => {
        additionalProperties => 0,
-       properties => {
-           node => get_standard_option('pve-node'),
-       },
     },
     returns => {
        type => 'array',
     },
     returns => {
        type => 'array',
@@ -54,11 +50,9 @@ __PACKAGE__->register_method({
     path => '{group}',
     method => 'GET',
     description => "List security groups rules.",
     path => '{group}',
     method => 'GET',
     description => "List security groups rules.",
-    proxyto => 'node',
     parameters => {
        additionalProperties => 0,
        properties => {
     parameters => {
        additionalProperties => 0,
        properties => {
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
            group => {
                description => "Security group name.",
                type => 'string',
@@ -102,11 +96,9 @@ __PACKAGE__->register_method({
     path => '{group}/{pos}',
     method => 'GET',
     description => "Get single rule data.",
     path => '{group}/{pos}',
     method => 'GET',
     description => "Get single rule data.",
-    proxyto => 'node',
     parameters => {
        additionalProperties => 0,
        properties => {
     parameters => {
        additionalProperties => 0,
        properties => {
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
            group => {
                description => "Security group name.",
                type => 'string',
@@ -150,12 +142,10 @@ __PACKAGE__->register_method({
     path => '{group}',
     method => 'POST',
     description => "Create new rule.",
     path => '{group}',
     method => 'POST',
     description => "Create new rule.",
-    proxyto => 'node',
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => PVE::Firewall::add_rule_properties({
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => PVE::Firewall::add_rule_properties({
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
            group => {
                description => "Security group name.",
                type => 'string',
@@ -189,12 +179,10 @@ __PACKAGE__->register_method({
     path => '{group}/{pos}',
     method => 'PUT',
     description => "Modify rule data.",
     path => '{group}/{pos}',
     method => 'PUT',
     description => "Modify rule data.",
-    proxyto => 'node',
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => PVE::Firewall::add_rule_properties({
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => PVE::Firewall::add_rule_properties({
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
            group => {
                description => "Security group name.",
                type => 'string',
@@ -250,12 +238,10 @@ __PACKAGE__->register_method({
     path => '{group}/{pos}',
     method => 'DELETE',
     description => "Delete rule.",
     path => '{group}/{pos}',
     method => 'DELETE',
     description => "Delete rule.",
-    proxyto => 'node',
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => {
     protected => 1,
     parameters => {
        additionalProperties => 0,
        properties => {
-           node => get_standard_option('pve-node'),
            group => {
                description => "Security group name.",
                type => 'string',
            group => {
                description => "Security group name.",
                type => 'string',
index 78fe63e0ff2fc3bf99b20c7ed9de22e2fb2a1e2f..fbcb6d3073852d99c1c00ab0d1ed2c71609c2889 100644 (file)
@@ -1,4 +1,5 @@
 LIB_SOURCES=                   \
 LIB_SOURCES=                   \
+       Cluster.pm              \
        Host.pm                 \
        VM.pm                   \
        Groups.pm
        Host.pm                 \
        VM.pm                   \
        Groups.pm