1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Endpoints\Snapshot\Repository;
6
7use Elasticsearch\Endpoints\AbstractEndpoint;
8
9/**
10 * Class Get
11 *
12 * @category Elasticsearch
13 * @package  Elasticsearch\Endpoints\Snapshot\Repository
14 * @author   Zachary Tong <zach@elastic.co>
15 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
16 * @link     http://elastic.co
17 */
18class Get extends AbstractEndpoint
19{
20    /**
21     * A comma-separated list of repository names
22     *
23     * @var string
24     */
25    private $repository;
26
27    public function setRepository(?string $repository): Get
28    {
29        if (isset($repository) !== true) {
30            return $this;
31        }
32
33        $this->repository = $repository;
34
35        return $this;
36    }
37
38    public function getURI(): string
39    {
40        $repository = $this->repository ?? null;
41        if (isset($repository)) {
42            return "/_snapshot/$repository";
43        }
44        return "/_snapshot";
45    }
46
47    public function getParamWhitelist(): array
48    {
49        return [
50            'master_timeout',
51            'local',
52        ];
53    }
54
55    public function getMethod(): string
56    {
57        return 'GET';
58    }
59}
60