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 a929236..23b33ef 100644 (file)
@@ -24,10 +24,7 @@ __PACKAGE__->register_method({
        items => {
            type => "object",
            properties => { 
-               name => {
-                   description => "Security group name.",
-                   type => 'string',
-               },
+               name => get_standard_option('pve-security-group-name'),
            },
        },
        links => [ { rel => 'child', href => "{name}" } ],
@@ -45,6 +42,7 @@ __PACKAGE__->register_method({
        return $res;
     }});
 
+
 __PACKAGE__->register_method ({
     subclass => "PVE::API2::Firewall::GroupRules",  
     path => '{group}',
index d9ba2f4..4837880 100644 (file)
@@ -302,14 +302,11 @@ package PVE::API2::Firewall::GroupRules;
 
 use strict;
 use warnings;
+use PVE::JSONSchema qw(get_standard_option);
 
 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;
index 1438125..4375f9c 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\-\_]+',
-    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;