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\Ml;
17:
18: use OpenSearch\Endpoints\AbstractEndpoint;
19:
20: /**
21: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
22: */
23: class GetStats extends AbstractEndpoint
24: {
25: protected $node_id;
26: protected $stat;
27:
28: public function getURI(): string
29: {
30: $node_id = $this->node_id ?? null;
31: $stat = $this->stat ?? null;
32: if (isset($node_id) && isset($stat)) {
33: return '/_plugins/_ml/' . rawurlencode($node_id) . '/stats/' . rawurlencode($stat);
34: }
35: if (isset($node_id)) {
36: return '/_plugins/_ml/' . rawurlencode($node_id) . '/stats';
37: }
38: if (isset($stat)) {
39: return '/_plugins/_ml/stats/' . rawurlencode($stat);
40: }
41: return '/_plugins/_ml/stats';
42: }
43:
44: public function getParamWhitelist(): array
45: {
46: return [
47: 'pretty',
48: 'human',
49: 'error_trace',
50: 'source',
51: 'filter_path'
52: ];
53: }
54:
55: public function getMethod(): string
56: {
57: return 'GET';
58: }
59:
60: public function setNodeId($node_id): static
61: {
62: if (is_null($node_id)) {
63: return $this;
64: }
65: $this->node_id = $node_id;
66:
67: return $this;
68: }
69:
70: public function setStat($stat): static
71: {
72: if (isset($stat) !== true) {
73: return $this;
74: }
75: if (is_array($stat) === true) {
76: $stat = implode(",", $stat);
77: }
78: $this->stat = $stat;
79:
80: return $this;
81: }
82: }
83: