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 CcrNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class CcrNamespace extends AbstractNamespace
28{
29
30    /**
31     * Deletes auto-follow patterns.
32     *
33     * $params['name'] = (string) The name of the auto follow pattern.
34     *
35     * @param array $params Associative array of parameters
36     * @return array
37     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html
38     */
39    public function deleteAutoFollowPattern(array $params = [])
40    {
41        $name = $this->extractArgument($params, 'name');
42
43        $endpointBuilder = $this->endpoints;
44        $endpoint = $endpointBuilder('Ccr\DeleteAutoFollowPattern');
45        $endpoint->setParams($params);
46        $endpoint->setName($name);
47
48        return $this->performRequest($endpoint);
49    }
50    /**
51     * Creates a new follower index configured to follow the referenced leader index.
52     *
53     * $params['index']                  = (string) The name of the follower index
54     * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) (Default = 0)
55     * $params['body']                   = (array) The name of the leader index and other optional ccr related parameters (Required)
56     *
57     * @param array $params Associative array of parameters
58     * @return array
59     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html
60     */
61    public function follow(array $params = [])
62    {
63        $index = $this->extractArgument($params, 'index');
64        $body = $this->extractArgument($params, 'body');
65
66        $endpointBuilder = $this->endpoints;
67        $endpoint = $endpointBuilder('Ccr\Follow');
68        $endpoint->setParams($params);
69        $endpoint->setIndex($index);
70        $endpoint->setBody($body);
71
72        return $this->performRequest($endpoint);
73    }
74    /**
75     * Retrieves information about all follower indices, including parameters and status for each follower index
76     *
77     * $params['index'] = (list) A comma-separated list of index patterns; use `_all` to perform the operation on all indices
78     *
79     * @param array $params Associative array of parameters
80     * @return array
81     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html
82     */
83    public function followInfo(array $params = [])
84    {
85        $index = $this->extractArgument($params, 'index');
86
87        $endpointBuilder = $this->endpoints;
88        $endpoint = $endpointBuilder('Ccr\FollowInfo');
89        $endpoint->setParams($params);
90        $endpoint->setIndex($index);
91
92        return $this->performRequest($endpoint);
93    }
94    /**
95     * Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices.
96     *
97     * $params['index'] = (list) A comma-separated list of index patterns; use `_all` to perform the operation on all indices
98     *
99     * @param array $params Associative array of parameters
100     * @return array
101     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html
102     */
103    public function followStats(array $params = [])
104    {
105        $index = $this->extractArgument($params, 'index');
106
107        $endpointBuilder = $this->endpoints;
108        $endpoint = $endpointBuilder('Ccr\FollowStats');
109        $endpoint->setParams($params);
110        $endpoint->setIndex($index);
111
112        return $this->performRequest($endpoint);
113    }
114    /**
115     * Removes the follower retention leases from the leader.
116     *
117     * $params['index'] = (string) the name of the leader index for which specified follower retention leases should be removed
118     * $params['body']  = (array) the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index (Required)
119     *
120     * @param array $params Associative array of parameters
121     * @return array
122     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-forget-follower.html
123     */
124    public function forgetFollower(array $params = [])
125    {
126        $index = $this->extractArgument($params, 'index');
127        $body = $this->extractArgument($params, 'body');
128
129        $endpointBuilder = $this->endpoints;
130        $endpoint = $endpointBuilder('Ccr\ForgetFollower');
131        $endpoint->setParams($params);
132        $endpoint->setIndex($index);
133        $endpoint->setBody($body);
134
135        return $this->performRequest($endpoint);
136    }
137    /**
138     * Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection.
139     *
140     * $params['name'] = (string) The name of the auto follow pattern.
141     *
142     * @param array $params Associative array of parameters
143     * @return array
144     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html
145     */
146    public function getAutoFollowPattern(array $params = [])
147    {
148        $name = $this->extractArgument($params, 'name');
149
150        $endpointBuilder = $this->endpoints;
151        $endpoint = $endpointBuilder('Ccr\GetAutoFollowPattern');
152        $endpoint->setParams($params);
153        $endpoint->setName($name);
154
155        return $this->performRequest($endpoint);
156    }
157    /**
158     * Pauses an auto-follow pattern
159     *
160     * $params['name'] = (string) The name of the auto follow pattern that should pause discovering new indices to follow.
161     *
162     * @param array $params Associative array of parameters
163     * @return array
164     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-auto-follow-pattern.html
165     */
166    public function pauseAutoFollowPattern(array $params = [])
167    {
168        $name = $this->extractArgument($params, 'name');
169
170        $endpointBuilder = $this->endpoints;
171        $endpoint = $endpointBuilder('Ccr\PauseAutoFollowPattern');
172        $endpoint->setParams($params);
173        $endpoint->setName($name);
174
175        return $this->performRequest($endpoint);
176    }
177    /**
178     * Pauses a follower index. The follower index will not fetch any additional operations from the leader index.
179     *
180     * $params['index'] = (string) The name of the follower index that should pause following its leader index.
181     *
182     * @param array $params Associative array of parameters
183     * @return array
184     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html
185     */
186    public function pauseFollow(array $params = [])
187    {
188        $index = $this->extractArgument($params, 'index');
189
190        $endpointBuilder = $this->endpoints;
191        $endpoint = $endpointBuilder('Ccr\PauseFollow');
192        $endpoint->setParams($params);
193        $endpoint->setIndex($index);
194
195        return $this->performRequest($endpoint);
196    }
197    /**
198     * Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices.
199     *
200     * $params['name'] = (string) The name of the auto follow pattern.
201     * $params['body'] = (array) The specification of the auto follow pattern (Required)
202     *
203     * @param array $params Associative array of parameters
204     * @return array
205     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html
206     */
207    public function putAutoFollowPattern(array $params = [])
208    {
209        $name = $this->extractArgument($params, 'name');
210        $body = $this->extractArgument($params, 'body');
211
212        $endpointBuilder = $this->endpoints;
213        $endpoint = $endpointBuilder('Ccr\PutAutoFollowPattern');
214        $endpoint->setParams($params);
215        $endpoint->setName($name);
216        $endpoint->setBody($body);
217
218        return $this->performRequest($endpoint);
219    }
220    /**
221     * Resumes an auto-follow pattern that has been paused
222     *
223     * $params['name'] = (string) The name of the auto follow pattern to resume discovering new indices to follow.
224     *
225     * @param array $params Associative array of parameters
226     * @return array
227     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-auto-follow-pattern.html
228     */
229    public function resumeAutoFollowPattern(array $params = [])
230    {
231        $name = $this->extractArgument($params, 'name');
232
233        $endpointBuilder = $this->endpoints;
234        $endpoint = $endpointBuilder('Ccr\ResumeAutoFollowPattern');
235        $endpoint->setParams($params);
236        $endpoint->setName($name);
237
238        return $this->performRequest($endpoint);
239    }
240    /**
241     * Resumes a follower index that has been paused
242     *
243     * $params['index'] = (string) The name of the follow index to resume following.
244     * $params['body']  = (array) The name of the leader index and other optional ccr related parameters
245     *
246     * @param array $params Associative array of parameters
247     * @return array
248     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html
249     */
250    public function resumeFollow(array $params = [])
251    {
252        $index = $this->extractArgument($params, 'index');
253        $body = $this->extractArgument($params, 'body');
254
255        $endpointBuilder = $this->endpoints;
256        $endpoint = $endpointBuilder('Ccr\ResumeFollow');
257        $endpoint->setParams($params);
258        $endpoint->setIndex($index);
259        $endpoint->setBody($body);
260
261        return $this->performRequest($endpoint);
262    }
263    /**
264     * Gets all stats related to cross-cluster replication.
265     *
266     *
267     * @param array $params Associative array of parameters
268     * @return array
269     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html
270     */
271    public function stats(array $params = [])
272    {
273
274        $endpointBuilder = $this->endpoints;
275        $endpoint = $endpointBuilder('Ccr\Stats');
276        $endpoint->setParams($params);
277
278        return $this->performRequest($endpoint);
279    }
280    /**
281     * Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication.
282     *
283     * $params['index'] = (string) The name of the follower index that should be turned into a regular index.
284     *
285     * @param array $params Associative array of parameters
286     * @return array
287     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html
288     */
289    public function unfollow(array $params = [])
290    {
291        $index = $this->extractArgument($params, 'index');
292
293        $endpointBuilder = $this->endpoints;
294        $endpoint = $endpointBuilder('Ccr\Unfollow');
295        $endpoint->setParams($params);
296        $endpoint->setIndex($index);
297
298        return $this->performRequest($endpoint);
299    }
300}
301