1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Endpoints\Indices;
6
7use Elasticsearch\Endpoints\AbstractEndpoint;
8use Elasticsearch\Common\Exceptions;
9
10/**
11 * Class Open
12 *
13 * @category Elasticsearch
14 * @package  Elasticsearch\Endpoints\Indices
15 * @author   Zachary Tong <zach@elastic.co>
16 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
17 * @link     http://elastic.co
18 */
19class Open extends AbstractEndpoint
20{
21    /**
22     * @throws \Elasticsearch\Common\Exceptions\RuntimeException
23     */
24    public function getURI(): string
25    {
26        if (isset($this->index) !== true) {
27            throw new Exceptions\RuntimeException(
28                'index is required for Open'
29            );
30        }
31        return "/{$this->index}/_open";
32    }
33
34    public function getParamWhitelist(): array
35    {
36        return [
37            'timeout',
38            'master_timeout',
39            'ignore_unavailable',
40            'allow_no_indices',
41            'expand_wildcards',
42            'wait_for_active_shards'
43        ];
44    }
45
46    public function getMethod(): string
47    {
48        return 'POST';
49    }
50}
51