| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | namespace OpenSearch\Endpoints\Cat; |
| 23: | |
| 24: | use OpenSearch\Endpoints\AbstractEndpoint; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | class Templates extends AbstractEndpoint |
| 30: | { |
| 31: | protected $name; |
| 32: | |
| 33: | public function getURI(): string |
| 34: | { |
| 35: | $name = $this->name ?? null; |
| 36: | if (isset($name)) { |
| 37: | return '/_cat/templates/' . rawurlencode($name); |
| 38: | } |
| 39: | return '/_cat/templates'; |
| 40: | } |
| 41: | |
| 42: | public function getParamWhitelist(): array |
| 43: | { |
| 44: | return [ |
| 45: | 'cluster_manager_timeout', |
| 46: | 'format', |
| 47: | 'h', |
| 48: | 'help', |
| 49: | 'local', |
| 50: | 'master_timeout', |
| 51: | 's', |
| 52: | 'v', |
| 53: | 'pretty', |
| 54: | 'human', |
| 55: | 'error_trace', |
| 56: | 'source', |
| 57: | 'filter_path' |
| 58: | ]; |
| 59: | } |
| 60: | |
| 61: | public function getMethod(): string |
| 62: | { |
| 63: | return 'GET'; |
| 64: | } |
| 65: | |
| 66: | public function setName($name): static |
| 67: | { |
| 68: | if (is_null($name)) { |
| 69: | return $this; |
| 70: | } |
| 71: | $this->name = $name; |
| 72: | |
| 73: | return $this; |
| 74: | } |
| 75: | |
| 76: | protected function getParamDeprecation(): array |
| 77: | { |
| 78: | return ['master_timeout' => 'cluster_manager_timeout']; |
| 79: | } |
| 80: | } |
| 81: | |