]> git.proxmox.com Git - pmg-api.git/commitdiff
register and use standard options for starttime and endtime
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Aug 2017 07:43:20 +0000 (09:43 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Aug 2017 07:43:20 +0000 (09:43 +0200)
PMG/API2/Quarantine.pm
PMG/Utils.pm

index 4d81d690e28b7781c3c75a34350ba0f98fb567d8..52f36b0b42102177bf8f26f53d1b5ced2939719a 100644 (file)
@@ -377,18 +377,8 @@ __PACKAGE__->register_method ({
     parameters => {
        additionalProperties => 0,
        properties => {
-           starttime => {
-               description => "Only consider entries newer than 'starttime' (unix epoch). Default is 'now - 1day'.",
-               type => 'integer',
-               minimum => 0,
-               optional => 1,
-           },
-           endtime => {
-               description => "Only consider entries older than 'endtime' (unix epoch). This is set to '<start> + 1day' by default.",
-               type => 'integer',
-               minimum => 1,
-               optional => 1,
-           },
+           starttime => get_standard_option('pmg-starttime'),
+           endtime => get_standard_option('pmg-endtime'),
        },
     },
     returns => {
@@ -525,18 +515,8 @@ __PACKAGE__->register_method ({
     parameters => {
        additionalProperties => 0,
        properties => {
-           starttime => {
-               description => "Only consider entries newer than 'starttime' (unix epoch). This is set to 'now - 1day' by default.",
-               type => 'integer',
-               minimum => 0,
-               optional => 1,
-           },
-           endtime => {
-               description => "Only consider entries older than 'endtime' (unix epoch). This is set to '<start> + 1day' by default.",
-               type => 'integer',
-               minimum => 1,
-               optional => 1,
-           },
+           starttime => get_standard_option('pmg-starttime'),
+           endtime => get_standard_option('pmg-endtime'),
            pmail => $pmail_param_type,
        },
     },
@@ -627,18 +607,8 @@ __PACKAGE__->register_method ({
     parameters => {
        additionalProperties => 0,
        properties => {
-           starttime => {
-               description => "Only consider entries newer than 'starttime' (unix epoch). This is set to 'now - 1day' by default.",
-               type => 'integer',
-               minimum => 0,
-               optional => 1,
-           },
-           endtime => {
-               description => "Only consider entries older than 'endtime' (unix epoch). This is set to '<start> + 1day' by default.",
-               type => 'integer',
-               minimum => 1,
-               optional => 1,
-           },
+           starttime => get_standard_option('pmg-starttime'),
+           endtime => get_standard_option('pmg-endtime'),
        },
     },
     returns => {
index c6d9387095c31c503286d09b1a187696f4d123fe..0b03d79cdb8d4310bb64ce4c0c5f7b3ccbe06f1a 100644 (file)
@@ -52,6 +52,20 @@ PVE::JSONSchema::register_standard_option('realm', {
     maxLength => 32,
 });
 
+PVE::JSONSchema::register_standard_option('pmg-starttime', {
+    description => "Only consider entries newer than 'starttime' (unix epoch). Default is 'now - 1day'.",
+    type => 'integer',
+    minimum => 0,
+    optional => 1,
+});
+
+PVE::JSONSchema::register_standard_option('pmg-endtime', {
+    description => "Only consider entries older than 'endtime' (unix epoch). This is set to '<start> + 1day' by default.",
+    type => 'integer',
+    minimum => 1,
+    optional => 1,
+});
+
 PVE::JSONSchema::register_format('pmg-userid', \&verify_username);
 sub verify_username {
     my ($username, $noerr) = @_;