Snapshots.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace Elasticsearch\Endpoints\Cat;
  3. use Elasticsearch\Common\Exceptions\RuntimeException;
  4. use Elasticsearch\Endpoints\AbstractEndpoint;
  5. /**
  6. * Class Snapshots
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Cat
  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 Snapshots extends AbstractEndpoint
  15. {
  16. private $repository;
  17. /**
  18. * @param $fields
  19. *
  20. * @return $this
  21. */
  22. public function setRepository($repository)
  23. {
  24. if (isset($repository) !== true) {
  25. return $this;
  26. }
  27. $this->repository = $repository;
  28. return $this;
  29. }
  30. /**
  31. * @return string
  32. */
  33. public function getURI()
  34. {
  35. $repository = $this->repository;
  36. if (isset($this->repository) === true) {
  37. return "/_cat/snapshots/$repository/";
  38. }
  39. return "/_cat/snapshots/";
  40. }
  41. /**
  42. * @return string[]
  43. */
  44. public function getParamWhitelist()
  45. {
  46. return array(
  47. 'local',
  48. 'master_timeout',
  49. 'h',
  50. 'help',
  51. 'v',
  52. 's',
  53. 'format',
  54. );
  55. }
  56. /**
  57. * @return string
  58. */
  59. public function getMethod()
  60. {
  61. return 'GET';
  62. }
  63. }