[pve-devel] applied: [PATCH v2 firewall 1/2] Fix #1971: display firewall rule properties

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Nov 14 11:01:20 CET 2018


On 11/12/18 3:14 PM, Rhonda D'Vine wrote:
> This is the list of the properties that should get returned in the
> pretty print format, too, not just in yaml/json output.
> 
> Signed-off-by: Rhonda D'Vine <rhonda at proxmox.com>
> ---
>  src/PVE/API2/Firewall/Rules.pm | 48 +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/API2/Firewall/Rules.pm b/src/PVE/API2/Firewall/Rules.pm
> index 1aa6d27..b2a81a1 100644
> --- a/src/PVE/API2/Firewall/Rules.pm
> +++ b/src/PVE/API2/Firewall/Rules.pm
> @@ -122,9 +122,55 @@ sub register_get_rule {
>  	returns => {
>  	    type => "object",
>  	    properties => {
> +		action => {
> +		    type => 'string',
> +		},
> +		comment => {
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		dest => {
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		dport => {
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		enable => {
> +		    type => 'integer',
> +		    optional => 1,
> +		},
> +		iface => {
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		ipversion => {
> +		    type => 'integer',
> +		    optional => 1,
> +		},
> +		macro => {
> +		    type => 'integer',
> +		    optional => 1,
> +		},
>  		pos => {
>  		    type => 'integer',
> -		}
> +		},
> +		proto => {
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		source => {
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		sport => {
> +		    type => 'string',
> +		    optional => 1,
> +		},
> +		type => {
> +		    type => 'string',
> +		},
>  	    },
>  	},
>  	code => sub {
> 

applied, thanks!

There's a bit of available information which could be still added e.g.,
expected ranges for integers, maybe some format description of strings,
so that API users looking at the docs get an easier clue to what to expect.
You could also add some description entries, PVE::Firewall has some info on
rule schema in the comments around line 165.
Nothing important, just as a note, it's already great that we and API user now
know what they can expect to get returned at all!




More information about the pve-devel mailing list