X-Git-Url: https://git.proxmox.com/?p=pve-firewall.git;a=blobdiff_plain;f=src%2FPVE%2FAPI2%2FFirewall%2FIPSet.pm;h=71f6b4c913af1066f3d93b7853f5709598478c68;hp=c9372fac138ab4b5beff39eaf30cb54b20ff7f03;hb=bc374ca7cfd083a665f07b8902d63754c8c2a6a6;hpb=76aad6c578798e0fe2a51cd18f423df37848dee7 diff --git a/src/PVE/API2/Firewall/IPSet.pm b/src/PVE/API2/Firewall/IPSet.pm index c9372fa..71f6b4c 100644 --- a/src/PVE/API2/Firewall/IPSet.pm +++ b/src/PVE/API2/Firewall/IPSet.pm @@ -355,6 +355,11 @@ sub register_create { description => "IP set name.", type => 'string', }, + rename => { + description => "Rename an existing IPSet.", + type => 'string', + optional => 1, + }, } }, returns => { type => 'null' }, @@ -368,7 +373,15 @@ sub register_create { if $name eq $param->{name}; } - $fw_conf->{ipset}->{$param->{name}} = []; + if ($param->{rename}) { + raise_param_exc({ name => "IPSet '$param->{rename}' does not exists" }) + if !$fw_conf->{ipset}->{$param->{rename}}; + my $data = delete $fw_conf->{ipset}->{$param->{rename}}; + $fw_conf->{ipset}->{$param->{name}} = $data; + } else { + $fw_conf->{ipset}->{$param->{name}} = []; + } + $class->save_config($fw_conf); return undef;