1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | namespace OpenSearch\Endpoints\Cat; |
23: | |
24: | use OpenSearch\Endpoints\AbstractEndpoint; |
25: | |
26: | |
27: | |
28: | |
29: | class Aliases extends AbstractEndpoint |
30: | { |
31: | protected $name; |
32: | |
33: | public function getURI(): string |
34: | { |
35: | $name = $this->name ?? null; |
36: | if (isset($name)) { |
37: | return "/_cat/aliases/$name"; |
38: | } |
39: | return "/_cat/aliases"; |
40: | } |
41: | |
42: | public function getParamWhitelist(): array |
43: | { |
44: | return [ |
45: | 'expand_wildcards', |
46: | 'format', |
47: | 'h', |
48: | 'help', |
49: | 'local', |
50: | 's', |
51: | 'v', |
52: | 'pretty', |
53: | 'human', |
54: | 'error_trace', |
55: | 'source', |
56: | 'filter_path' |
57: | ]; |
58: | } |
59: | |
60: | public function getMethod(): string |
61: | { |
62: | return 'GET'; |
63: | } |
64: | |
65: | public function setName($name): static |
66: | { |
67: | if (isset($name) !== true) { |
68: | return $this; |
69: | } |
70: | if (is_array($name) === true) { |
71: | $name = implode(",", $name); |
72: | } |
73: | $this->name = $name; |
74: | |
75: | return $this; |
76: | } |
77: | } |
78: | |