DemoKillJob.php 784 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require('../../../vendor/autoload.php');
  3. use Volc\Service\Imp\Models\Request\ImpKillJobRequest;
  4. use Volc\Service\Imp\Models\Response\ImpKillJobResponse;
  5. use Volc\Service\Imp\Imp;
  6. // call below method if you don't set ak and sk in $HOME/.vcloud/config
  7. $client = Imp::getInstance();
  8. $client->setAccessKey("your ak");
  9. $client->setSecretKey("your sk");
  10. $request = new ImpKillJobRequest();
  11. $request->setJobId("your job id");
  12. $response = new ImpKillJobResponse();
  13. try {
  14. $response = $client->KillJob($request);
  15. } catch (Exception $e) {
  16. echo $e, "\n";
  17. } catch (Throwable $e) {
  18. echo $e, "\n";
  19. }
  20. if ($response->getResponseMetadata()->getError() != null) {
  21. print_r($response->getResponseMetadata()->getError());
  22. }
  23. echo $response->serializeToJsonString();
  24. echo "\n";