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\Namespaces;
17:
18: use OpenSearch\Namespaces\AbstractNamespace;
19:
20: /**
21: * Class MlNamespace
22: *
23: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
24: */
25: class MlNamespace extends AbstractNamespace
26: {
27: /**
28: * Delete an agent.
29: *
30: * $params['agent_id'] = (string)
31: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
32: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
33: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
34: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
35: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
36: *
37: * @param array $params Associative array of parameters
38: * @return array
39: */
40: public function deleteAgent(array $params = [])
41: {
42: $agent_id = $this->extractArgument($params, 'agent_id');
43:
44: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteAgent::class);
45: $endpoint->setParams($params);
46: $endpoint->setAgentId($agent_id);
47:
48: return $this->performRequest($endpoint);
49: }
50:
51: /**
52: * Deletes a model.
53: *
54: * $params['id'] = (string)
55: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
56: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
57: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
58: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
59: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
60: *
61: * @param array $params Associative array of parameters
62: * @return array
63: */
64: public function deleteModel(array $params = [])
65: {
66: $id = $this->extractArgument($params, 'id');
67:
68: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteModel::class);
69: $endpoint->setParams($params);
70: $endpoint->setId($id);
71:
72: return $this->performRequest($endpoint);
73: }
74:
75: /**
76: * Deletes a model group.
77: *
78: * $params['id'] = (string)
79: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
80: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
81: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
82: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
83: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
84: *
85: * @param array $params Associative array of parameters
86: * @return array
87: */
88: public function deleteModelGroup(array $params = [])
89: {
90: $id = $this->extractArgument($params, 'id');
91:
92: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteModelGroup::class);
93: $endpoint->setParams($params);
94: $endpoint->setId($id);
95:
96: return $this->performRequest($endpoint);
97: }
98:
99: /**
100: * Deletes a task.
101: *
102: * $params['task_id'] = (string)
103: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
104: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
105: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
106: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
107: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
108: *
109: * @param array $params Associative array of parameters
110: * @return array
111: */
112: public function deleteTask(array $params = [])
113: {
114: $task_id = $this->extractArgument($params, 'task_id');
115:
116: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteTask::class);
117: $endpoint->setParams($params);
118: $endpoint->setTaskId($task_id);
119:
120: return $this->performRequest($endpoint);
121: }
122:
123: /**
124: * Retrieves a model group.
125: *
126: * $params['model_group_id'] = (string)
127: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
128: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
129: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
130: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
131: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
132: *
133: * @param array $params Associative array of parameters
134: * @return array
135: */
136: public function getModelGroup(array $params = [])
137: {
138: $model_group_id = $this->extractArgument($params, 'model_group_id');
139:
140: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModelGroup::class);
141: $endpoint->setParams($params);
142: $endpoint->setModelGroupId($model_group_id);
143:
144: return $this->performRequest($endpoint);
145: }
146:
147: /**
148: * Retrieves a task.
149: *
150: * $params['id'] = (string)
151: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
152: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
153: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
154: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
155: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
156: *
157: * @param array $params Associative array of parameters
158: * @return array
159: */
160: public function getTask(array $params = [])
161: {
162: $id = $this->extractArgument($params, 'id');
163:
164: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetTask::class);
165: $endpoint->setParams($params);
166: $endpoint->setId($id);
167:
168: return $this->performRequest($endpoint);
169: }
170:
171: /**
172: * Register an agent.
173: *
174: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
175: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
176: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
177: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
178: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
179: *
180: * @param array $params Associative array of parameters
181: * @return array
182: */
183: public function registerAgents(array $params = [])
184: {
185: $body = $this->extractArgument($params, 'body');
186:
187: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterAgents::class);
188: $endpoint->setParams($params);
189: $endpoint->setBody($body);
190:
191: return $this->performRequest($endpoint);
192: }
193:
194: /**
195: * Registers a model.
196: *
197: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
198: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
199: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
200: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
201: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
202: *
203: * @param array $params Associative array of parameters
204: * @return array
205: */
206: public function registerModel(array $params = [])
207: {
208: $body = $this->extractArgument($params, 'body');
209:
210: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterModel::class);
211: $endpoint->setParams($params);
212: $endpoint->setBody($body);
213:
214: return $this->performRequest($endpoint);
215: }
216:
217: /**
218: * Registers a model group.
219: *
220: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
221: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
222: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
223: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
224: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
225: *
226: * @param array $params Associative array of parameters
227: * @return array
228: */
229: public function registerModelGroup(array $params = [])
230: {
231: $body = $this->extractArgument($params, 'body');
232:
233: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterModelGroup::class);
234: $endpoint->setParams($params);
235: $endpoint->setBody($body);
236:
237: return $this->performRequest($endpoint);
238: }
239:
240: /**
241: * Searches for models.
242: *
243: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
244: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
245: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
246: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
247: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
248: *
249: * @param array $params Associative array of parameters
250: * @return array
251: */
252: public function searchModels(array $params = [])
253: {
254: $body = $this->extractArgument($params, 'body');
255:
256: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchModels::class);
257: $endpoint->setParams($params);
258: $endpoint->setBody($body);
259:
260: return $this->performRequest($endpoint);
261: }
262:
263: /**
264: * $params['body'] = (string) The body of the request (Required)
265: *
266: * @param array $params Associative array of parameters
267: *
268: * @return array
269: * The response.
270: */
271: public function createConnector(array $params = []): array
272: {
273: $body = $this->extractArgument($params, 'body');
274: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\CreateConnector::class);
275: $endpoint->setParams($params);
276: $endpoint->setBody($body);
277:
278: return $this->performRequest($endpoint);
279: }
280: /**
281: * $params['connector_id'] = (string) The id of the connector (Required)
282: *
283: * @param array $params Associative array of parameters
284: *
285: * @return array
286: * The response.
287: */
288: public function deleteConnector(array $params = []): array
289: {
290: $connectorId = $this->extractArgument($params, 'connector_id');
291: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteConnector::class);
292: $endpoint->setParams($params);
293: $endpoint->setConnectorId($connectorId);
294:
295: return $this->performRequest($endpoint);
296: }
297: /**
298: * $params['model_id'] = (string) The id of the model (Required)
299: * $params['body'] = (string) The body of the request
300: *
301: * @param array $params Associative array of parameters
302: *
303: * @return array
304: * The response.
305: */
306: public function deployModel(array $params = []): array
307: {
308: $modelId = $this->extractArgument($params, 'model_id');
309: $body = $this->extractArgument($params, 'body');
310: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeployModel::class);
311: $endpoint->setParams($params);
312: $endpoint->setModelId($modelId);
313: if ($body) {
314: $endpoint->setBody($body);
315: }
316:
317: return $this->performRequest($endpoint);
318: }
319: /**
320: * $params['id'] = (string) The id of the connector (Required)
321: *
322: * @param array $params Associative array of parameters
323: *
324: * @return array
325: * The response.
326: */
327: public function getConnector(array $params = []): array
328: {
329: $id = $this->extractArgument($params, 'id');
330: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetConnector::class);
331: $endpoint->setParams($params);
332: $endpoint->setId($id);
333:
334: return $this->performRequest($endpoint);
335: }
336: /**
337: * $params['body'] = (string) The body of the request
338: *
339: * @param array $params Associative array of parameters
340: *
341: * @return array
342: * The response.
343: */
344: public function getConnectors(array $params = []): array
345: {
346: if (!isset($params['body'])) {
347: $params['body'] = [
348: 'query' => [
349: 'match_all' => new \StdClass(),
350: ],
351: 'size' => 1000,
352: ];
353: }
354: $body = $this->extractArgument($params, 'body');
355: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetConnectors::class);
356: $endpoint->setBody($body);
357:
358: return $this->performRequest($endpoint);
359: }
360: /**
361: * $params['body'] = (string) The body of the request
362: *
363: * @param array $params Associative array of parameters
364: *
365: * @return array
366: * The response.
367: */
368: public function getModelGroups(array $params = []): array
369: {
370: if (!isset($params['body'])) {
371: $params['body'] = [
372: 'query' => [
373: 'match_all' => new \StdClass(),
374: ],
375: 'size' => 1000,
376: ];
377: }
378: $body = $this->extractArgument($params, 'body');
379: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModelGroups::class);
380: $endpoint->setBody($body);
381:
382: return $this->performRequest($endpoint);
383: }
384: /**
385: * $params['id'] = (string) The id of the model (Required)
386: *
387: * @param array $params Associative array of parameters
388: *
389: * @return array
390: * The response.
391: */
392: public function getModel(array $params = []): array
393: {
394: $id = $this->extractArgument($params, 'id');
395: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModel::class);
396: $endpoint->setParams($params);
397: $endpoint->setId($id);
398:
399: return $this->performRequest($endpoint);
400: }
401: /**
402: * Proxy function to getModels() to prevent BC break.
403: * This API will be removed in a future version. Use 'searchModels' API instead.
404: */
405: public function getModels(array $params = [])
406: {
407: if (!isset($params['body'])) {
408: $params['body'] = [
409: 'query' => [
410: 'match_all' => new \StdClass(),
411: ],
412: 'size' => 1000,
413: ];
414: }
415:
416: return $this->searchModels($params);
417: }
418: /**
419: * $params['id'] = (string) The id of the model (Required)
420: * $params['body'] = (string) The body of the request
421: *
422: * @param array $params Associative array of parameters
423: *
424: * @return array
425: * The response.
426: */
427: public function predict(array $params = []): array
428: {
429: $id = $this->extractArgument($params, 'id');
430: $body = $this->extractArgument($params, 'body');
431: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\Predict::class);
432: $endpoint->setParams($params);
433: $endpoint->setId($id);
434: $endpoint->setBody($body);
435:
436: return $this->performRequest($endpoint);
437: }
438: /**
439: * $params['model_id'] = (string) The id of the model (Required)
440: * $params['body'] = (string) The body of the request
441: *
442: * @param array $params Associative array of parameters
443: *
444: * @return array
445: * The response.
446: */
447: public function undeployModel(array $params = []): array
448: {
449: $modelId = $this->extractArgument($params, 'model_id');
450: $body = $this->extractArgument($params, 'body');
451: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UndeployModel::class);
452: $endpoint->setParams($params);
453: $endpoint->setModelId($modelId);
454: if ($body) {
455: $endpoint->setBody($body);
456: }
457:
458: return $this->performRequest($endpoint);
459: }
460: /**
461: * $params['id'] = (string) The id of the model group (Required)
462: * $params['body'] = (array) The body of the request (Required)
463: *
464: * @param array $params Associative array of parameters
465: *
466: * @return array
467: * The response.
468: */
469: public function updateModelGroup(array $params = []): array
470: {
471: $id = $this->extractArgument($params, 'id');
472: $body = $this->extractArgument($params, 'body');
473: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateModelGroup::class);
474: $endpoint->setParams($params);
475: $endpoint->setBody($body);
476: $endpoint->setId($id);
477:
478: return $this->performRequest($endpoint);
479: }
480: }
481: