| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace Elasticsearch\Endpoints\Snapshot;
- use Elasticsearch\Endpoints\AbstractEndpoint;
- use Elasticsearch\Common\Exceptions;
- /**
- * Class Delete
- *
- * @category Elasticsearch
- * @package Elasticsearch\Endpoints\Snapshot
- * @author Zachary Tong <zach@elastic.co>
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
- * @link http://elastic.co
- */
- class Delete extends AbstractEndpoint
- {
- // A repository name
- private $repository;
- // A snapshot name
- private $snapshot;
- /**
- * @param $repository
- *
- * @return $this
- */
- public function setRepository($repository)
- {
- if (isset($repository) !== true) {
- return $this;
- }
- $this->repository = $repository;
- return $this;
- }
- /**
- * @param $snapshot
- *
- * @return $this
- */
- public function setSnapshot($snapshot)
- {
- if (isset($snapshot) !== true) {
- return $this;
- }
- $this->snapshot = $snapshot;
- return $this;
- }
- /**
- * @throws \Elasticsearch\Common\Exceptions\RuntimeException
- * @return string
- */
- public function getURI()
- {
- if (isset($this->repository) !== true) {
- throw new Exceptions\RuntimeException(
- 'repository is required for Delete'
- );
- }
- if (isset($this->snapshot) !== true) {
- throw new Exceptions\RuntimeException(
- 'snapshot is required for Delete'
- );
- }
- $repository = $this->repository;
- $snapshot = $this->snapshot;
- $uri = "/_snapshot/$repository/$snapshot";
- if (isset($repository) === true && isset($snapshot) === true) {
- $uri = "/_snapshot/$repository/$snapshot";
- }
- return $uri;
- }
- /**
- * @return string[]
- */
- public function getParamWhitelist()
- {
- return array(
- 'master_timeout',
- );
- }
- /**
- * @return string
- */
- public function getMethod()
- {
- return 'DELETE';
- }
- }
|