Verify.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace Elasticsearch\Endpoints\Snapshot\Repository;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class Verify
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Snapshot\Repository
  10. * @author Zachary Tong <zach@elastic.co>
  11. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  12. * @link http://elastic.co
  13. */
  14. class Verify extends AbstractEndpoint
  15. {
  16. // A comma-separated list of repository names
  17. private $repository;
  18. /**
  19. * @param $repository
  20. *
  21. * @return $this
  22. */
  23. public function setRepository($repository)
  24. {
  25. if (isset($repository) !== true) {
  26. return $this;
  27. }
  28. $this->repository = $repository;
  29. return $this;
  30. }
  31. /**
  32. * @throws \Elasticsearch\Common\Exceptions\RuntimeException
  33. * @return string
  34. */
  35. public function getURI()
  36. {
  37. $repository = $this->repository;
  38. if (isset($this->repository) !== true) {
  39. throw new Exceptions\RuntimeException(
  40. 'repository is required for Verify'
  41. );
  42. }
  43. $uri = "/_snapshot/$repository/_verify";
  44. return $uri;
  45. }
  46. /**
  47. * @return string[]
  48. */
  49. public function getParamWhitelist()
  50. {
  51. return array(
  52. 'master_timeout',
  53. 'local',
  54. );
  55. }
  56. /**
  57. * @return string
  58. */
  59. public function getMethod()
  60. {
  61. return 'POST';
  62. }
  63. }