$apiResponse->printJson();
})->via('GET', 'POST')->name('saigon-api-revisionlog');
$app->get('/sapi/deployment/:deployment/hosttypes', function ($deployment) use($app) {
    check_deployment_exists($app, $deployment);
    $locations = HostInputs::fetchLocations();
    $inputs = HostInputs::fetchInputs();
    $merged = array_merge($locations, $inputs);
    $apiResponse = new APIViewData(0, $deployment, false);
    $apiResponse->setExtraResponseData('dynamic', $merged);
    $apiResponse->setExtraResponseData('static', array('host' => 'ip'));
    $apiResponse->printJson();
})->name('saigon-api-deployment-hosts-input-types');
$app->get('/sapi/deployment/:deployment/hosts', function ($deployment) use($app) {
    check_deployment_exists($app, $deployment);
    $apiResponse = new APIViewData(0, $deployment, false);
    $dynamicSearches = RevDeploy::getDeploymentHostSearches($deployment);
    $dynamicResults = array();
    foreach ($dynamicSearches as $key => $tmpArray) {
        $dynamicResults[] = $tmpArray;
    }
    $staticSearches = RevDeploy::getDeploymentStaticHosts($deployment);
    $staticResults = array();
    foreach ($staticSearches as $key => $tmpArray) {
        $staticResults[] = $tmpArray;
    }
    $apiResponse->setExtraResponseData('dynamic', $dynamicResults);
    $apiResponse->setExtraResponseData('static', $staticResults);
    $apiResponse->printJson();
})->name('saigon-api-deployment-hosts');
$app->post('/sapi/deployment/:deployment/host/:type', function ($deployment, $type) use($app) {
    check_deployment_exists($app, $deployment);
 /**
  * modify_stage - modify deployment stage view / routine 
  * 
  * @access public
  * @return void
  */
 public function modify_stage()
 {
     $viewData = new ViewData();
     $deployment = $this->getDeployment('deployment_error');
     $deployInfo = RevDeploy::getDeploymentInfo($deployment);
     $deployHostSearches = RevDeploy::getDeploymentHostSearches($deployment);
     $deployStaticHosts = RevDeploy::getDeploymentStaticHosts($deployment);
     if (empty($deployInfo)) {
         $viewData->header = $this->getErrorHeader('deployment_error');
         $viewData->error = 'Unable to fetch deployment information from data store for ' . $deployment;
         $this->sendError('generic_error', $viewData);
     }
     $_SESSION[$deployment]['deployments'] = $deployHostSearches;
     $_SESSION[$deployment]['static-deployments'] = $deployStaticHosts;
     if (($return = $this->checkGroupAuth(SUPERMEN, true)) === false) {
         $viewData->notsupermen = true;
     }
     $viewData->deployInfo = $deployInfo;
     $viewData->action = 'modify_write';
     $viewData->locations = HostInputs::fetchLocations();
     $viewData->inputs = HostInputs::fetchInputs();
     $viewData->deployment = $deployment;
     $viewData->crepos = RevDeploy::getCommonRepos();
     $authmodule = AUTH_MODULE;
     $amodule = new $authmodule();
     $viewData->authtitle = $amodule->getTitle();
     $this->sendResponse('deployment_action_stage', $viewData);
 }