1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Namespaces;
6
7/**
8 * Class SnapshotNamespace
9 *
10 * @category Elasticsearch
11 * @package  Elasticsearch\Namespaces\SnapshotNamespace
12 * @author   Zachary Tong <zach@elastic.co>
13 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
14 * @link     http://elastic.co
15 */
16class SnapshotNamespace extends AbstractNamespace
17{
18    /**
19     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
20     *        ['wait_for_completion'] = (bool) Should this request wait until the operation has completed before returning
21     *
22     * @return callable|array
23     */
24    public function create(array $params = [])
25    {
26        $repository = $this->extractArgument($params, 'repository');
27        $snapshot = $this->extractArgument($params, 'snapshot');
28        $body = $this->extractArgument($params, 'body');
29
30        /**
31 * @var callable $endpointBuilder
32*/
33        $endpointBuilder = $this->endpoints;
34
35        /**
36 * @var \Elasticsearch\Endpoints\Snapshot\Create $endpoint
37*/
38        $endpoint = $endpointBuilder('Snapshot\Create');
39        $endpoint->setRepository($repository)
40            ->setSnapshot($snapshot)
41            ->setParams($params)
42            ->setBody($body);
43
44        return $this->performRequest($endpoint);
45    }
46
47    /**
48     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
49     *        ['timeout'] = (time) Explicit operation timeout
50     *
51     * @return callable|array
52     */
53    public function createRepository(array $params = [])
54    {
55        $repository = $this->extractArgument($params, 'repository');
56        $body = $this->extractArgument($params, 'body');
57
58        /**
59 * @var callable $endpointBuilder
60*/
61        $endpointBuilder = $this->endpoints;
62
63        /**
64 * @var \Elasticsearch\Endpoints\Snapshot\Repository\Create $endpoint
65*/
66        $endpoint = $endpointBuilder('Snapshot\Repository\Create');
67        $endpoint->setRepository($repository)
68            ->setBody($body)
69            ->setParams($params);
70
71        return $this->performRequest($endpoint);
72    }
73
74    /**
75     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
76     *
77     * @return callable|array
78     */
79    public function delete(array $params = [])
80    {
81        $repository = $this->extractArgument($params, 'repository');
82        $snapshot = $this->extractArgument($params, 'snapshot');
83
84        /**
85 * @var callable $endpointBuilder
86*/
87        $endpointBuilder = $this->endpoints;
88
89        /**
90 * @var \Elasticsearch\Endpoints\Snapshot\Delete $endpoint
91*/
92        $endpoint = $endpointBuilder('Snapshot\Delete');
93        $endpoint->setRepository($repository)
94            ->setSnapshot($snapshot)
95            ->setParams($params);
96
97        return $this->performRequest($endpoint);
98    }
99
100    /**
101     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
102     *        ['timeout'] = (time) Explicit operation timeout
103     *
104     * @return callable|array
105     */
106    public function deleteRepository(array $params = [])
107    {
108        $repository = $this->extractArgument($params, 'repository');
109
110        /**
111 * @var callable $endpointBuilder
112*/
113        $endpointBuilder = $this->endpoints;
114
115        /**
116 * @var \Elasticsearch\Endpoints\Snapshot\Repository\Delete $endpoint
117*/
118        $endpoint = $endpointBuilder('Snapshot\Repository\Delete');
119        $endpoint->setRepository($repository)
120            ->setParams($params);
121
122        return $this->performRequest($endpoint);
123    }
124
125    /**
126     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
127     *
128     * @return callable|array
129     */
130    public function get(array $params = [])
131    {
132        $repository = $this->extractArgument($params, 'repository');
133        $snapshot = $this->extractArgument($params, 'snapshot');
134
135        /**
136 * @var callable $endpointBuilder
137*/
138        $endpointBuilder = $this->endpoints;
139
140        /**
141 * @var \Elasticsearch\Endpoints\Snapshot\Get $endpoint
142*/
143        $endpoint = $endpointBuilder('Snapshot\Get');
144        $endpoint->setRepository($repository)
145            ->setSnapshot($snapshot)
146            ->setParams($params);
147
148        return $this->performRequest($endpoint);
149    }
150
151    /**
152     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
153     *        ['timeout'] = (time) Explicit operation timeout
154     *
155     * @return callable|array
156     */
157    public function getRepository(array $params = [])
158    {
159        $repository = $this->extractArgument($params, 'repository');
160
161        /**
162 * @var callable $endpointBuilder
163*/
164        $endpointBuilder = $this->endpoints;
165
166        /**
167 * @var \Elasticsearch\Endpoints\Snapshot\Repository\Get $endpoint
168*/
169        $endpoint = $endpointBuilder('Snapshot\Repository\Get');
170        $endpoint->setRepository($repository)
171            ->setParams($params);
172
173        return $this->performRequest($endpoint);
174    }
175
176    /**
177     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
178     *        ['wait_for_completion'] = (bool) Should this request wait until the operation has completed before returning
179     *
180     * @return callable|array
181     */
182    public function restore(array $params = [])
183    {
184        $repository = $this->extractArgument($params, 'repository');
185        $snapshot = $this->extractArgument($params, 'snapshot');
186        $body = $this->extractArgument($params, 'body');
187
188        /**
189 * @var callable $endpointBuilder
190*/
191        $endpointBuilder = $this->endpoints;
192
193        /**
194 * @var \Elasticsearch\Endpoints\Snapshot\Restore $endpoint
195*/
196        $endpoint = $endpointBuilder('Snapshot\Restore');
197        $endpoint->setRepository($repository)
198            ->setSnapshot($snapshot)
199            ->setParams($params)
200            ->setBody($body);
201
202        return $this->performRequest($endpoint);
203    }
204
205    /**
206     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
207     *
208     * @return callable|array
209     */
210    public function status(array $params = [])
211    {
212        $repository = $this->extractArgument($params, 'repository');
213        $snapshot = $this->extractArgument($params, 'snapshot');
214
215        /**
216 * @var callable $endpointBuilder
217*/
218        $endpointBuilder = $this->endpoints;
219
220        /**
221 * @var \Elasticsearch\Endpoints\Snapshot\Status $endpoint
222*/
223        $endpoint = $endpointBuilder('Snapshot\Status');
224        $endpoint->setRepository($repository)
225            ->setSnapshot($snapshot)
226            ->setParams($params);
227
228        return $this->performRequest($endpoint);
229    }
230
231    /**
232     * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
233     *        ['timeout'] = (time) Explicit operation timeout
234     *
235     * @return callable|array
236     */
237    public function verifyRepository(array $params = [])
238    {
239        $repository = $this->extractArgument($params, 'repository');
240
241        /**
242 * @var callable $endpointBuilder
243*/
244        $endpointBuilder = $this->endpoints;
245
246        /**
247 * @var \Elasticsearch\Endpoints\Snapshot\Repository\Verify $endpoint
248*/
249        $endpoint = $endpointBuilder('Snapshot\Repository\Verify');
250        $endpoint->setRepository($repository)
251            ->setParams($params);
252
253        return $this->performRequest($endpoint);
254    }
255}
256