1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Namespaces;
6
7/**
8 * Class CatNamespace
9 *
10 * @category Elasticsearch
11 * @package  Elasticsearch\Namespaces\CatNamespace
12 * @author   Zachary Tong <zach@elastic.co>
13 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
14 * @link     http://elastic.co
15 */
16class CatNamespace extends AbstractNamespace
17{
18    /**
19     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
20     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
21     *        ['h']              = (list) Comma-separated list of column names to display
22     *        ['help']           = (bool) Return help information
23     *        ['v']              = (bool) Verbose mode. Display column headers
24     *
25     * @return callable|array
26     */
27    public function aliases(array $params = [])
28    {
29        $name = $this->extractArgument($params, 'name');
30
31        /**
32 * @var callable $endpointBuilder
33*/
34        $endpointBuilder = $this->endpoints;
35
36        /**
37 * @var \Elasticsearch\Endpoints\Cat\Aliases $endpoint
38*/
39        $endpoint = $endpointBuilder('Cat\Aliases');
40        $endpoint->setName($name);
41        $endpoint->setParams($params);
42
43        return $this->performRequest($endpoint);
44    }
45
46    /**
47     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
48     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
49     *        ['h']              = (list) Comma-separated list of column names to display
50     *        ['help']           = (bool) Return help information
51     *        ['v']              = (bool) Verbose mode. Display column headers
52     *        ['bytes']          = (enum) The unit in which to display byte values
53     *
54     * @return callable|array
55     */
56    public function allocation(array $params = [])
57    {
58        $nodeID = $this->extractArgument($params, 'node_id');
59
60        /**
61 * @var callable $endpointBuilder
62*/
63        $endpointBuilder = $this->endpoints;
64
65        /**
66 * @var \Elasticsearch\Endpoints\Cat\Allocation $endpoint
67*/
68        $endpoint = $endpointBuilder('Cat\Allocation');
69        $endpoint->setNodeId($nodeID);
70        $endpoint->setParams($params);
71
72        return $this->performRequest($endpoint);
73    }
74
75    /**
76     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
77     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
78     *        ['h']              = (list) Comma-separated list of column names to display
79     *        ['help']           = (bool) Return help information
80     *        ['v']              = (bool) Verbose mode. Display column headers
81     *
82     * @return callable|array
83     */
84    public function count(array $params = [])
85    {
86        $index = $this->extractArgument($params, 'index');
87
88        /**
89 * @var callable $endpointBuilder
90*/
91        $endpointBuilder = $this->endpoints;
92
93        /**
94 * @var \Elasticsearch\Endpoints\Cat\Count $endpoint
95*/
96        $endpoint = $endpointBuilder('Cat\Count');
97        $endpoint->setIndex($index);
98        $endpoint->setParams($params);
99
100        return $this->performRequest($endpoint);
101    }
102
103    /**
104     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
105     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
106     *        ['h']              = (list) Comma-separated list of column names to display
107     *        ['help']           = (bool) Return help information
108     *        ['v']              = (bool) Verbose mode. Display column headers
109     *        ['ts']             = (bool) Set to false to disable timestamping
110     *
111     * @return callable|array
112     */
113    public function health(array $params = [])
114    {
115        /**
116 * @var callable $endpointBuilder
117*/
118        $endpointBuilder = $this->endpoints;
119
120        /**
121 * @var \Elasticsearch\Endpoints\Cat\Health $endpoint
122*/
123        $endpoint = $endpointBuilder('Cat\Health');
124        $endpoint->setParams($params);
125
126        return $this->performRequest($endpoint);
127    }
128
129    /**
130     * $params['help'] = (bool) Return help information
131     *
132     * @return callable|array
133     */
134    public function help(array $params = [])
135    {
136        /**
137 * @var callable $endpointBuilder
138*/
139        $endpointBuilder = $this->endpoints;
140
141        /**
142 * @var \Elasticsearch\Endpoints\Cat\Help $endpoint
143*/
144        $endpoint = $endpointBuilder('Cat\Help');
145        $endpoint->setParams($params);
146
147        return $this->performRequest($endpoint);
148    }
149
150    /**
151     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
152     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
153     *        ['h']              = (list) Comma-separated list of column names to display
154     *        ['help']           = (bool) Return help information
155     *        ['v']              = (bool) Verbose mode. Display column headers
156     *        ['bytes']          = (enum) The unit in which to display byte values
157     *        ['pri']            = (bool) Set to true to return stats only for primary shards
158     *
159     * @return callable|array
160     */
161    public function indices(array $params = [])
162    {
163        $index = $this->extractArgument($params, 'index');
164
165        /**
166 * @var callable $endpointBuilder
167*/
168        $endpointBuilder = $this->endpoints;
169
170        /**
171 * @var \Elasticsearch\Endpoints\Cat\Indices $endpoint
172*/
173        $endpoint = $endpointBuilder('Cat\Indices');
174        $endpoint->setIndex($index);
175        $endpoint->setParams($params);
176
177        return $this->performRequest($endpoint);
178    }
179
180    /**
181     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
182     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
183     *        ['h']              = (list) Comma-separated list of column names to display
184     *        ['help']           = (bool) Return help information
185     *        ['v']              = (bool) Verbose mode. Display column headers
186     *
187     * @return callable|array
188     */
189    public function master(array $params = [])
190    {
191        /**
192 * @var callable $endpointBuilder
193*/
194        $endpointBuilder = $this->endpoints;
195
196        /**
197 * @var \Elasticsearch\Endpoints\Cat\Master $endpoint
198*/
199        $endpoint = $endpointBuilder('Cat\Master');
200        $endpoint->setParams($params);
201
202        return $this->performRequest($endpoint);
203    }
204
205    /**
206     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
207     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
208     *        ['h']              = (list) Comma-separated list of column names to display
209     *        ['help']           = (bool) Return help information
210     *        ['v']              = (bool) Verbose mode. Display column headers
211     *
212     * @return callable|array
213     */
214    public function nodes(array $params = [])
215    {
216        /**
217 * @var callable $endpointBuilder
218*/
219        $endpointBuilder = $this->endpoints;
220
221        /**
222 * @var \Elasticsearch\Endpoints\Cat\Nodes $endpoint
223*/
224        $endpoint = $endpointBuilder('Cat\Nodes');
225        $endpoint->setParams($params);
226
227        return $this->performRequest($endpoint);
228    }
229
230    /**
231     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
232     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
233     *        ['h']              = (list) Comma-separated list of column names to display
234     *        ['help']           = (bool) Return help information
235     *        ['v']              = (bool) Verbose mode. Display column headers
236     *
237     * @return callable|array
238     */
239    public function nodeAttrs(array $params = [])
240    {
241        /**
242 * @var callable $endpointBuilder
243*/
244        $endpointBuilder = $this->endpoints;
245
246        /**
247 * @var \Elasticsearch\Endpoints\Cat\NodeAttrs $endpoint
248*/
249        $endpoint = $endpointBuilder('Cat\NodeAttrs');
250        $endpoint->setParams($params);
251
252        return $this->performRequest($endpoint);
253    }
254
255    /**
256     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
257     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
258     *        ['h']              = (list) Comma-separated list of column names to display
259     *        ['help']           = (bool) Return help information
260     *        ['v']              = (bool) Verbose mode. Display column headers
261     *
262     * @return callable|array
263     */
264    public function pendingTasks(array $params = [])
265    {
266        /**
267 * @var callable $endpointBuilder
268*/
269        $endpointBuilder = $this->endpoints;
270
271        /**
272 * @var \Elasticsearch\Endpoints\Cat\PendingTasks $endpoint
273*/
274        $endpoint = $endpointBuilder('Cat\PendingTasks');
275        $endpoint->setParams($params);
276
277        return $this->performRequest($endpoint);
278    }
279
280    /**
281     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
282     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
283     *        ['h']              = (list) Comma-separated list of column names to display
284     *        ['help']           = (bool) Return help information
285     *        ['v']              = (bool) Verbose mode. Display column headers
286     *        ['bytes']          = (enum) The unit in which to display byte values
287     *
288     * @return callable|array
289     */
290    public function recovery(array $params = [])
291    {
292        $index = $this->extractArgument($params, 'index');
293
294        /**
295 * @var callable $endpointBuilder
296*/
297        $endpointBuilder = $this->endpoints;
298
299        /**
300 * @var \Elasticsearch\Endpoints\Cat\Recovery $endpoint
301*/
302        $endpoint = $endpointBuilder('Cat\Recovery');
303        $endpoint->setIndex($index);
304        $endpoint->setParams($params);
305
306        return $this->performRequest($endpoint);
307    }
308
309    /**
310     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
311     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
312     *        ['h']              = (list) Comma-separated list of column names to display
313     *        ['help']           = (bool) Return help information
314     *        ['v']              = (bool) Verbose mode. Display column headers
315     *
316     * @return callable|array
317     */
318    public function repositories(array $params = [])
319    {
320        /**
321 * @var callable $endpointBuilder
322*/
323        $endpointBuilder = $this->endpoints;
324
325        /**
326 * @var \Elasticsearch\Endpoints\Cat\Repositories $endpoint
327*/
328        $endpoint = $endpointBuilder('Cat\Repositories');
329        $endpoint->setParams($params);
330
331        return $this->performRequest($endpoint);
332    }
333
334    /**
335     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
336     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
337     *        ['h']              = (list) Comma-separated list of column names to display
338     *        ['help']           = (bool) Return help information
339     *        ['v']              = (bool) Verbose mode. Display column headers
340     *        ['bytes']          = (enum) The unit in which to display byte values
341     *
342     * @return callable|array
343     */
344    public function shards(array $params = [])
345    {
346        $index = $this->extractArgument($params, 'index');
347
348        /**
349 * @var callable $endpointBuilder
350*/
351        $endpointBuilder = $this->endpoints;
352
353        /**
354 * @var \Elasticsearch\Endpoints\Cat\Shards $endpoint
355*/
356        $endpoint = $endpointBuilder('Cat\Shards');
357        $endpoint->setIndex($index);
358        $endpoint->setParams($params);
359
360        return $this->performRequest($endpoint);
361    }
362
363    /**
364     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
365     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
366     *        ['h']              = (list) Comma-separated list of column names to display
367     *        ['help']           = (bool) Return help information
368     *        ['v']              = (bool) Verbose mode. Display column headers
369     *        ['bytes']          = (enum) The unit in which to display byte values
370     *        ['repository']     = (string) Name of repository from which to fetch the snapshot information
371     *
372     * @return callable|array
373     */
374    public function snapshots(array $params = [])
375    {
376        $repository = $this->extractArgument($params, 'repository');
377
378        /**
379 * @var callable $endpointBuilder
380*/
381        $endpointBuilder = $this->endpoints;
382
383        /**
384 * @var \Elasticsearch\Endpoints\Cat\Snapshots $endpoint
385*/
386        $endpoint = $endpointBuilder('Cat\Snapshots');
387        $endpoint->setRepository($repository);
388        $endpoint->setParams($params);
389
390        return $this->performRequest($endpoint);
391    }
392
393    /**
394     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
395     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
396     *        ['h']              = (list) Comma-separated list of column names to display
397     *        ['help']           = (bool) Return help information
398     *        ['v']              = (bool) Verbose mode. Display column headers
399     *        ['full_id']        = (bool) Enables displaying the complete node ids
400     *        ['size']           = (enum) The multiplier in which to display values ([ "", "k", "m", "g", "t", "p" ])
401     *
402     * @return callable|array
403     */
404    public function threadPool(array $params = [])
405    {
406        $threadPoolPatterns = $this->extractArgument($params, 'thread_pool_patterns');
407
408        /**
409 * @var callable $endpointBuilder
410*/
411        $endpointBuilder = $this->endpoints;
412
413        /**
414 * @var \Elasticsearch\Endpoints\Cat\ThreadPool $endpoint
415*/
416        $endpoint = $endpointBuilder('Cat\ThreadPool');
417        $endpoint->setThreadPoolPatterns($threadPoolPatterns);
418        $endpoint->setParams($params);
419
420        return $this->performRequest($endpoint);
421    }
422
423    /**
424     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
425     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
426     *        ['h']              = (list) Comma-separated list of column names to display
427     *        ['help']           = (bool) Return help information
428     *        ['v']              = (bool) Verbose mode. Display column headers
429     *        ['bytes']          = (enum) The unit in which to display byte values
430     *        ['fields']         = (list) A comma-separated list of fields to return the fielddata size
431     *
432     * @return callable|array
433     */
434    public function fielddata(array $params = [])
435    {
436        $fields = $this->extractArgument($params, 'fields');
437
438        /**
439 * @var callable $endpointBuilder
440*/
441        $endpointBuilder = $this->endpoints;
442
443        /**
444 * @var \Elasticsearch\Endpoints\Cat\Fielddata $endpoint
445*/
446        $endpoint = $endpointBuilder('Cat\Fielddata');
447        $endpoint->setFields($fields);
448        $endpoint->setParams($params);
449
450        return $this->performRequest($endpoint);
451    }
452
453    /**
454     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
455     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
456     *        ['h']              = (list) Comma-separated list of column names to display
457     *        ['help']           = (bool) Return help information
458     *        ['v']              = (bool) Verbose mode. Display column headers
459     *
460     * @return callable|array
461     */
462    public function plugins(array $params = [])
463    {
464        /**
465 * @var callable $endpointBuilder
466*/
467        $endpointBuilder = $this->endpoints;
468
469        /**
470 * @var \Elasticsearch\Endpoints\Cat\Plugins $endpoint
471*/
472        $endpoint = $endpointBuilder('Cat\Plugins');
473        $endpoint->setParams($params);
474
475        return $this->performRequest($endpoint);
476    }
477
478    /**
479     * $params['h']              = (list) Comma-separated list of column names to display
480     *        ['help']           = (bool) Return help information
481     *        ['v']              = (bool) Verbose mode. Display column headers
482     *
483     * @return callable|array
484     */
485    public function segments(array $params = [])
486    {
487        $index = $this->extractArgument($params, 'index');
488
489        /**
490 * @var callable $endpointBuilder
491*/
492        $endpointBuilder = $this->endpoints;
493
494        /**
495 * @var \Elasticsearch\Endpoints\Cat\Segments $endpoint
496*/
497        $endpoint = $endpointBuilder('Cat\Segments');
498        $endpoint->setIndex($index);
499        $endpoint->setParams($params);
500
501        return $this->performRequest($endpoint);
502    }
503
504    /**
505     * $params['format']         = (string) a short version of the Accept header, e.g. json, yaml
506     *        ['node_id']        = (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
507     *        ['format']         = (string) a short version of the Accept header, e.g. json, yaml
508     *        ['actions']        = (list) A comma-separated list of actions that should be returned. Leave empty to return all.
509     *        ['detailed']       = (boolean) Return detailed task information (default: false)
510     *        ['parent_node']    = (string) Return tasks with specified parent node.
511     *        ['parent_task']    = (number) Return tasks with specified parent task id. Set to -1 to return all.
512     *        ['h']              = (list) Comma-separated list of column names to display
513     *        ['help']           = (bool) Return help information
514     *        ['v']              = (bool) Verbose mode. Display column headers
515     *
516     * @return callable|array
517     */
518    public function tasks(array $params = [])
519    {
520        /**
521 * @var callable $endpointBuilder
522*/
523        $endpointBuilder = $this->endpoints;
524
525        /**
526 * @var \Elasticsearch\Endpoints\Cat\Tasks $endpoint
527*/
528        $endpoint = $endpointBuilder('Cat\Tasks');
529        $endpoint->setParams($params);
530
531        return $this->performRequest($endpoint);
532    }
533
534    /**
535     * $params['local']          = (bool) Return local information, do not retrieve the state from master node (default: false)
536     *        ['master_timeout'] = (time) Explicit operation timeout for connection to master node
537     *        ['h']              = (list) Comma-separated list of column names to display
538     *        ['help']           = (bool) Return help information
539     *        ['v']              = (bool) Verbose mode. Display column headers
540     *        ['bytes']          = (enum) The unit in which to display byte values
541     *
542     * @return callable|array
543     */
544    public function templates(array $params = [])
545    {
546        $name = $this->extractArgument($params, 'name');
547
548        /**
549 * @var callable $endpointBuilder
550*/
551        $endpointBuilder = $this->endpoints;
552
553        /**
554 * @var \Elasticsearch\Endpoints\Cat\Templates $endpoint
555*/
556        $endpoint = $endpointBuilder('Cat\Templates');
557        $endpoint->setName($name)
558            ->setParams($params);
559
560        return $this->performRequest($endpoint);
561    }
562}
563