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\Ltr;
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 CreateModelFromSet extends AbstractEndpoint
25: {
26: protected $name;
27: protected $store;
28:
29: public function getURI(): string
30: {
31: if (!isset($this->name) || $this->name === '') {
32: throw new RuntimeException('name is required for create_model_from_set');
33: }
34: $name = $this->name;
35: $store = $this->store ?? null;
36: if (isset($store)) {
37: return '/_ltr/' . rawurlencode($store) . '/_featureset/' . rawurlencode($name) . '/_createmodel';
38: }
39: return '/_ltr/_featureset/' . rawurlencode($name) . '/_createmodel';
40: }
41:
42: public function getParamWhitelist(): array
43: {
44: return [
45: 'routing',
46: 'pretty',
47: 'human',
48: 'error_trace',
49: 'source',
50: 'filter_path'
51: ];
52: }
53:
54: public function getMethod(): string
55: {
56: return 'POST';
57: }
58:
59: public function setBody($body): static
60: {
61: if (is_null($body)) {
62: return $this;
63: }
64: $this->body = $body;
65:
66: return $this;
67: }
68:
69: public function setName($name): static
70: {
71: if (is_null($name)) {
72: return $this;
73: }
74: $this->name = $name;
75:
76: return $this;
77: }
78:
79: public function setStore($store): static
80: {
81: if (is_null($store)) {
82: return $this;
83: }
84: $this->store = $store;
85:
86: return $this;
87: }
88: }
89: