Exemplo n.º 1
0
 public function __invoke(Request $req, Response $res, $args = [])
 {
     $vaultName = $args['vaultName'];
     if (!($v = Vault::get($vaultName))) {
         return $res->withStatus(404);
     }
     $postData = file_get_contents('php://input');
     $params = json_decode($postData, true);
     $job = $v->createJob($params);
     if (!empty($GLOBALS['config']['throwPolicyEnforcedException']) && $job->getAction() == 'ArchiveRetrieval') {
         return $res->policyEnforcedException();
     }
     return $res->withStatus(202)->withHeader('x-amz-job-id', $job->getId());
 }