1<?php 2/** 3 * Elasticsearch PHP client 4 * 5 * @link https://github.com/elastic/elasticsearch-php/ 6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) 7 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 8 * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1 9 * 10 * Licensed to Elasticsearch B.V under one or more agreements. 11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or 12 * the GNU Lesser General Public License, Version 2.1, at your option. 13 * See the LICENSE file in the project root for more information. 14 */ 15declare(strict_types = 1); 16 17namespace Elasticsearch\Namespaces; 18 19use Elasticsearch\Namespaces\AbstractNamespace; 20 21/** 22 * Class TasksNamespace 23 * 24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php 25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee) 26 */ 27class TasksNamespace extends AbstractNamespace 28{ 29 30 /** 31 * Cancels a task, if it can be cancelled through an API. 32 * 33 * $params['task_id'] = (string) Cancel the task with specified task id (node_id:task_number) 34 * $params['nodes'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes 35 * $params['actions'] = (list) A comma-separated list of actions that should be cancelled. Leave empty to cancel all. 36 * $params['parent_task_id'] = (string) Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. 37 * $params['wait_for_completion'] = (boolean) Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false 38 * 39 * @param array $params Associative array of parameters 40 * @return array 41 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html 42 * 43 * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release 44 * 45 */ 46 public function cancel(array $params = []) 47 { 48 $task_id = $this->extractArgument($params, 'task_id'); 49 50 $endpointBuilder = $this->endpoints; 51 $endpoint = $endpointBuilder('Tasks\Cancel'); 52 $endpoint->setParams($params); 53 $endpoint->setTaskId($task_id); 54 55 return $this->performRequest($endpoint); 56 } 57 /** 58 * Returns information about a task. 59 * 60 * $params['task_id'] = (string) Return the task with specified id (node_id:task_number) 61 * $params['wait_for_completion'] = (boolean) Wait for the matching tasks to complete (default: false) 62 * $params['timeout'] = (time) Explicit operation timeout 63 * 64 * @param array $params Associative array of parameters 65 * @return array 66 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html 67 * 68 * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release 69 * 70 */ 71 public function get(array $params = []) 72 { 73 $task_id = $this->extractArgument($params, 'task_id'); 74 75 $endpointBuilder = $this->endpoints; 76 $endpoint = $endpointBuilder('Tasks\Get'); 77 $endpoint->setParams($params); 78 $endpoint->setTaskId($task_id); 79 80 return $this->performRequest($endpoint); 81 } 82 /** 83 * Returns a list of tasks. 84 * 85 * $params['nodes'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes 86 * $params['actions'] = (list) A comma-separated list of actions that should be returned. Leave empty to return all. 87 * $params['detailed'] = (boolean) Return detailed task information (default: false) 88 * $params['parent_task_id'] = (string) Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. 89 * $params['wait_for_completion'] = (boolean) Wait for the matching tasks to complete (default: false) 90 * $params['group_by'] = (enum) Group tasks by nodes or parent/child relationships (Options = nodes,parents,none) (Default = nodes) 91 * $params['timeout'] = (time) Explicit operation timeout 92 * 93 * @param array $params Associative array of parameters 94 * @return array 95 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html 96 * 97 * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release 98 * 99 */ 100 public function list(array $params = []) 101 { 102 103 $endpointBuilder = $this->endpoints; 104 $endpoint = $endpointBuilder('Tasks\ListTasks'); 105 $endpoint->setParams($params); 106 107 return $this->performRequest($endpoint); 108 } 109 /** 110 * Proxy function to list() to prevent BC break since 7.4.0 111 */ 112 public function tasksList(array $params = []) 113 { 114 return $this->list($params); 115 } 116} 117