1 | <?php namespace G2R\Rundeck; |
||
6 | class JobRunner |
||
7 | { |
||
8 | protected $config; |
||
9 | |||
10 | 4 | public function __construct(RundeckConfig $config) |
|
14 | |||
15 | /** |
||
16 | * return the Rundeck configuration |
||
17 | * |
||
18 | * @return RundeckConfig |
||
19 | */ |
||
20 | 2 | public function getConfig() |
|
24 | |||
25 | /** |
||
26 | * Send the request to rundesk |
||
27 | * |
||
28 | * @param $jobId |
||
29 | * @param array $parameters |
||
30 | */ |
||
31 | public function run($jobId, array $parameters = []) |
||
51 | |||
52 | /** |
||
53 | * Return the formatted url for a GET or POST rundeck request to run a job |
||
54 | * |
||
55 | * http://rundeck.org/docs/api/index.html#running-a-job |
||
56 | * GET /api/1/job/[ID]/run |
||
57 | * POST /api/12/job/[ID]/executions |
||
58 | * |
||
59 | * @param $jobId |
||
60 | * @param string $method |
||
61 | * |
||
62 | * @return string |
||
63 | * @throws Exception |
||
64 | */ |
||
65 | 2 | public function getApiUrl($jobId, $method = 'GET') |
|
73 | } |
||
74 |