| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <?php
- namespace Elasticsearch\Namespaces;
- /**
- * Class SnapshotNamespace
- *
- * @category Elasticsearch
- * @package Elasticsearch\Namespaces\SnapshotNamespace
- * @author Zachary Tong <zach@elastic.co>
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
- * @link http://elastic.co
- */
- class SnapshotNamespace extends AbstractNamespace
- {
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- * ['wait_for_completion'] = (bool) Should this request wait until the operation has completed before returning
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function create($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- $snapshot = $this->extractArgument($params, 'snapshot');
- $body = $this->extractArgument($params, 'body');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Create $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Create');
- $endpoint->setRepository($repository)
- ->setSnapshot($snapshot)
- ->setParams($params)
- ->setBody($body);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- * ['timeout'] = (time) Explicit operation timeout
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function createRepository($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- $body = $this->extractArgument($params, 'body');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Create $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Repository\Create');
- $endpoint->setRepository($repository)
- ->setBody($body)
- ->setParams($params);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function delete($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- $snapshot = $this->extractArgument($params, 'snapshot');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Delete $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Delete');
- $endpoint->setRepository($repository)
- ->setSnapshot($snapshot)
- ->setParams($params);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- * ['timeout'] = (time) Explicit operation timeout
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function deleteRepository($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Delete $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Repository\Delete');
- $endpoint->setRepository($repository)
- ->setParams($params);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function get($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- $snapshot = $this->extractArgument($params, 'snapshot');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Get $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Get');
- $endpoint->setRepository($repository)
- ->setSnapshot($snapshot)
- ->setParams($params);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- * ['timeout'] = (time) Explicit operation timeout
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function getRepository($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Get $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Repository\Get');
- $endpoint->setRepository($repository)
- ->setParams($params);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- * ['wait_for_completion'] = (bool) Should this request wait until the operation has completed before returning
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function restore($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- $snapshot = $this->extractArgument($params, 'snapshot');
- $body = $this->extractArgument($params, 'body');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Restore $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Restore');
- $endpoint->setRepository($repository)
- ->setSnapshot($snapshot)
- ->setParams($params)
- ->setBody($body);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function status($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- $snapshot = $this->extractArgument($params, 'snapshot');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Status $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Status');
- $endpoint->setRepository($repository)
- ->setSnapshot($snapshot)
- ->setParams($params);
- return $this->performRequest($endpoint);
- }
- /**
- * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node
- * ['timeout'] = (time) Explicit operation timeout
- *
- * @param $params array Associative array of parameters
- *
- * @return array
- */
- public function verifyRepository($params = array())
- {
- $repository = $this->extractArgument($params, 'repository');
- /** @var callback $endpointBuilder */
- $endpointBuilder = $this->endpoints;
- /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Verify $endpoint */
- $endpoint = $endpointBuilder('Snapshot\Repository\Verify');
- $endpoint->setRepository($repository)
- ->setParams($params);
- return $this->performRequest($endpoint);
- }
- }
|