1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | namespace OpenSearch\Endpoints\Ml; |
15: | |
16: | use OpenSearch\Endpoints\AbstractEndpoint; |
17: | |
18: | |
19: | |
20: | |
21: | class UndeployModel extends AbstractEndpoint |
22: | { |
23: | protected $model_id; |
24: | |
25: | public function getURI(): string |
26: | { |
27: | $model_id = $this->model_id ?? null; |
28: | if (isset($model_id)) { |
29: | return "/_plugins/_ml/models/$model_id/_undeploy"; |
30: | } |
31: | return "/_plugins/_ml/models/_undeploy"; |
32: | } |
33: | |
34: | public function getParamWhitelist(): array |
35: | { |
36: | return [ |
37: | 'pretty', |
38: | 'human', |
39: | 'error_trace', |
40: | 'source', |
41: | 'filter_path' |
42: | ]; |
43: | } |
44: | |
45: | public function getMethod(): string |
46: | { |
47: | return 'POST'; |
48: | } |
49: | |
50: | public function setBody($body): static |
51: | { |
52: | if (is_null($body)) { |
53: | return $this; |
54: | } |
55: | $this->body = $body; |
56: | |
57: | return $this; |
58: | } |
59: | |
60: | public function setModelId($model_id): static |
61: | { |
62: | if (is_null($model_id)) { |
63: | return $this; |
64: | } |
65: | $this->model_id = $model_id; |
66: | |
67: | return $this; |
68: | } |
69: | } |
70: | |