1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * SPDX-License-Identifier: Apache-2.0
7: *
8: * The OpenSearch Contributors require contributions made to
9: * this file be licensed under the Apache-2.0 license or a
10: * compatible open source license.
11: *
12: * Modifications Copyright OpenSearch Contributors. See
13: * GitHub history for details.
14: */
15:
16: namespace OpenSearch\Endpoints\SearchRelevance;
17:
18: use OpenSearch\Exception\RuntimeException;
19: use OpenSearch\Endpoints\AbstractEndpoint;
20:
21: /**
22: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
23: */
24: class GetNodeStats extends AbstractEndpoint
25: {
26: protected $node_id;
27: protected $stat;
28:
29: public function getURI(): string
30: {
31: if (!isset($this->node_id) || $this->node_id === '') {
32: throw new RuntimeException('node_id is required for get_node_stats');
33: }
34: $node_id = $this->node_id;
35: $stat = $this->stat ?? null;
36: if (isset($stat)) {
37: return '/_plugins/_search_relevance/' . rawurlencode($node_id) . '/stats/' . rawurlencode($stat);
38: }
39: return '/_plugins/_search_relevance/' . rawurlencode($node_id) . '/stats';
40: }
41:
42: public function getParamWhitelist(): array
43: {
44: return [
45: 'flat_stat_paths',
46: 'include_all_nodes',
47: 'include_individual_nodes',
48: 'include_info',
49: 'include_metadata',
50: 'pretty',
51: 'human',
52: 'error_trace',
53: 'source',
54: 'filter_path'
55: ];
56: }
57:
58: public function getMethod(): string
59: {
60: return 'GET';
61: }
62:
63: public function setNodeId($node_id): static
64: {
65: if (is_null($node_id)) {
66: return $this;
67: }
68: $this->node_id = $node_id;
69:
70: return $this;
71: }
72:
73: public function setStat($stat): static
74: {
75: if (is_null($stat)) {
76: return $this;
77: }
78: $this->stat = $stat;
79:
80: return $this;
81: }
82: }
83: