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 TransformNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class TransformNamespace extends AbstractNamespace
28{
29
30    /**
31     * Deletes an existing transform.
32     *
33     * $params['transform_id'] = (string) The id of the transform to delete
34     * $params['force']        = (boolean) When `true`, the transform is deleted regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be deleted.
35     *
36     * @param array $params Associative array of parameters
37     * @return array
38     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-transform.html
39     */
40    public function deleteTransform(array $params = [])
41    {
42        $transform_id = $this->extractArgument($params, 'transform_id');
43
44        $endpointBuilder = $this->endpoints;
45        $endpoint = $endpointBuilder('Transform\DeleteTransform');
46        $endpoint->setParams($params);
47        $endpoint->setTransformId($transform_id);
48
49        return $this->performRequest($endpoint);
50    }
51    /**
52     * Retrieves configuration information for transforms.
53     *
54     * $params['transform_id']      = (string) The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms
55     * $params['from']              = (int) skips a number of transform configs, defaults to 0
56     * $params['size']              = (int) specifies a max number of transforms to get, defaults to 100
57     * $params['allow_no_match']    = (boolean) Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
58     * $params['exclude_generated'] = (boolean) Omits fields that are illegal to set on transform PUT (Default = false)
59     *
60     * @param array $params Associative array of parameters
61     * @return array
62     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html
63     */
64    public function getTransform(array $params = [])
65    {
66        $transform_id = $this->extractArgument($params, 'transform_id');
67
68        $endpointBuilder = $this->endpoints;
69        $endpoint = $endpointBuilder('Transform\GetTransform');
70        $endpoint->setParams($params);
71        $endpoint->setTransformId($transform_id);
72
73        return $this->performRequest($endpoint);
74    }
75    /**
76     * Retrieves usage information for transforms.
77     *
78     * $params['transform_id']   = (string) The id of the transform for which to get stats. '_all' or '*' implies all transforms
79     * $params['from']           = (number) skips a number of transform stats, defaults to 0
80     * $params['size']           = (number) specifies a max number of transform stats to get, defaults to 100
81     * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
82     *
83     * @param array $params Associative array of parameters
84     * @return array
85     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-stats.html
86     */
87    public function getTransformStats(array $params = [])
88    {
89        $transform_id = $this->extractArgument($params, 'transform_id');
90
91        $endpointBuilder = $this->endpoints;
92        $endpoint = $endpointBuilder('Transform\GetTransformStats');
93        $endpoint->setParams($params);
94        $endpoint->setTransformId($transform_id);
95
96        return $this->performRequest($endpoint);
97    }
98    /**
99     * Previews a transform.
100     *
101     * $params['transform_id'] = (string) The id of the transform to preview.
102     * $params['body']         = (array) The definition for the transform to preview
103     *
104     * @param array $params Associative array of parameters
105     * @return array
106     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-transform.html
107     */
108    public function previewTransform(array $params = [])
109    {
110        $transform_id = $this->extractArgument($params, 'transform_id');
111        $body = $this->extractArgument($params, 'body');
112
113        $endpointBuilder = $this->endpoints;
114        $endpoint = $endpointBuilder('Transform\PreviewTransform');
115        $endpoint->setParams($params);
116        $endpoint->setTransformId($transform_id);
117        $endpoint->setBody($body);
118
119        return $this->performRequest($endpoint);
120    }
121    /**
122     * Instantiates a transform.
123     *
124     * $params['transform_id']     = (string) The id of the new transform.
125     * $params['defer_validation'] = (boolean) If validations should be deferred until transform starts, defaults to false.
126     * $params['body']             = (array) The transform definition (Required)
127     *
128     * @param array $params Associative array of parameters
129     * @return array
130     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html
131     */
132    public function putTransform(array $params = [])
133    {
134        $transform_id = $this->extractArgument($params, 'transform_id');
135        $body = $this->extractArgument($params, 'body');
136
137        $endpointBuilder = $this->endpoints;
138        $endpoint = $endpointBuilder('Transform\PutTransform');
139        $endpoint->setParams($params);
140        $endpoint->setTransformId($transform_id);
141        $endpoint->setBody($body);
142
143        return $this->performRequest($endpoint);
144    }
145    /**
146     * Starts one or more transforms.
147     *
148     * $params['transform_id'] = (string) The id of the transform to start
149     * $params['timeout']      = (time) Controls the time to wait for the transform to start
150     *
151     * @param array $params Associative array of parameters
152     * @return array
153     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/start-transform.html
154     */
155    public function startTransform(array $params = [])
156    {
157        $transform_id = $this->extractArgument($params, 'transform_id');
158
159        $endpointBuilder = $this->endpoints;
160        $endpoint = $endpointBuilder('Transform\StartTransform');
161        $endpoint->setParams($params);
162        $endpoint->setTransformId($transform_id);
163
164        return $this->performRequest($endpoint);
165    }
166    /**
167     * Stops one or more transforms.
168     *
169     * $params['transform_id']        = (string) The id of the transform to stop
170     * $params['force']               = (boolean) Whether to force stop a failed transform or not. Default to false
171     * $params['wait_for_completion'] = (boolean) Whether to wait for the transform to fully stop before returning or not. Default to false
172     * $params['timeout']             = (time) Controls the time to wait until the transform has stopped. Default to 30 seconds
173     * $params['allow_no_match']      = (boolean) Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
174     * $params['wait_for_checkpoint'] = (boolean) Whether to wait for the transform to reach a checkpoint before stopping. Default to false
175     *
176     * @param array $params Associative array of parameters
177     * @return array
178     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-transform.html
179     */
180    public function stopTransform(array $params = [])
181    {
182        $transform_id = $this->extractArgument($params, 'transform_id');
183
184        $endpointBuilder = $this->endpoints;
185        $endpoint = $endpointBuilder('Transform\StopTransform');
186        $endpoint->setParams($params);
187        $endpoint->setTransformId($transform_id);
188
189        return $this->performRequest($endpoint);
190    }
191    /**
192     * Updates certain properties of a transform.
193     *
194     * $params['transform_id']     = (string) The id of the transform.
195     * $params['defer_validation'] = (boolean) If validations should be deferred until transform starts, defaults to false.
196     * $params['body']             = (array) The update transform definition (Required)
197     *
198     * @param array $params Associative array of parameters
199     * @return array
200     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-transform.html
201     */
202    public function updateTransform(array $params = [])
203    {
204        $transform_id = $this->extractArgument($params, 'transform_id');
205        $body = $this->extractArgument($params, 'body');
206
207        $endpointBuilder = $this->endpoints;
208        $endpoint = $endpointBuilder('Transform\UpdateTransform');
209        $endpoint->setParams($params);
210        $endpoint->setTransformId($transform_id);
211        $endpoint->setBody($body);
212
213        return $this->performRequest($endpoint);
214    }
215}
216