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\Exception\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) || $this->cluster_name === '') { |
31: | throw new RuntimeException('cluster_name is required for get_distinguished_name'); |
32: | } |
33: | $cluster_name = $this->cluster_name; |
34: | |
35: | return "/_plugins/_security/api/nodesdn/$cluster_name"; |
36: | } |
37: | |
38: | public function getParamWhitelist(): array |
39: | { |
40: | return [ |
41: | 'show_all', |
42: | 'pretty', |
43: | 'human', |
44: | 'error_trace', |
45: | 'source', |
46: | 'filter_path' |
47: | ]; |
48: | } |
49: | |
50: | public function getMethod(): string |
51: | { |
52: | return 'GET'; |
53: | } |
54: | |
55: | public function setClusterName($cluster_name): static |
56: | { |
57: | if (is_null($cluster_name)) { |
58: | return $this; |
59: | } |
60: | $this->cluster_name = $cluster_name; |
61: | |
62: | return $this; |
63: | } |
64: | } |
65: | |