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 Close
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 Close extends AbstractEndpoint
20{
21    /**
22     * @throws \Elasticsearch\Common\Exceptions\RuntimeException
23     */
24    public function getURI(): string
25    {
26        if (!isset($this->index)) {
27            throw new Exceptions\RuntimeException(
28                'index is required for Close'
29            );
30        }
31        return "/{$this->index}/_close";
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        ];
43    }
44
45    public function getMethod(): string
46    {
47        return 'POST';
48    }
49}
50