1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Endpoints;
6
7use Elasticsearch\Common\Exceptions\RuntimeException;
8
9/**
10 * Class DeletebyqueryRethrottle
11 *
12 * @category Elasticsearch
13 * @package  Elasticsearch\Endpoints
14 * @author   Enrico Zimuel <enrico.zimuel@elastic.co>
15 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
16 * @link     http://elastic.co
17 */
18class DeleteByQueryRethrottle extends AbstractEndpoint
19{
20    protected $taskId;
21
22    public function setTaskId(?string $taskId): DeleteByQueryRethrottle
23    {
24        if ($taskId !== null) {
25            $this->taskId = $taskId;
26        }
27        return $this;
28    }
29    /**
30     * @throws RuntimeException
31     */
32    public function getURI(): string
33    {
34        if (! isset($this->taskId)) {
35            throw new RuntimeException(
36                'task_id is required for DeleteByQueryRethrottle'
37            );
38        }
39        return "/_delete_by_query/{$this->taskId}/_rethrottle";
40    }
41
42    public function getParamWhitelist(): array
43    {
44        return [
45            'requests_per_second'
46        ];
47    }
48
49    public function getMethod(): string
50    {
51        return 'POST';
52    }
53}
54