Get.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices\Aliases;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. /**
  5. * Class Get
  6. *
  7. * @category Elasticsearch
  8. * @package Elasticsearch\Endpoints\Indices\Aliases
  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 alias names to filter
  16. private $name;
  17. /**
  18. * @param $name
  19. *
  20. * @return $this
  21. */
  22. public function setName($name)
  23. {
  24. if (isset($name) !== true) {
  25. return $this;
  26. }
  27. $this->name = $name;
  28. return $this;
  29. }
  30. /**
  31. * @return string
  32. */
  33. public function getURI()
  34. {
  35. $index = $this->index;
  36. $name = $this->name;
  37. $uri = "/_aliases";
  38. if (isset($index) === true && isset($name) === true) {
  39. $uri = "/$index/_aliases/$name";
  40. } elseif (isset($name) === true) {
  41. $uri = "/_aliases/$name";
  42. } elseif (isset($index) === true) {
  43. $uri = "/$index/_aliases";
  44. }
  45. return $uri;
  46. }
  47. /**
  48. * @return string[]
  49. */
  50. public function getParamWhitelist()
  51. {
  52. return array(
  53. 'timeout',
  54. 'local',
  55. );
  56. }
  57. /**
  58. * @return string
  59. */
  60. public function getMethod()
  61. {
  62. return 'GET';
  63. }
  64. }