1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | namespace OpenSearch\Endpoints\Security; |
17: | |
18: | use OpenSearch\Common\Exceptions\RuntimeException; |
19: | use OpenSearch\Endpoints\AbstractEndpoint; |
20: | |
21: | |
22: | |
23: | |
24: | class GetDistinguishedName extends AbstractEndpoint |
25: | { |
26: | protected $cluster_name; |
27: | |
28: | public function getURI(): string |
29: | { |
30: | if (isset($this->cluster_name) !== true) { |
31: | throw new RuntimeException( |
32: | 'cluster_name is required for get_distinguished_name' |
33: | ); |
34: | } |
35: | $cluster_name = $this->cluster_name; |
36: | return "/_plugins/_security/api/nodesdn/$cluster_name"; |
37: | } |
38: | |
39: | public function getParamWhitelist(): array |
40: | { |
41: | return [ |
42: | 'show_all', |
43: | 'pretty', |
44: | 'human', |
45: | 'error_trace', |
46: | 'source', |
47: | 'filter_path' |
48: | ]; |
49: | } |
50: | |
51: | public function getMethod(): string |
52: | { |
53: | return 'GET'; |
54: | } |
55: | |
56: | public function setClusterName($cluster_name): static |
57: | { |
58: | if (isset($cluster_name) !== true) { |
59: | return $this; |
60: | } |
61: | $this->cluster_name = $cluster_name; |
62: | |
63: | return $this; |
64: | } |
65: | } |
66: | |