description => "Network/IP specification in CIDR format.",
type => 'string', format => 'IPv4orCIDR',
},
- name => {
- description => "IP set name.",
- type => 'string',
- },
+ name => get_standard_option('ipset-name'),
comment => {
type => 'string',
optional => 1,
use strict;
use warnings;
-use PVE::Firewall;
+use PVE::JSONSchema qw(get_standard_option);
use PVE::Exception qw(raise_param_exc);
+use PVE::Firewall;
use base qw(PVE::RESTHandler);
items => {
type => "object",
properties => {
- name => {
- description => "IPSet name.",
- type => 'string',
- },
+ name => get_standard_option('ipset-name'),
},
},
links => [ { rel => 'child', href => "{name}" } ],
parameters => {
additionalProperties => 0,
properties => {
- name => {
- # fixme: verify format
- description => "IP set name.",
- type => 'string',
- },
- rename => {
+ name => get_standard_option('ipset-name'),
+ rename => get_standard_option('ipset-name', {
description => "Rename an existing IPSet.",
- type => 'string',
optional => 1,
- },
+ }),
}
},
returns => { type => 'null' },
parameters => {
additionalProperties => 0,
properties => {
- name => {
- # fixme: verify format
- description => "IP set name.",
- type => 'string',
- },
+ name => get_standard_option('ipset-name'),
}
},
returns => { type => 'null' },
use Digest::SHA;
use PVE::INotify;
use PVE::Exception qw(raise raise_param_exc);
-use PVE::JSONSchema qw(get_standard_option);
+use PVE::JSONSchema qw(register_standard_option get_standard_option);
use PVE::Cluster;
use PVE::ProcFSTools;
use PVE::Tools qw($IPV4RE);
die "value does not look like a valid IP address or CIDR network\n";
}
+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,
+});
my $feature_ipset_nomatch = 0;
eval {