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