]> git.proxmox.com Git - pve-firewall.git/commitdiff
define standard option for security group names
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Apr 2014 06:05:51 +0000 (08:05 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Apr 2014 06:05:51 +0000 (08:05 +0200)
src/PVE/API2/Firewall/Groups.pm
src/PVE/API2/Firewall/Rules.pm
src/PVE/Firewall.pm

index a929236357c25201e85b5df5ab7eb6af32a2bf92..23b33efa9b93bdd7e71270b36c2b66234bb27820 100644 (file)
@@ -24,10 +24,7 @@ __PACKAGE__->register_method({
        items => {
            type => "object",
            properties => { 
        items => {
            type => "object",
            properties => { 
-               name => {
-                   description => "Security group name.",
-                   type => 'string',
-               },
+               name => get_standard_option('pve-security-group-name'),
            },
        },
        links => [ { rel => 'child', href => "{name}" } ],
            },
        },
        links => [ { rel => 'child', href => "{name}" } ],
@@ -45,6 +42,7 @@ __PACKAGE__->register_method({
        return $res;
     }});
 
        return $res;
     }});
 
+
 __PACKAGE__->register_method ({
     subclass => "PVE::API2::Firewall::GroupRules",  
     path => '{group}',
 __PACKAGE__->register_method ({
     subclass => "PVE::API2::Firewall::GroupRules",  
     path => '{group}',
index d9ba2f4d6acbd0fb366bf0d3a870eb30b5830cd9..4837880974041ee55e035fa0158161065e9a4a10 100644 (file)
@@ -302,14 +302,11 @@ package PVE::API2::Firewall::GroupRules;
 
 use strict;
 use warnings;
 
 use strict;
 use warnings;
+use PVE::JSONSchema qw(get_standard_option);
 
 use base qw(PVE::API2::Firewall::RulesBase);
 
 
 use base qw(PVE::API2::Firewall::RulesBase);
 
-__PACKAGE__->additional_parameters({ group => {
-    description => "Security group name.",
-    type => 'string',
-    maxLength => 20, # fixme: what length?
-}});
+__PACKAGE__->additional_parameters({ group => get_standard_option('pve-security-group-name') });
 
 sub allow_groups {
     return 0;
 
 sub allow_groups {
     return 0;
index 1438125b4c31e298b37a9699502253d4698b6034..4375f9c14fd857df4a5c66e02442c4b9fb881dbe 100644 (file)
@@ -52,8 +52,16 @@ PVE::JSONSchema::register_standard_option('ipset-name', {
     description => "IP set name.",
     type => 'string',
     pattern => '[A-Za-z][A-Za-z0-9\-\_]+',
     description => "IP set name.",
     type => 'string',
     pattern => '[A-Za-z][A-Za-z0-9\-\_]+',
-    minLength => 2, 
-    maxLength => 20,                                             
+    minLength => 2,
+    maxLength => 20,                     
+});
+
+PVE::JSONSchema::register_standard_option('pve-security-group-name', {
+    description => "Security Group name.",
+    type => 'string',
+    pattern => '[A-Za-z][A-Za-z0-9\-\_]+',
+    minLength => 2,
+    maxLength => 20,                             
 });
 
 my $feature_ipset_nomatch = 0;
 });
 
 my $feature_ipset_nomatch = 0;