From 7a190c110d12c95dee61bcf7e094aa5024da132a Mon Sep 17 00:00:00 2001 From: Gaurav Mishra Date: Wed, 7 Aug 2019 12:08:36 +0530 Subject: [PATCH] feat(api): Add OJO analysis to REST API Signed-off-by: Gaurav Mishra --- src/www/ui/api/Models/Analysis.php | 32 ++++++++++++++++++++++- src/www/ui/api/documentation/openapi.yaml | 3 +++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/www/ui/api/Models/Analysis.php b/src/www/ui/api/Models/Analysis.php index 917e368df8..c8730136e4 100644 --- a/src/www/ui/api/Models/Analysis.php +++ b/src/www/ui/api/Models/Analysis.php @@ -64,6 +64,11 @@ class Analysis * Whether to schedule nomos agent or not */ private $nomos; + /** + * @var boolean $ojo + * Whether to schedule ojo agent or not + */ + private $ojo; /** * @var boolean $pkgagent * Whether to schedule package agent or not @@ -79,10 +84,11 @@ class Analysis * @param boolean $mime * @param boolean $monk * @param boolean $nomos + * @param boolean $ojo * @param boolean $package */ public function __construct($bucket = false, $copyright = false, $ecc = false, $keyword = false, - $mimetype = false, $monk = false, $nomos = false, $pkgagent = false) + $mimetype = false, $monk = false, $nomos = false, $ojo = false, $pkgagent = false) { $this->bucket = $bucket; $this->copyright = $copyright; @@ -91,6 +97,7 @@ public function __construct($bucket = false, $copyright = false, $ecc = false, $ $this->mimetype = $mimetype; $this->monk = $monk; $this->nomos = $nomos; + $this->ojo = $ojo; $this->pkgagent = $pkgagent; } @@ -126,6 +133,9 @@ public function setUsingArray($analysisArray) if (array_key_exists("nomos", $analysisArray)) { $this->nomos = filter_var($analysisArray["nomos"], FILTER_VALIDATE_BOOLEAN); } + if (array_key_exists("ojo", $analysisArray)) { + $this->ojo = filter_var($analysisArray["ojo"], FILTER_VALIDATE_BOOLEAN); + } if (array_key_exists("package", $analysisArray)) { $this->pkgagent = filter_var($analysisArray["package"], FILTER_VALIDATE_BOOLEAN); @@ -161,6 +171,9 @@ public function setUsingString($analysisString) if (stristr($analysisString, "nomos")) { $this->nomos = true; } + if (stristr($analysisString, "ojo")) { + $this->ojo = true; + } if (stristr($analysisString, "pkgagent")) { $this->pkgagent = true; } @@ -224,6 +237,14 @@ public function getNomos() return $this->nomos; } + /** + * @return boolean + */ + public function getOjo() + { + return $this->ojo; + } + /** * @return boolean */ @@ -289,6 +310,14 @@ public function setNomos($nomos) $this->nomos = filter_var($nomos, FILTER_VALIDATE_BOOLEAN); } + /** + * @param boolean $ojo + */ + public function setOjo($ojo) + { + $this->ojo = filter_var($ojo, FILTER_VALIDATE_BOOLEAN); + } + /** * @param boolean $package */ @@ -311,6 +340,7 @@ public function getArray() "mimetype" => $this->mimetype, "monk" => $this->monk, "nomos" => $this->nomos, + "ojo" => $this->ojo, "package" => $this->pkgagent ]; } diff --git a/src/www/ui/api/documentation/openapi.yaml b/src/www/ui/api/documentation/openapi.yaml index 2d57a913b3..e4a415157b 100644 --- a/src/www/ui/api/documentation/openapi.yaml +++ b/src/www/ui/api/documentation/openapi.yaml @@ -843,6 +843,9 @@ components: nomos: type: boolean description: Should Nomos Analysis be run on this upload. + ojo: + type: boolean + description: Should OJO Analysis be run on this upload. package: type: boolean description: Should Package Analysis be run on this upload.