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 241585b..6a07fd0 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',
@@ -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',
@@ -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',
@@ -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',
@@ -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',
@@ -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',
index 78fe63e..fbcb6d3 100644 (file)
@@ -1,4 +1,5 @@
 LIB_SOURCES=                   \
+       Cluster.pm              \
        Host.pm                 \
        VM.pm                   \
        Groups.pm