Get.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace Elasticsearch\Endpoints\Snapshot\Repository;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. /**
  5. * Class Get
  6. *
  7. * @category Elasticsearch
  8. * @package Elasticsearch\Endpoints\Snapshot\Repository
  9. * @author Zachary Tong <zach@elastic.co>
  10. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  11. * @link http://elastic.co
  12. */
  13. class Get extends AbstractEndpoint
  14. {
  15. // A comma-separated list of repository names
  16. private $repository;
  17. /**
  18. * @param $repository
  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. $uri = "/_snapshot";
  37. if (isset($repository) === true) {
  38. $uri = "/_snapshot/$repository";
  39. }
  40. return $uri;
  41. }
  42. /**
  43. * @return string[]
  44. */
  45. public function getParamWhitelist()
  46. {
  47. return array(
  48. 'master_timeout',
  49. 'local',
  50. );
  51. }
  52. /**
  53. * @return string
  54. */
  55. public function getMethod()
  56. {
  57. return 'GET';
  58. }
  59. }