Get.php 1.3 KB

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