1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * Copyright OpenSearch Contributors
7: * SPDX-License-Identifier: Apache-2.0
8: *
9: * OpenSearch PHP client
10: *
11: * @link https://github.com/opensearch-project/opensearch-php/
12: * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
13: * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
14: * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
15: *
16: * Licensed to Elasticsearch B.V under one or more agreements.
17: * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
18: * the GNU Lesser General Public License, Version 2.1, at your option.
19: * See the LICENSE file in the project root for more information.
20: */
21:
22: namespace OpenSearch\Namespaces;
23:
24: use OpenSearch\Namespaces\AbstractNamespace;
25:
26: /**
27: * Class SnapshotNamespace
28: *
29: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
30: */
31: class SnapshotNamespace extends AbstractNamespace
32: {
33: /**
34: * Removes stale data from repository.
35: *
36: * $params['repository'] = (string) Snapshot repository to clean up.
37: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
38: * $params['master_timeout'] = (string) Period to wait for a connection to the master node.
39: * $params['timeout'] = (string) Period to wait for a response.
40: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
41: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
42: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
43: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
44: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
45: *
46: * @param array $params Associative array of parameters
47: * @return array
48: */
49: public function cleanupRepository(array $params = [])
50: {
51: $repository = $this->extractArgument($params, 'repository');
52:
53: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CleanupRepository::class);
54: $endpoint->setParams($params);
55: $endpoint->setRepository($repository);
56:
57: return $this->performRequest($endpoint);
58: }
59:
60: /**
61: * Clones indexes from one snapshot into another snapshot in the same repository.
62: *
63: * $params['repository'] = (string) A repository name
64: * $params['snapshot'] = (string) The name of the snapshot to clone from
65: * $params['target_snapshot'] = (string) The name of the cloned snapshot to create
66: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
67: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
68: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
69: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
70: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
71: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
72: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
73: * $params['body'] = (array) The snapshot clone definition (Required)
74: *
75: * @param array $params Associative array of parameters
76: * @return array
77: */
78: public function clone(array $params = [])
79: {
80: $repository = $this->extractArgument($params, 'repository');
81: $snapshot = $this->extractArgument($params, 'snapshot');
82: $target_snapshot = $this->extractArgument($params, 'target_snapshot');
83: $body = $this->extractArgument($params, 'body');
84:
85: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CloneSnapshot::class);
86: $endpoint->setParams($params);
87: $endpoint->setRepository($repository);
88: $endpoint->setSnapshot($snapshot);
89: $endpoint->setTargetSnapshot($target_snapshot);
90: $endpoint->setBody($body);
91:
92: return $this->performRequest($endpoint);
93: }
94:
95: /**
96: * Creates a snapshot in a repository.
97: *
98: * $params['repository'] = (string) Repository for the snapshot.
99: * $params['snapshot'] = (string) Name of the snapshot. Must be unique in the repository.
100: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
101: * $params['master_timeout'] = (string) Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
102: * $params['wait_for_completion'] = (boolean) If `true`, the request returns a response when the snapshot is complete. If `false`, the request returns a response when the snapshot initializes. (Default = false)
103: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
104: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
105: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
106: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
107: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
108: * $params['body'] = (array) The snapshot definition
109: *
110: * @param array $params Associative array of parameters
111: * @return array
112: */
113: public function create(array $params = [])
114: {
115: $repository = $this->extractArgument($params, 'repository');
116: $snapshot = $this->extractArgument($params, 'snapshot');
117: $body = $this->extractArgument($params, 'body');
118:
119: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Create::class);
120: $endpoint->setParams($params);
121: $endpoint->setRepository($repository);
122: $endpoint->setSnapshot($snapshot);
123: $endpoint->setBody($body);
124:
125: return $this->performRequest($endpoint);
126: }
127:
128: /**
129: * Creates a repository.
130: *
131: * $params['repository'] = (string) A repository name
132: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
133: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
134: * $params['timeout'] = (string) Explicit operation timeout
135: * $params['verify'] = (boolean) Whether to verify the repository after creation
136: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
137: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
138: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
139: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
140: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
141: * $params['body'] = (array) The repository definition (Required)
142: *
143: * @param array $params Associative array of parameters
144: * @return array
145: */
146: public function createRepository(array $params = [])
147: {
148: $repository = $this->extractArgument($params, 'repository');
149: $body = $this->extractArgument($params, 'body');
150:
151: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CreateRepository::class);
152: $endpoint->setParams($params);
153: $endpoint->setRepository($repository);
154: $endpoint->setBody($body);
155:
156: return $this->performRequest($endpoint);
157: }
158:
159: /**
160: * Deletes a snapshot.
161: *
162: * $params['repository'] = (string) A repository name
163: * $params['snapshot'] = (string) A comma-separated list of snapshot names
164: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
165: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
166: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
167: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
168: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
169: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
170: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
171: *
172: * @param array $params Associative array of parameters
173: * @return array
174: */
175: public function delete(array $params = [])
176: {
177: $repository = $this->extractArgument($params, 'repository');
178: $snapshot = $this->extractArgument($params, 'snapshot');
179:
180: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Delete::class);
181: $endpoint->setParams($params);
182: $endpoint->setRepository($repository);
183: $endpoint->setSnapshot($snapshot);
184:
185: return $this->performRequest($endpoint);
186: }
187:
188: /**
189: * Deletes a repository.
190: *
191: * $params['repository'] = (array) Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported.
192: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
193: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
194: * $params['timeout'] = (string) Explicit operation timeout
195: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
196: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
197: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
198: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
199: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
200: *
201: * @param array $params Associative array of parameters
202: * @return array
203: */
204: public function deleteRepository(array $params = [])
205: {
206: $repository = $this->extractArgument($params, 'repository');
207:
208: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\DeleteRepository::class);
209: $endpoint->setParams($params);
210: $endpoint->setRepository($repository);
211:
212: return $this->performRequest($endpoint);
213: }
214:
215: /**
216: * Returns information about a snapshot.
217: *
218: * $params['repository'] = (string) Comma-separated list of snapshot repository names used to limit the request. Wildcard (*) expressions are supported.
219: * $params['snapshot'] = (array) Comma-separated list of snapshot names to retrieve. Also accepts wildcards (*). - To get information about all snapshots in a registered repository, use a wildcard (*) or _all. - To get information about any snapshots that are currently running, use _current.
220: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
221: * $params['ignore_unavailable'] = (boolean) If false, the request returns an error for any snapshots that are unavailable. (Default = false)
222: * $params['master_timeout'] = (string) Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
223: * $params['verbose'] = (boolean) If true, returns additional information about each snapshot such as the version of OpenSearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted.
224: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
225: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
226: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
227: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
228: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
229: *
230: * @param array $params Associative array of parameters
231: * @return array
232: */
233: public function get(array $params = [])
234: {
235: $repository = $this->extractArgument($params, 'repository');
236: $snapshot = $this->extractArgument($params, 'snapshot');
237:
238: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Get::class);
239: $endpoint->setParams($params);
240: $endpoint->setRepository($repository);
241: $endpoint->setSnapshot($snapshot);
242:
243: return $this->performRequest($endpoint);
244: }
245:
246: /**
247: * Returns information about a repository.
248: *
249: * $params['repository'] = (array) A comma-separated list of repository names
250: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
251: * $params['local'] = (boolean) Return local information, do not retrieve the state from cluster-manager node. (Default = false)
252: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
253: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
254: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
255: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
256: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
257: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
258: *
259: * @param array $params Associative array of parameters
260: * @return array
261: */
262: public function getRepository(array $params = [])
263: {
264: $repository = $this->extractArgument($params, 'repository');
265:
266: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\GetRepository::class);
267: $endpoint->setParams($params);
268: $endpoint->setRepository($repository);
269:
270: return $this->performRequest($endpoint);
271: }
272:
273: /**
274: * Restores a snapshot.
275: *
276: * $params['repository'] = (string) A repository name
277: * $params['snapshot'] = (string) A snapshot name
278: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
279: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
280: * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false)
281: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
282: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
283: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
284: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
285: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
286: * $params['body'] = (array) Details of what to restore
287: *
288: * @param array $params Associative array of parameters
289: * @return array
290: */
291: public function restore(array $params = [])
292: {
293: $repository = $this->extractArgument($params, 'repository');
294: $snapshot = $this->extractArgument($params, 'snapshot');
295: $body = $this->extractArgument($params, 'body');
296:
297: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Restore::class);
298: $endpoint->setParams($params);
299: $endpoint->setRepository($repository);
300: $endpoint->setSnapshot($snapshot);
301: $endpoint->setBody($body);
302:
303: return $this->performRequest($endpoint);
304: }
305:
306: /**
307: * Returns information about the status of a snapshot.
308: *
309: * $params['repository'] = (string) A repository name
310: * $params['snapshot'] = (array) A comma-separated list of snapshot names
311: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
312: * $params['ignore_unavailable'] = (boolean) Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown (Default = false)
313: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
314: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
315: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
316: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
317: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
318: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
319: *
320: * @param array $params Associative array of parameters
321: * @return array
322: */
323: public function status(array $params = [])
324: {
325: $repository = $this->extractArgument($params, 'repository');
326: $snapshot = $this->extractArgument($params, 'snapshot');
327:
328: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Status::class);
329: $endpoint->setParams($params);
330: $endpoint->setRepository($repository);
331: $endpoint->setSnapshot($snapshot);
332:
333: return $this->performRequest($endpoint);
334: }
335:
336: /**
337: * Verifies a repository.
338: *
339: * $params['repository'] = (string) A repository name
340: * $params['cluster_manager_timeout'] = (string) Operation timeout for connection to cluster-manager node.
341: * $params['master_timeout'] = (string) Explicit operation timeout for connection to master node
342: * $params['timeout'] = (string) Explicit operation timeout
343: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
344: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
345: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
346: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
347: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
348: *
349: * @param array $params Associative array of parameters
350: * @return array
351: */
352: public function verifyRepository(array $params = [])
353: {
354: $repository = $this->extractArgument($params, 'repository');
355:
356: $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\VerifyRepository::class);
357: $endpoint->setParams($params);
358: $endpoint->setRepository($repository);
359:
360: return $this->performRequest($endpoint);
361: }
362:
363: }
364: