|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OpenStack\DataProcessing\v1\Models; |
|
4
|
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\Creatable; |
|
6
|
|
|
use OpenStack\Common\Resource\Deletable; |
|
7
|
|
|
use OpenStack\Common\Resource\Listable; |
|
8
|
|
|
use OpenStack\Common\Resource\OperatorResource; |
|
9
|
|
|
use OpenStack\Common\Resource\Retrievable; |
|
10
|
|
|
use OpenStack\Common\Transport\Utils; |
|
11
|
|
|
|
|
12
|
|
|
class Job extends OperatorResource implements Listable, Retrievable, Creatable, Deletable |
|
13
|
|
|
{ |
|
14
|
|
|
public $description; |
|
15
|
|
|
public $tenantId; |
|
16
|
|
|
public $createdAt; |
|
17
|
|
|
public $mains; |
|
18
|
|
|
public $updatedAt; |
|
19
|
|
|
public $libs; |
|
20
|
|
|
public $isProtected; |
|
21
|
|
|
public $interface; |
|
22
|
|
|
public $type; |
|
23
|
|
|
public $isPublic; |
|
24
|
|
|
public $id; |
|
25
|
|
|
public $name; |
|
26
|
|
|
|
|
27
|
|
|
protected $resourceKey = 'job'; |
|
28
|
|
|
protected $resourcesKey = 'jobs'; |
|
29
|
|
|
|
|
30
|
|
|
protected $aliases = [ |
|
31
|
|
|
'created_at' => 'createdAt', |
|
32
|
|
|
'updated_at' => 'updatedAt', |
|
33
|
|
|
'is_protected' => 'isProtected', |
|
34
|
|
|
'tenant_id' => 'tenantId', |
|
35
|
|
|
'is_public' => 'isPublic', |
|
36
|
|
|
]; |
|
37
|
|
|
|
|
38
|
|
|
public function retrieve() |
|
39
|
|
|
{ |
|
40
|
|
|
$response = $this->execute($this->api->getJob(), $this->getAttrs(['id'])); |
|
|
|
|
|
|
41
|
|
|
$this->populateFromResponse($response); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function create(array $userOptions): Creatable |
|
45
|
|
|
{ |
|
46
|
|
|
$response = $this->execute($this->api->postJob(), $userOptions); |
|
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
return $this->populateFromResponse($response); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function delete() |
|
52
|
|
|
{ |
|
53
|
|
|
$this->execute($this->api->deleteJob(), $this->getAttrs(['id'])); |
|
|
|
|
|
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function update() |
|
57
|
|
|
{ |
|
58
|
|
|
$response = $this->execute($this->api->patchJob(), $this->getAttrs(['id', 'name', 'isPublic', 'description', 'isProtected'])); |
|
|
|
|
|
|
59
|
|
|
$this->populateFromResponse($response); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function executeJob(array $options) |
|
63
|
|
|
{ |
|
64
|
|
|
$response = $this->execute($this->api->executeJob(), $options); |
|
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
return $this->model(JobExecution::class)->populateFromResponse($response); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getJobTypes(array $options = []): array |
|
70
|
|
|
{ |
|
71
|
|
|
$path = ''; |
|
72
|
|
|
if ($options !== []) { |
|
73
|
|
|
$path .= '?'; |
|
74
|
|
|
} |
|
75
|
|
|
if (array_key_exists('plugin', $options)) { |
|
76
|
|
|
$path .= '&plugin={plugin}'; |
|
77
|
|
|
} |
|
78
|
|
|
if (array_key_exists('version', $options)) { |
|
79
|
|
|
$path .= '&version={version}'; |
|
80
|
|
|
} |
|
81
|
|
|
if (array_key_exists('hints', $options)) { |
|
82
|
|
|
$path .= '&hints={hints}'; |
|
83
|
|
|
} |
|
84
|
|
|
$response = $this->execute($this->api->getJobTypes($path), $options); |
|
|
|
|
|
|
85
|
|
|
|
|
86
|
|
|
return Utils::jsonDecode($response); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.