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 IlmNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class IlmNamespace extends AbstractNamespace
28{
29
30    /**
31     * Deletes the specified lifecycle policy definition. A currently used policy cannot be deleted.
32     *
33     * $params['policy'] = (string) The name of the index lifecycle policy
34     *
35     * @param array $params Associative array of parameters
36     * @return array
37     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html
38     */
39    public function deleteLifecycle(array $params = [])
40    {
41        $policy = $this->extractArgument($params, 'policy');
42
43        $endpointBuilder = $this->endpoints;
44        $endpoint = $endpointBuilder('Ilm\DeleteLifecycle');
45        $endpoint->setParams($params);
46        $endpoint->setPolicy($policy);
47
48        return $this->performRequest($endpoint);
49    }
50    /**
51     * Retrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step.
52     *
53     * $params['index']        = (string) The name of the index to explain
54     * $params['only_managed'] = (boolean) filters the indices included in the response to ones managed by ILM
55     * $params['only_errors']  = (boolean) filters the indices included in the response to ones in an ILM error state, implies only_managed
56     *
57     * @param array $params Associative array of parameters
58     * @return array
59     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html
60     */
61    public function explainLifecycle(array $params = [])
62    {
63        $index = $this->extractArgument($params, 'index');
64
65        $endpointBuilder = $this->endpoints;
66        $endpoint = $endpointBuilder('Ilm\ExplainLifecycle');
67        $endpoint->setParams($params);
68        $endpoint->setIndex($index);
69
70        return $this->performRequest($endpoint);
71    }
72    /**
73     * Returns the specified policy definition. Includes the policy version and last modified date.
74     *
75     * $params['policy'] = (string) The name of the index lifecycle policy
76     *
77     * @param array $params Associative array of parameters
78     * @return array
79     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html
80     */
81    public function getLifecycle(array $params = [])
82    {
83        $policy = $this->extractArgument($params, 'policy');
84
85        $endpointBuilder = $this->endpoints;
86        $endpoint = $endpointBuilder('Ilm\GetLifecycle');
87        $endpoint->setParams($params);
88        $endpoint->setPolicy($policy);
89
90        return $this->performRequest($endpoint);
91    }
92    /**
93     * Retrieves the current index lifecycle management (ILM) status.
94     *
95     *
96     * @param array $params Associative array of parameters
97     * @return array
98     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html
99     */
100    public function getStatus(array $params = [])
101    {
102
103        $endpointBuilder = $this->endpoints;
104        $endpoint = $endpointBuilder('Ilm\GetStatus');
105        $endpoint->setParams($params);
106
107        return $this->performRequest($endpoint);
108    }
109    /**
110     * Migrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing
111     *
112     * $params['dry_run'] = (boolean) If set to true it will simulate the migration, providing a way to retrieve the ILM policies and indices that need to be migrated. The default is false
113     * $params['body']    = (array) Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to "data")
114     *
115     * @param array $params Associative array of parameters
116     * @return array
117     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-migrate-to-data-tiers.html
118     */
119    public function migrateToDataTiers(array $params = [])
120    {
121        $body = $this->extractArgument($params, 'body');
122
123        $endpointBuilder = $this->endpoints;
124        $endpoint = $endpointBuilder('Ilm\MigrateToDataTiers');
125        $endpoint->setParams($params);
126        $endpoint->setBody($body);
127
128        return $this->performRequest($endpoint);
129    }
130    /**
131     * Manually moves an index into the specified step and executes that step.
132     *
133     * $params['index'] = (string) The name of the index whose lifecycle step is to change
134     * $params['body']  = (array) The new lifecycle step to move to
135     *
136     * @param array $params Associative array of parameters
137     * @return array
138     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html
139     */
140    public function moveToStep(array $params = [])
141    {
142        $index = $this->extractArgument($params, 'index');
143        $body = $this->extractArgument($params, 'body');
144
145        $endpointBuilder = $this->endpoints;
146        $endpoint = $endpointBuilder('Ilm\MoveToStep');
147        $endpoint->setParams($params);
148        $endpoint->setIndex($index);
149        $endpoint->setBody($body);
150
151        return $this->performRequest($endpoint);
152    }
153    /**
154     * Creates a lifecycle policy
155     *
156     * $params['policy'] = (string) The name of the index lifecycle policy
157     * $params['body']   = (array) The lifecycle policy definition to register
158     *
159     * @param array $params Associative array of parameters
160     * @return array
161     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html
162     */
163    public function putLifecycle(array $params = [])
164    {
165        $policy = $this->extractArgument($params, 'policy');
166        $body = $this->extractArgument($params, 'body');
167
168        $endpointBuilder = $this->endpoints;
169        $endpoint = $endpointBuilder('Ilm\PutLifecycle');
170        $endpoint->setParams($params);
171        $endpoint->setPolicy($policy);
172        $endpoint->setBody($body);
173
174        return $this->performRequest($endpoint);
175    }
176    /**
177     * Removes the assigned lifecycle policy and stops managing the specified index
178     *
179     * $params['index'] = (string) The name of the index to remove policy on
180     *
181     * @param array $params Associative array of parameters
182     * @return array
183     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html
184     */
185    public function removePolicy(array $params = [])
186    {
187        $index = $this->extractArgument($params, 'index');
188
189        $endpointBuilder = $this->endpoints;
190        $endpoint = $endpointBuilder('Ilm\RemovePolicy');
191        $endpoint->setParams($params);
192        $endpoint->setIndex($index);
193
194        return $this->performRequest($endpoint);
195    }
196    /**
197     * Retries executing the policy for an index that is in the ERROR step.
198     *
199     * $params['index'] = (string) The name of the indices (comma-separated) whose failed lifecycle step is to be retry
200     *
201     * @param array $params Associative array of parameters
202     * @return array
203     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html
204     */
205    public function retry(array $params = [])
206    {
207        $index = $this->extractArgument($params, 'index');
208
209        $endpointBuilder = $this->endpoints;
210        $endpoint = $endpointBuilder('Ilm\Retry');
211        $endpoint->setParams($params);
212        $endpoint->setIndex($index);
213
214        return $this->performRequest($endpoint);
215    }
216    /**
217     * Start the index lifecycle management (ILM) plugin.
218     *
219     *
220     * @param array $params Associative array of parameters
221     * @return array
222     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html
223     */
224    public function start(array $params = [])
225    {
226
227        $endpointBuilder = $this->endpoints;
228        $endpoint = $endpointBuilder('Ilm\Start');
229        $endpoint->setParams($params);
230
231        return $this->performRequest($endpoint);
232    }
233    /**
234     * Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin
235     *
236     *
237     * @param array $params Associative array of parameters
238     * @return array
239     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html
240     */
241    public function stop(array $params = [])
242    {
243
244        $endpointBuilder = $this->endpoints;
245        $endpoint = $endpointBuilder('Ilm\Stop');
246        $endpoint->setParams($params);
247
248        return $this->performRequest($endpoint);
249    }
250}
251