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\Endpoints\Snapshot\CleanupRepository; |
25: | use OpenSearch\Endpoints\Snapshot\CloneSnapshot; |
26: | use OpenSearch\Endpoints\Snapshot\Create; |
27: | use OpenSearch\Endpoints\Snapshot\CreateRepository; |
28: | use OpenSearch\Endpoints\Snapshot\Delete; |
29: | use OpenSearch\Endpoints\Snapshot\DeleteRepository; |
30: | use OpenSearch\Endpoints\Snapshot\Get; |
31: | use OpenSearch\Endpoints\Snapshot\GetRepository; |
32: | use OpenSearch\Endpoints\Snapshot\Restore; |
33: | use OpenSearch\Endpoints\Snapshot\Status; |
34: | use OpenSearch\Endpoints\Snapshot\VerifyRepository; |
35: | |
36: | /** |
37: | * Class SnapshotNamespace |
38: | * |
39: | * NOTE: This file is autogenerated using util/GenerateEndpoints.php |
40: | */ |
41: | class SnapshotNamespace extends AbstractNamespace |
42: | { |
43: | /** |
44: | * Removes any stale data from a snapshot repository. |
45: | * |
46: | * $params['repository'] = (string) Snapshot repository to clean up. |
47: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
48: | * $params['master_timeout'] = (string) Period to wait for a connection to the cluster-manager node. |
49: | * $params['timeout'] = (string) The amount of time to wait for a response. |
50: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
51: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
52: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
53: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
54: | * $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 "-". |
55: | * |
56: | * @param array $params Associative array of parameters |
57: | * @return array |
58: | */ |
59: | public function cleanupRepository(array $params = []) |
60: | { |
61: | $repository = $this->extractArgument($params, 'repository'); |
62: | |
63: | $endpoint = $this->endpointFactory->getEndpoint(CleanupRepository::class); |
64: | $endpoint->setParams($params); |
65: | $endpoint->setRepository($repository); |
66: | |
67: | return $this->performRequest($endpoint); |
68: | } |
69: | |
70: | /** |
71: | * Creates a clone of all or part of a snapshot in the same repository as the original snapshot. |
72: | * |
73: | * $params['repository'] = (string) The name of repository which will contain the snapshots clone. |
74: | * $params['snapshot'] = (string) The name of the original snapshot. |
75: | * $params['target_snapshot'] = (string) The name of the cloned snapshot. |
76: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
77: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
78: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
79: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
80: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
81: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
82: | * $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 "-". |
83: | * $params['body'] = (array) The snapshot clone definition. (Required) |
84: | * |
85: | * @param array $params Associative array of parameters |
86: | * @return array |
87: | */ |
88: | public function clone(array $params = []) |
89: | { |
90: | $repository = $this->extractArgument($params, 'repository'); |
91: | $snapshot = $this->extractArgument($params, 'snapshot'); |
92: | $target_snapshot = $this->extractArgument($params, 'target_snapshot'); |
93: | $body = $this->extractArgument($params, 'body'); |
94: | |
95: | $endpoint = $this->endpointFactory->getEndpoint(CloneSnapshot::class); |
96: | $endpoint->setParams($params); |
97: | $endpoint->setRepository($repository); |
98: | $endpoint->setSnapshot($snapshot); |
99: | $endpoint->setTargetSnapshot($target_snapshot); |
100: | $endpoint->setBody($body); |
101: | |
102: | return $this->performRequest($endpoint); |
103: | } |
104: | |
105: | /** |
106: | * Creates a snapshot within an existing repository. |
107: | * |
108: | * $params['repository'] = (string) The name of the repository where the snapshot will be stored. |
109: | * $params['snapshot'] = (string) The name of the snapshot. Must be unique in the repository. |
110: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
111: | * $params['master_timeout'] = (string) Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. |
112: | * $params['wait_for_completion'] = (boolean) When `true`, the request returns a response when the snapshot is complete. When `false`, the request returns a response when the snapshot initializes. (Default = false) |
113: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
114: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
115: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
116: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
117: | * $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 "-". |
118: | * $params['body'] = (array) The snapshot definition. |
119: | * |
120: | * @param array $params Associative array of parameters |
121: | * @return array |
122: | */ |
123: | public function create(array $params = []) |
124: | { |
125: | $repository = $this->extractArgument($params, 'repository'); |
126: | $snapshot = $this->extractArgument($params, 'snapshot'); |
127: | $body = $this->extractArgument($params, 'body'); |
128: | |
129: | $endpoint = $this->endpointFactory->getEndpoint(Create::class); |
130: | $endpoint->setParams($params); |
131: | $endpoint->setRepository($repository); |
132: | $endpoint->setSnapshot($snapshot); |
133: | $endpoint->setBody($body); |
134: | |
135: | return $this->performRequest($endpoint); |
136: | } |
137: | |
138: | /** |
139: | * Creates a snapshot repository. |
140: | * |
141: | * $params['repository'] = (string) The name for the newly registered repository. |
142: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
143: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
144: | * $params['timeout'] = (string) The amount of time to wait for a response. |
145: | * $params['verify'] = (boolean) When `true`, verifies the creation of the snapshot repository. |
146: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
147: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
148: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
149: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
150: | * $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 "-". |
151: | * $params['body'] = (array) The repository definition. (Required) |
152: | * |
153: | * @param array $params Associative array of parameters |
154: | * @return array |
155: | */ |
156: | public function createRepository(array $params = []) |
157: | { |
158: | $repository = $this->extractArgument($params, 'repository'); |
159: | $body = $this->extractArgument($params, 'body'); |
160: | |
161: | $endpoint = $this->endpointFactory->getEndpoint(CreateRepository::class); |
162: | $endpoint->setParams($params); |
163: | $endpoint->setRepository($repository); |
164: | $endpoint->setBody($body); |
165: | |
166: | return $this->performRequest($endpoint); |
167: | } |
168: | |
169: | /** |
170: | * Deletes a snapshot. |
171: | * |
172: | * $params['repository'] = (string) The name of the snapshot repository to delete. |
173: | * $params['snapshot'] = (string) A comma-separated list of snapshot names to delete from the repository. |
174: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
175: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
176: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
177: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
178: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
179: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
180: | * $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 "-". |
181: | * |
182: | * @param array $params Associative array of parameters |
183: | * @return array |
184: | */ |
185: | public function delete(array $params = []) |
186: | { |
187: | $repository = $this->extractArgument($params, 'repository'); |
188: | $snapshot = $this->extractArgument($params, 'snapshot'); |
189: | |
190: | $endpoint = $this->endpointFactory->getEndpoint(Delete::class); |
191: | $endpoint->setParams($params); |
192: | $endpoint->setRepository($repository); |
193: | $endpoint->setSnapshot($snapshot); |
194: | |
195: | return $this->performRequest($endpoint); |
196: | } |
197: | |
198: | /** |
199: | * Deletes a snapshot repository. |
200: | * |
201: | * $params['repository'] = (array) The name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. |
202: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
203: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
204: | * $params['timeout'] = (string) The amount of time to wait for a response. |
205: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
206: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
207: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
208: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
209: | * $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 "-". |
210: | * |
211: | * @param array $params Associative array of parameters |
212: | * @return array |
213: | */ |
214: | public function deleteRepository(array $params = []) |
215: | { |
216: | $repository = $this->extractArgument($params, 'repository'); |
217: | |
218: | $endpoint = $this->endpointFactory->getEndpoint(DeleteRepository::class); |
219: | $endpoint->setParams($params); |
220: | $endpoint->setRepository($repository); |
221: | |
222: | return $this->performRequest($endpoint); |
223: | } |
224: | |
225: | /** |
226: | * Returns information about a snapshot. |
227: | * |
228: | * $params['repository'] = (string) A comma-separated list of snapshot repository names used to limit the request. Wildcard (*) expressions are supported. |
229: | * $params['snapshot'] = (array) A comma-separated list of snapshot names to retrieve. Also accepts wildcard expressions. (`*`). - 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`. |
230: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
231: | * $params['ignore_unavailable'] = (boolean) When `false`, the request returns an error for any snapshots that are unavailable. (Default = false) |
232: | * $params['master_timeout'] = (string) Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. |
233: | * $params['verbose'] = (boolean) When `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 contained in the snapshot. |
234: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
235: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
236: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
237: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
238: | * $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 "-". |
239: | * |
240: | * @param array $params Associative array of parameters |
241: | * @return array |
242: | */ |
243: | public function get(array $params = []) |
244: | { |
245: | $repository = $this->extractArgument($params, 'repository'); |
246: | $snapshot = $this->extractArgument($params, 'snapshot'); |
247: | |
248: | $endpoint = $this->endpointFactory->getEndpoint(Get::class); |
249: | $endpoint->setParams($params); |
250: | $endpoint->setRepository($repository); |
251: | $endpoint->setSnapshot($snapshot); |
252: | |
253: | return $this->performRequest($endpoint); |
254: | } |
255: | |
256: | /** |
257: | * Returns information about a snapshot repository. |
258: | * |
259: | * $params['repository'] = (array) A comma-separated list of repository names. |
260: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
261: | * $params['local'] = (boolean) Whether to get information from the local node. (Default = false) |
262: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
263: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
264: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
265: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
266: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
267: | * $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 "-". |
268: | * |
269: | * @param array $params Associative array of parameters |
270: | * @return array |
271: | */ |
272: | public function getRepository(array $params = []) |
273: | { |
274: | $repository = $this->extractArgument($params, 'repository'); |
275: | |
276: | $endpoint = $this->endpointFactory->getEndpoint(GetRepository::class); |
277: | $endpoint->setParams($params); |
278: | $endpoint->setRepository($repository); |
279: | |
280: | return $this->performRequest($endpoint); |
281: | } |
282: | |
283: | /** |
284: | * Restores a snapshot. |
285: | * |
286: | * $params['repository'] = (string) The name of the repository containing the snapshot |
287: | * $params['snapshot'] = (string) The name of the snapshot to restore. |
288: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
289: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
290: | * $params['wait_for_completion'] = (boolean) -| Whether to return a response after the restore operation has completed. When `false`, the request returns a response when the restore operation initializes. When `true`, the request returns a response when the restore operation completes. (Default = false) |
291: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
292: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
293: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
294: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
295: | * $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 "-". |
296: | * $params['body'] = (array) Determines which settings and indexes to restore when restoring a snapshot |
297: | * |
298: | * @param array $params Associative array of parameters |
299: | * @return array |
300: | */ |
301: | public function restore(array $params = []) |
302: | { |
303: | $repository = $this->extractArgument($params, 'repository'); |
304: | $snapshot = $this->extractArgument($params, 'snapshot'); |
305: | $body = $this->extractArgument($params, 'body'); |
306: | |
307: | $endpoint = $this->endpointFactory->getEndpoint(Restore::class); |
308: | $endpoint->setParams($params); |
309: | $endpoint->setRepository($repository); |
310: | $endpoint->setSnapshot($snapshot); |
311: | $endpoint->setBody($body); |
312: | |
313: | return $this->performRequest($endpoint); |
314: | } |
315: | |
316: | /** |
317: | * Returns information about the status of a snapshot. |
318: | * |
319: | * $params['repository'] = (string) The name of the repository containing the snapshot. |
320: | * $params['snapshot'] = (array) A comma-separated list of snapshot names. |
321: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
322: | * $params['ignore_unavailable'] = (boolean) Whether to ignore any unavailable snapshots, When `false`, a `SnapshotMissingException` is thrown. (Default = false) |
323: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
324: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
325: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
326: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
327: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
328: | * $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 "-". |
329: | * |
330: | * @param array $params Associative array of parameters |
331: | * @return array |
332: | */ |
333: | public function status(array $params = []) |
334: | { |
335: | $repository = $this->extractArgument($params, 'repository'); |
336: | $snapshot = $this->extractArgument($params, 'snapshot'); |
337: | |
338: | $endpoint = $this->endpointFactory->getEndpoint(Status::class); |
339: | $endpoint->setParams($params); |
340: | $endpoint->setRepository($repository); |
341: | $endpoint->setSnapshot($snapshot); |
342: | |
343: | return $this->performRequest($endpoint); |
344: | } |
345: | |
346: | /** |
347: | * Verifies a repository. |
348: | * |
349: | * $params['repository'] = (string) The name of the repository containing the snapshot. |
350: | * $params['cluster_manager_timeout'] = (string) The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |
351: | * $params['master_timeout'] = (string) Explicit operation timeout for connection to cluster-manager node |
352: | * $params['timeout'] = (string) The amount of time to wait for a response. |
353: | * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false) |
354: | * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true) |
355: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
356: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
357: | * $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 "-". |
358: | * |
359: | * @param array $params Associative array of parameters |
360: | * @return array |
361: | */ |
362: | public function verifyRepository(array $params = []) |
363: | { |
364: | $repository = $this->extractArgument($params, 'repository'); |
365: | |
366: | $endpoint = $this->endpointFactory->getEndpoint(VerifyRepository::class); |
367: | $endpoint->setParams($params); |
368: | $endpoint->setRepository($repository); |
369: | |
370: | return $this->performRequest($endpoint); |
371: | } |
372: | |
373: | } |
374: |