1<?php 2/** 3 * Elasticsearch PHP client 4 * 5 * @link https://github.com/elastic/elasticsearch-php/ 6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) 7 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 8 * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1 9 * 10 * Licensed to Elasticsearch B.V under one or more agreements. 11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or 12 * the GNU Lesser General Public License, Version 2.1, at your option. 13 * See the LICENSE file in the project root for more information. 14 */ 15declare(strict_types = 1); 16 17namespace Elasticsearch\Namespaces; 18 19use Elasticsearch\Namespaces\AbstractNamespace; 20 21/** 22 * Class SnapshotNamespace 23 * 24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php 25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee) 26 */ 27class SnapshotNamespace extends AbstractNamespace 28{ 29 30 /** 31 * Removes stale data from repository. 32 * 33 * $params['repository'] = (string) A repository name 34 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 35 * $params['timeout'] = (time) Explicit operation timeout 36 * 37 * @param array $params Associative array of parameters 38 * @return array 39 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html 40 */ 41 public function cleanupRepository(array $params = []) 42 { 43 $repository = $this->extractArgument($params, 'repository'); 44 45 $endpointBuilder = $this->endpoints; 46 $endpoint = $endpointBuilder('Snapshot\CleanupRepository'); 47 $endpoint->setParams($params); 48 $endpoint->setRepository($repository); 49 50 return $this->performRequest($endpoint); 51 } 52 /** 53 * Clones indices from one snapshot into another snapshot in the same repository. 54 * 55 * $params['repository'] = (string) A repository name 56 * $params['snapshot'] = (string) The name of the snapshot to clone from 57 * $params['target_snapshot'] = (string) The name of the cloned snapshot to create 58 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 59 * $params['body'] = (array) The snapshot clone definition (Required) 60 * 61 * @param array $params Associative array of parameters 62 * @return array 63 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 64 */ 65 public function clone(array $params = []) 66 { 67 $repository = $this->extractArgument($params, 'repository'); 68 $snapshot = $this->extractArgument($params, 'snapshot'); 69 $target_snapshot = $this->extractArgument($params, 'target_snapshot'); 70 $body = $this->extractArgument($params, 'body'); 71 72 $endpointBuilder = $this->endpoints; 73 $endpoint = $endpointBuilder('Snapshot\CloneSnapshot'); 74 $endpoint->setParams($params); 75 $endpoint->setRepository($repository); 76 $endpoint->setSnapshot($snapshot); 77 $endpoint->setTargetSnapshot($target_snapshot); 78 $endpoint->setBody($body); 79 80 return $this->performRequest($endpoint); 81 } 82 /** 83 * Creates a snapshot in a repository. 84 * 85 * $params['repository'] = (string) A repository name 86 * $params['snapshot'] = (string) A snapshot name 87 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 88 * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false) 89 * $params['body'] = (array) The snapshot definition 90 * 91 * @param array $params Associative array of parameters 92 * @return array 93 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 94 */ 95 public function create(array $params = []) 96 { 97 $repository = $this->extractArgument($params, 'repository'); 98 $snapshot = $this->extractArgument($params, 'snapshot'); 99 $body = $this->extractArgument($params, 'body'); 100 101 $endpointBuilder = $this->endpoints; 102 $endpoint = $endpointBuilder('Snapshot\Create'); 103 $endpoint->setParams($params); 104 $endpoint->setRepository($repository); 105 $endpoint->setSnapshot($snapshot); 106 $endpoint->setBody($body); 107 108 return $this->performRequest($endpoint); 109 } 110 /** 111 * Creates a repository. 112 * 113 * $params['repository'] = (string) A repository name 114 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 115 * $params['timeout'] = (time) Explicit operation timeout 116 * $params['verify'] = (boolean) Whether to verify the repository after creation 117 * $params['body'] = (array) The repository definition (Required) 118 * 119 * @param array $params Associative array of parameters 120 * @return array 121 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 122 */ 123 public function createRepository(array $params = []) 124 { 125 $repository = $this->extractArgument($params, 'repository'); 126 $body = $this->extractArgument($params, 'body'); 127 128 $endpointBuilder = $this->endpoints; 129 $endpoint = $endpointBuilder('Snapshot\CreateRepository'); 130 $endpoint->setParams($params); 131 $endpoint->setRepository($repository); 132 $endpoint->setBody($body); 133 134 return $this->performRequest($endpoint); 135 } 136 /** 137 * Deletes a snapshot. 138 * 139 * $params['repository'] = (string) A repository name 140 * $params['snapshot'] = (string) A snapshot name 141 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 142 * 143 * @param array $params Associative array of parameters 144 * @return array 145 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 146 */ 147 public function delete(array $params = []) 148 { 149 $repository = $this->extractArgument($params, 'repository'); 150 $snapshot = $this->extractArgument($params, 'snapshot'); 151 152 $endpointBuilder = $this->endpoints; 153 $endpoint = $endpointBuilder('Snapshot\Delete'); 154 $endpoint->setParams($params); 155 $endpoint->setRepository($repository); 156 $endpoint->setSnapshot($snapshot); 157 158 return $this->performRequest($endpoint); 159 } 160 /** 161 * Deletes a repository. 162 * 163 * $params['repository'] = (list) Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. 164 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 165 * $params['timeout'] = (time) Explicit operation timeout 166 * 167 * @param array $params Associative array of parameters 168 * @return array 169 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 170 */ 171 public function deleteRepository(array $params = []) 172 { 173 $repository = $this->extractArgument($params, 'repository'); 174 175 $endpointBuilder = $this->endpoints; 176 $endpoint = $endpointBuilder('Snapshot\DeleteRepository'); 177 $endpoint->setParams($params); 178 $endpoint->setRepository($repository); 179 180 return $this->performRequest($endpoint); 181 } 182 /** 183 * Returns information about a snapshot. 184 * 185 * $params['repository'] = (string) A repository name 186 * $params['snapshot'] = (list) A comma-separated list of snapshot names 187 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 188 * $params['ignore_unavailable'] = (boolean) Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown 189 * $params['index_details'] = (boolean) Whether to include details of each index in the snapshot, if those details are available. Defaults to false. 190 * $params['include_repository'] = (boolean) Whether to include the repository name in the snapshot info. Defaults to true. 191 * $params['verbose'] = (boolean) Whether to show verbose snapshot info or only show the basic info found in the repository index blob 192 * 193 * @param array $params Associative array of parameters 194 * @return array 195 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 196 */ 197 public function get(array $params = []) 198 { 199 $repository = $this->extractArgument($params, 'repository'); 200 $snapshot = $this->extractArgument($params, 'snapshot'); 201 202 $endpointBuilder = $this->endpoints; 203 $endpoint = $endpointBuilder('Snapshot\Get'); 204 $endpoint->setParams($params); 205 $endpoint->setRepository($repository); 206 $endpoint->setSnapshot($snapshot); 207 208 return $this->performRequest($endpoint); 209 } 210 /** 211 * Returns information about a repository. 212 * 213 * $params['repository'] = (list) A comma-separated list of repository names 214 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 215 * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) 216 * 217 * @param array $params Associative array of parameters 218 * @return array 219 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 220 */ 221 public function getRepository(array $params = []) 222 { 223 $repository = $this->extractArgument($params, 'repository'); 224 225 $endpointBuilder = $this->endpoints; 226 $endpoint = $endpointBuilder('Snapshot\GetRepository'); 227 $endpoint->setParams($params); 228 $endpoint->setRepository($repository); 229 230 return $this->performRequest($endpoint); 231 } 232 /** 233 * Analyzes a repository for correctness and performance 234 * 235 * $params['repository'] = (string) A repository name 236 * $params['blob_count'] = (number) Number of blobs to create during the test. Defaults to 100. 237 * $params['concurrency'] = (number) Number of operations to run concurrently during the test. Defaults to 10. 238 * $params['read_node_count'] = (number) Number of nodes on which to read a blob after writing. Defaults to 10. 239 * $params['early_read_node_count'] = (number) Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2. 240 * $params['seed'] = (number) Seed for the random number generator used to create the test workload. Defaults to a random value. 241 * $params['rare_action_probability'] = (number) Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. 242 * $params['max_blob_size'] = (string) Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'. 243 * $params['max_total_data_size'] = (string) Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. 244 * $params['timeout'] = (time) Explicit operation timeout. Defaults to '30s'. 245 * $params['detailed'] = (boolean) Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned. 246 * $params['rarely_abort_writes'] = (boolean) Whether to rarely abort writes before they complete. Defaults to 'true'. 247 * 248 * @param array $params Associative array of parameters 249 * @return array 250 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 251 */ 252 public function repositoryAnalyze(array $params = []) 253 { 254 $repository = $this->extractArgument($params, 'repository'); 255 256 $endpointBuilder = $this->endpoints; 257 $endpoint = $endpointBuilder('Snapshot\RepositoryAnalyze'); 258 $endpoint->setParams($params); 259 $endpoint->setRepository($repository); 260 261 return $this->performRequest($endpoint); 262 } 263 /** 264 * Restores a snapshot. 265 * 266 * $params['repository'] = (string) A repository name 267 * $params['snapshot'] = (string) A snapshot name 268 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 269 * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false) 270 * $params['body'] = (array) Details of what to restore 271 * 272 * @param array $params Associative array of parameters 273 * @return array 274 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 275 */ 276 public function restore(array $params = []) 277 { 278 $repository = $this->extractArgument($params, 'repository'); 279 $snapshot = $this->extractArgument($params, 'snapshot'); 280 $body = $this->extractArgument($params, 'body'); 281 282 $endpointBuilder = $this->endpoints; 283 $endpoint = $endpointBuilder('Snapshot\Restore'); 284 $endpoint->setParams($params); 285 $endpoint->setRepository($repository); 286 $endpoint->setSnapshot($snapshot); 287 $endpoint->setBody($body); 288 289 return $this->performRequest($endpoint); 290 } 291 /** 292 * Returns information about the status of a snapshot. 293 * 294 * $params['repository'] = (string) A repository name 295 * $params['snapshot'] = (list) A comma-separated list of snapshot names 296 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 297 * $params['ignore_unavailable'] = (boolean) Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown 298 * 299 * @param array $params Associative array of parameters 300 * @return array 301 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 302 */ 303 public function status(array $params = []) 304 { 305 $repository = $this->extractArgument($params, 'repository'); 306 $snapshot = $this->extractArgument($params, 'snapshot'); 307 308 $endpointBuilder = $this->endpoints; 309 $endpoint = $endpointBuilder('Snapshot\Status'); 310 $endpoint->setParams($params); 311 $endpoint->setRepository($repository); 312 $endpoint->setSnapshot($snapshot); 313 314 return $this->performRequest($endpoint); 315 } 316 /** 317 * Verifies a repository. 318 * 319 * $params['repository'] = (string) A repository name 320 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 321 * $params['timeout'] = (time) Explicit operation timeout 322 * 323 * @param array $params Associative array of parameters 324 * @return array 325 * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html 326 */ 327 public function verifyRepository(array $params = []) 328 { 329 $repository = $this->extractArgument($params, 'repository'); 330 331 $endpointBuilder = $this->endpoints; 332 $endpoint = $endpointBuilder('Snapshot\VerifyRepository'); 333 $endpoint->setParams($params); 334 $endpoint->setRepository($repository); 335 336 return $this->performRequest($endpoint); 337 } 338} 339