|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
14
|
|
|
* |
|
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
|
16
|
|
|
* and is licensed under the MIT license. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace Elastification\Client\Repository; |
|
20
|
|
|
|
|
21
|
|
|
use Elastification\Client\ClientVersionMapInterface; |
|
22
|
|
|
use Elastification\Client\Exception\RepositoryException; |
|
23
|
|
|
|
|
24
|
|
|
class CatRepository extends AbstractRepository implements CatRepositoryInterface |
|
25
|
|
|
{ |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Gets aliases from cat api |
|
29
|
|
|
* |
|
30
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
31
|
|
|
* @author Daniel Wendlandt |
|
32
|
|
|
*/ |
|
33
|
2 |
|
public function aliases() |
|
34
|
|
|
{ |
|
35
|
2 |
|
$request = $this->createRequestInstance(self::CAT_ALIASES, null, null); |
|
36
|
|
|
|
|
37
|
1 |
|
return $this->client->send($request); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Gets allocation from cat api |
|
42
|
|
|
* |
|
43
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
44
|
|
|
*/ |
|
45
|
1 |
|
public function allocation() |
|
46
|
|
|
{ |
|
47
|
1 |
|
$request = $this->createRequestInstance(self::CAT_ALLOCATION, null, null); |
|
48
|
|
|
|
|
49
|
1 |
|
return $this->client->send($request); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Gets count from cat api |
|
54
|
|
|
* |
|
55
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
56
|
|
|
*/ |
|
57
|
1 |
|
public function count() |
|
58
|
|
|
{ |
|
59
|
1 |
|
$request = $this->createRequestInstance(self::CAT_COUNT, null, null); |
|
60
|
|
|
|
|
61
|
1 |
|
return $this->client->send($request); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Gets fielddata from cat api |
|
66
|
|
|
* |
|
67
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
68
|
|
|
*/ |
|
69
|
1 |
|
public function fielddata() |
|
70
|
|
|
{ |
|
71
|
1 |
|
$request = $this->createRequestInstance(self::CAT_FIELDDATA, null, null); |
|
72
|
|
|
|
|
73
|
1 |
|
return $this->client->send($request); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Gets health from cat api |
|
78
|
|
|
* |
|
79
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
80
|
|
|
*/ |
|
81
|
1 |
|
public function health() |
|
82
|
|
|
{ |
|
83
|
1 |
|
$request = $this->createRequestInstance(self::CAT_HEALTH, null, null); |
|
84
|
|
|
|
|
85
|
1 |
|
return $this->client->send($request); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Gets indices from cat api |
|
90
|
|
|
* |
|
91
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
92
|
|
|
*/ |
|
93
|
1 |
|
public function indices() |
|
94
|
|
|
{ |
|
95
|
1 |
|
$request = $this->createRequestInstance(self::CAT_INDICES, null, null); |
|
96
|
|
|
|
|
97
|
1 |
|
return $this->client->send($request); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Gets master from cat api |
|
102
|
|
|
* |
|
103
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
104
|
|
|
*/ |
|
105
|
1 |
|
public function master() |
|
106
|
|
|
{ |
|
107
|
1 |
|
$request = $this->createRequestInstance(self::CAT_MASTER, null, null); |
|
108
|
|
|
|
|
109
|
1 |
|
return $this->client->send($request); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Gets nodes from cat api |
|
114
|
|
|
* |
|
115
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
116
|
|
|
*/ |
|
117
|
1 |
|
public function nodes() |
|
118
|
|
|
{ |
|
119
|
1 |
|
$request = $this->createRequestInstance(self::CAT_NODES, null, null); |
|
120
|
|
|
|
|
121
|
1 |
|
return $this->client->send($request); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* Gets pending tasks from cat api |
|
126
|
|
|
* |
|
127
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
128
|
|
|
*/ |
|
129
|
1 |
|
public function pendingTasks() |
|
130
|
|
|
{ |
|
131
|
1 |
|
$request = $this->createRequestInstance(self::CAT_PENDING_TASKS, null, null); |
|
132
|
|
|
|
|
133
|
1 |
|
return $this->client->send($request); |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* Gets plugins from cat api |
|
138
|
|
|
* |
|
139
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
140
|
|
|
*/ |
|
141
|
1 |
|
public function plugins() |
|
142
|
|
|
{ |
|
143
|
1 |
|
$request = $this->createRequestInstance(self::CAT_PLUGINS, null, null); |
|
144
|
|
|
|
|
145
|
1 |
|
return $this->client->send($request); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* Gets recovery from cat api |
|
150
|
|
|
* |
|
151
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
152
|
|
|
*/ |
|
153
|
1 |
|
public function recovery() |
|
154
|
|
|
{ |
|
155
|
1 |
|
$request = $this->createRequestInstance(self::CAT_RECOVERY, null, null); |
|
156
|
|
|
|
|
157
|
1 |
|
return $this->client->send($request); |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* Gets segments from cat api |
|
162
|
|
|
* |
|
163
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
164
|
|
|
*/ |
|
165
|
1 |
|
public function segments() |
|
166
|
|
|
{ |
|
167
|
1 |
|
$request = $this->createRequestInstance(self::CAT_SEGMENTS, null, null); |
|
168
|
|
|
|
|
169
|
1 |
|
return $this->client->send($request); |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* Gets shards from cat api |
|
174
|
|
|
* |
|
175
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
176
|
|
|
*/ |
|
177
|
1 |
|
public function shards() |
|
178
|
|
|
{ |
|
179
|
1 |
|
$request = $this->createRequestInstance(self::CAT_SHARDS, null, null); |
|
180
|
|
|
|
|
181
|
1 |
|
return $this->client->send($request); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* Gets thread pool from cat api |
|
186
|
|
|
* |
|
187
|
|
|
* @return \Elastification\Client\Response\ResponseInterface |
|
188
|
|
|
*/ |
|
189
|
1 |
|
public function threadPool() |
|
190
|
|
|
{ |
|
191
|
1 |
|
$request = $this->createRequestInstance(self::CAT_THREAD_POOL, null, null); |
|
192
|
|
|
|
|
193
|
1 |
|
return $this->client->send($request); |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
/** |
|
197
|
|
|
* gets the right class string of a version |
|
198
|
|
|
* |
|
199
|
|
|
* @param string $class |
|
200
|
|
|
* |
|
201
|
|
|
* @return string |
|
202
|
|
|
* @throws RepositoryException |
|
203
|
|
|
* @author Daniel Wendlandt |
|
204
|
|
|
*/ |
|
205
|
15 |
|
protected function getClass($class) |
|
206
|
|
|
{ |
|
207
|
15 |
|
if(ClientVersionMapInterface::VERSION_V090X === $this->versionFolder) { |
|
208
|
1 |
|
throw new RepositoryException('Version folder ' . |
|
209
|
1 |
|
ClientVersionMapInterface::VERSION_V090X . ' is not allowed for cat repository'); |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
14 |
|
return parent::getClass($class); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
} |
|
216
|
|
|
|