YARN-8091. Revisit checkUserAccessToQueue RM REST API. (wangda)
[hadoop.git] / hadoop-yarn-project / hadoop-yarn / hadoop-yarn-server / hadoop-yarn-server-router / src / main / java / org / apache / hadoop / yarn / server / router / webapp / DefaultRequestInterceptorREST.java
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.hadoop.yarn.server.router.webapp;
20
21 import java.io.IOException;
22 import java.util.HashMap;
23 import java.util.Map;
24 import java.util.Set;
25
26 import javax.servlet.http.HttpServletRequest;
27 import javax.servlet.http.HttpServletResponse;
28 import javax.ws.rs.core.Response;
29
30 import org.apache.hadoop.security.authorize.AuthorizationException;
31 import org.apache.hadoop.yarn.exceptions.YarnException;
32 import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
33 import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId;
34 import org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts;
35 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ActivitiesInfo;
36 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppActivitiesInfo;
37 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppAttemptsInfo;
38 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
39 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppPriority;
40 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppQueue;
41 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppState;
42 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutInfo;
43 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutsInfo;
44 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo;
45 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo;
46 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo;
47 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfo;
48 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo;
49 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.DelegationToken;
50 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.LabelsToNodesInfo;
51 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo;
52 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo;
53 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsEntryList;
54 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo;
55 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo;
56 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.RMQueueAclInfo;
57 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationDeleteRequestInfo;
58 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationSubmissionRequestInfo;
59 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationUpdateRequestInfo;
60 import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfo;
61 import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo;
62 import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo;
63 import org.apache.hadoop.yarn.server.webapp.dao.ContainersInfo;
64 import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
65
66 /**
67 * Extends the AbstractRequestInterceptorClient class and provides an
68 * implementation that simply forwards the client requests to the resource
69 * manager.
70 */
71 public class DefaultRequestInterceptorREST
72 extends AbstractRESTRequestInterceptor {
73
74 private String webAppAddress;
75 private SubClusterId subClusterId = null;
76
77 public void setWebAppAddress(String webAppAddress) {
78 this.webAppAddress = webAppAddress;
79 }
80
81 protected void setSubClusterId(SubClusterId scId) {
82 this.subClusterId = scId;
83 }
84
85 protected SubClusterId getSubClusterId() {
86 return this.subClusterId;
87 }
88
89 @Override
90 public void init(String user) {
91 webAppAddress = WebAppUtils.getRMWebAppURLWithScheme(getConf());
92 }
93
94 @Override
95 public ClusterInfo get() {
96 return getClusterInfo();
97 }
98
99 @Override
100 public ClusterInfo getClusterInfo() {
101 return RouterWebServiceUtil.genericForward(webAppAddress, null,
102 ClusterInfo.class, HTTPMethods.GET,
103 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.INFO, null, null);
104 }
105
106 @Override
107 public ClusterMetricsInfo getClusterMetricsInfo() {
108 return RouterWebServiceUtil.genericForward(webAppAddress, null,
109 ClusterMetricsInfo.class, HTTPMethods.GET,
110 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.METRICS, null, null);
111 }
112
113 @Override
114 public SchedulerTypeInfo getSchedulerInfo() {
115 return RouterWebServiceUtil.genericForward(webAppAddress, null,
116 SchedulerTypeInfo.class, HTTPMethods.GET,
117 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.SCHEDULER, null, null);
118 }
119
120 @Override
121 public String dumpSchedulerLogs(String time, HttpServletRequest hsr)
122 throws IOException {
123 // time is specified inside hsr
124 return RouterWebServiceUtil.genericForward(webAppAddress, null,
125 String.class, HTTPMethods.GET,
126 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.SCHEDULER_LOGS, null, null);
127 }
128
129 @Override
130 public NodesInfo getNodes(String states) {
131 // states will be part of additionalParam
132 Map<String, String[]> additionalParam = new HashMap<String, String[]>();
133 if (states != null && !states.isEmpty()) {
134 additionalParam.put(RMWSConsts.STATES, new String[] {states});
135 }
136 return RouterWebServiceUtil.genericForward(webAppAddress, null,
137 NodesInfo.class, HTTPMethods.GET,
138 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.NODES, null,
139 additionalParam);
140 }
141
142 @Override
143 public NodeInfo getNode(String nodeId) {
144 return RouterWebServiceUtil.genericForward(webAppAddress, null,
145 NodeInfo.class, HTTPMethods.GET,
146 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.NODES + "/" + nodeId, null,
147 null);
148 }
149
150 @Override
151 public AppsInfo getApps(HttpServletRequest hsr, String stateQuery,
152 Set<String> statesQuery, String finalStatusQuery, String userQuery,
153 String queueQuery, String count, String startedBegin, String startedEnd,
154 String finishBegin, String finishEnd, Set<String> applicationTypes,
155 Set<String> applicationTags, Set<String> unselectedFields) {
156 // all the params are specified inside hsr
157 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
158 AppsInfo.class, HTTPMethods.GET,
159 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS, null, null);
160 }
161
162 @Override
163 public ActivitiesInfo getActivities(HttpServletRequest hsr, String nodeId) {
164 // nodeId is specified inside hsr
165 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
166 ActivitiesInfo.class, HTTPMethods.GET,
167 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.SCHEDULER_ACTIVITIES, null,
168 null);
169 }
170
171 @Override
172 public AppActivitiesInfo getAppActivities(HttpServletRequest hsr,
173 String appId, String time) {
174 // time and appId are specified inside hsr
175 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
176 AppActivitiesInfo.class, HTTPMethods.GET,
177 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.SCHEDULER_APP_ACTIVITIES,
178 null, null);
179 }
180
181 @Override
182 public ApplicationStatisticsInfo getAppStatistics(HttpServletRequest hsr,
183 Set<String> stateQueries, Set<String> typeQueries) {
184 // stateQueries and typeQueries are specified inside hsr
185 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
186 ApplicationStatisticsInfo.class, HTTPMethods.GET,
187 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APP_STATISTICS, null, null);
188 }
189
190 @Override
191 public AppInfo getApp(HttpServletRequest hsr, String appId,
192 Set<String> unselectedFields) {
193 // unselectedFields is specified inside hsr
194 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
195 AppInfo.class, HTTPMethods.GET,
196 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS + "/" + appId, null,
197 null);
198 }
199
200 @Override
201 public AppState getAppState(HttpServletRequest hsr, String appId)
202 throws AuthorizationException {
203 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
204 AppState.class, HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH
205 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.STATE,
206 null, null);
207 }
208
209 @Override
210 public Response updateAppState(AppState targetState, HttpServletRequest hsr,
211 String appId) throws AuthorizationException, YarnException,
212 InterruptedException, IOException {
213 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
214 Response.class, HTTPMethods.PUT, RMWSConsts.RM_WEB_SERVICE_PATH
215 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.STATE,
216 targetState, null);
217 }
218
219 @Override
220 public NodeToLabelsInfo getNodeToLabels(HttpServletRequest hsr)
221 throws IOException {
222 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
223 NodeToLabelsInfo.class, HTTPMethods.GET,
224 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.GET_NODE_TO_LABELS, null,
225 null);
226 }
227
228 @Override
229 public LabelsToNodesInfo getLabelsToNodes(Set<String> labels)
230 throws IOException {
231 // labels will be part of additionalParam
232 Map<String, String[]> additionalParam = new HashMap<>();
233 if (labels != null && !labels.isEmpty()) {
234 additionalParam.put(RMWSConsts.LABELS,
235 labels.toArray(new String[labels.size()]));
236 }
237 return RouterWebServiceUtil.genericForward(webAppAddress, null,
238 LabelsToNodesInfo.class, HTTPMethods.GET,
239 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.LABEL_MAPPINGS, null,
240 additionalParam);
241 }
242
243 @Override
244 public Response replaceLabelsOnNodes(NodeToLabelsEntryList newNodeToLabels,
245 HttpServletRequest hsr) throws IOException {
246 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
247 Response.class, HTTPMethods.POST,
248 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.REPLACE_NODE_TO_LABELS,
249 newNodeToLabels, null);
250 }
251
252 @Override
253 public Response replaceLabelsOnNode(Set<String> newNodeLabelsName,
254 HttpServletRequest hsr, String nodeId) throws Exception {
255 // newNodeLabelsName is specified inside hsr
256 return RouterWebServiceUtil
257 .genericForward(webAppAddress, hsr,
258 Response.class, HTTPMethods.POST, RMWSConsts.RM_WEB_SERVICE_PATH
259 + RMWSConsts.NODES + "/" + nodeId + "/replace-labels",
260 null, null);
261 }
262
263 @Override
264 public NodeLabelsInfo getClusterNodeLabels(HttpServletRequest hsr)
265 throws IOException {
266 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
267 NodeLabelsInfo.class, HTTPMethods.GET,
268 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.GET_NODE_LABELS, null,
269 null);
270 }
271
272 @Override
273 public Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels,
274 HttpServletRequest hsr) throws Exception {
275 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
276 Response.class, HTTPMethods.POST,
277 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.ADD_NODE_LABELS,
278 newNodeLabels, null);
279 }
280
281 @Override
282 public Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
283 HttpServletRequest hsr) throws Exception {
284 // oldNodeLabels is specified inside hsr
285 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
286 Response.class, HTTPMethods.POST,
287 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.REMOVE_NODE_LABELS, null,
288 null);
289 }
290
291 @Override
292 public NodeLabelsInfo getLabelsOnNode(HttpServletRequest hsr, String nodeId)
293 throws IOException {
294 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
295 NodeLabelsInfo.class, HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH
296 + RMWSConsts.NODES + "/" + nodeId + "/get-labels",
297 null, null);
298 }
299
300 @Override
301 public AppPriority getAppPriority(HttpServletRequest hsr, String appId)
302 throws AuthorizationException {
303 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
304 AppPriority.class, HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH
305 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.PRIORITY,
306 null, null);
307 }
308
309 @Override
310 public Response updateApplicationPriority(AppPriority targetPriority,
311 HttpServletRequest hsr, String appId) throws AuthorizationException,
312 YarnException, InterruptedException, IOException {
313 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
314 Response.class, HTTPMethods.PUT, RMWSConsts.RM_WEB_SERVICE_PATH
315 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.PRIORITY,
316 targetPriority, null);
317 }
318
319 @Override
320 public AppQueue getAppQueue(HttpServletRequest hsr, String appId)
321 throws AuthorizationException {
322 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
323 AppQueue.class, HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH
324 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.QUEUE,
325 null, null);
326 }
327
328 @Override
329 public Response updateAppQueue(AppQueue targetQueue, HttpServletRequest hsr,
330 String appId) throws AuthorizationException, YarnException,
331 InterruptedException, IOException {
332 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
333 Response.class, HTTPMethods.PUT, RMWSConsts.RM_WEB_SERVICE_PATH
334 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.QUEUE,
335 targetQueue, null);
336 }
337
338 @Override
339 public Response createNewApplication(HttpServletRequest hsr)
340 throws AuthorizationException, IOException, InterruptedException {
341 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
342 Response.class, HTTPMethods.POST,
343 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS_NEW_APPLICATION, null,
344 null);
345 }
346
347 @Override
348 public Response submitApplication(ApplicationSubmissionContextInfo newApp,
349 HttpServletRequest hsr)
350 throws AuthorizationException, IOException, InterruptedException {
351 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
352 Response.class, HTTPMethods.POST,
353 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS, newApp, null);
354 }
355
356 @Override
357 public Response postDelegationToken(DelegationToken tokenData,
358 HttpServletRequest hsr) throws AuthorizationException, IOException,
359 InterruptedException, Exception {
360 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
361 Response.class, HTTPMethods.POST,
362 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.DELEGATION_TOKEN, tokenData,
363 null);
364 }
365
366 @Override
367 public Response postDelegationTokenExpiration(HttpServletRequest hsr)
368 throws AuthorizationException, IOException, InterruptedException,
369 Exception {
370 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
371 Response.class, HTTPMethods.POST,
372 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.DELEGATION_TOKEN_EXPIRATION,
373 null, null);
374 }
375
376 @Override
377 public Response cancelDelegationToken(HttpServletRequest hsr)
378 throws AuthorizationException, IOException, InterruptedException,
379 Exception {
380 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
381 Response.class, HTTPMethods.DELETE,
382 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.DELEGATION_TOKEN, null,
383 null);
384 }
385
386 @Override
387 public Response createNewReservation(HttpServletRequest hsr)
388 throws AuthorizationException, IOException, InterruptedException {
389 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
390 Response.class, HTTPMethods.POST,
391 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.RESERVATION_NEW, null,
392 null);
393 }
394
395 @Override
396 public Response submitReservation(ReservationSubmissionRequestInfo resContext,
397 HttpServletRequest hsr)
398 throws AuthorizationException, IOException, InterruptedException {
399 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
400 Response.class, HTTPMethods.POST,
401 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.RESERVATION_SUBMIT,
402 resContext, null);
403 }
404
405 @Override
406 public Response updateReservation(ReservationUpdateRequestInfo resContext,
407 HttpServletRequest hsr)
408 throws AuthorizationException, IOException, InterruptedException {
409 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
410 Response.class, HTTPMethods.POST,
411 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.RESERVATION_UPDATE,
412 resContext, null);
413 }
414
415 @Override
416 public Response deleteReservation(ReservationDeleteRequestInfo resContext,
417 HttpServletRequest hsr)
418 throws AuthorizationException, IOException, InterruptedException {
419 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
420 Response.class, HTTPMethods.POST,
421 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.RESERVATION_DELETE,
422 resContext, null);
423 }
424
425 @Override
426 public Response listReservation(String queue, String reservationId,
427 long startTime, long endTime, boolean includeResourceAllocations,
428 HttpServletRequest hsr) throws Exception {
429 // queue, reservationId, startTime, endTime, includeResourceAllocations are
430 // specified inside hsr
431 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
432 Response.class, HTTPMethods.GET,
433 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.RESERVATION_LIST, null,
434 null);
435 }
436
437 @Override
438 public AppTimeoutInfo getAppTimeout(HttpServletRequest hsr, String appId,
439 String type) throws AuthorizationException {
440 return RouterWebServiceUtil
441 .genericForward(webAppAddress, hsr, AppTimeoutInfo.class,
442 HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS
443 + "/" + appId + "/" + RMWSConsts.TIMEOUTS + "/" + type,
444 null, null);
445 }
446
447 @Override
448 public AppTimeoutsInfo getAppTimeouts(HttpServletRequest hsr, String appId)
449 throws AuthorizationException {
450 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
451 AppTimeoutsInfo.class, HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH
452 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.TIMEOUTS,
453 null, null);
454 }
455
456 @Override
457 public Response updateApplicationTimeout(AppTimeoutInfo appTimeout,
458 HttpServletRequest hsr, String appId) throws AuthorizationException,
459 YarnException, InterruptedException, IOException {
460 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
461 Response.class, HTTPMethods.PUT, RMWSConsts.RM_WEB_SERVICE_PATH
462 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.TIMEOUT,
463 appTimeout, null);
464 }
465
466 @Override
467 public AppAttemptsInfo getAppAttempts(HttpServletRequest hsr, String appId) {
468 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
469 AppAttemptsInfo.class, HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH
470 + RMWSConsts.APPS + "/" + appId + "/" + RMWSConsts.APPATTEMPTS,
471 null, null);
472 }
473
474 @Override
475 public RMQueueAclInfo checkUserAccessToQueue(String queue, String username,
476 String queueAclType, HttpServletRequest hsr) {
477 return RouterWebServiceUtil.genericForward(webAppAddress, hsr,
478 RMQueueAclInfo.class, HTTPMethods.GET,
479 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.QUEUES + "/" + queue
480 + "/access", null, null);
481 }
482
483 @Override
484 public AppAttemptInfo getAppAttempt(HttpServletRequest req,
485 HttpServletResponse res, String appId, String appAttemptId) {
486 return RouterWebServiceUtil.genericForward(webAppAddress, req,
487 AppAttemptInfo.class,
488 HTTPMethods.GET, RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS + "/"
489 + appId + "/" + RMWSConsts.APPATTEMPTS + "/" + appAttemptId,
490 null, null);
491 }
492
493 @Override
494 public ContainersInfo getContainers(HttpServletRequest req,
495 HttpServletResponse res, String appId, String appAttemptId) {
496 return RouterWebServiceUtil.genericForward(webAppAddress, req,
497 ContainersInfo.class, HTTPMethods.GET,
498 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS + "/" + appId + "/"
499 + RMWSConsts.APPATTEMPTS + "/" + appAttemptId + "/"
500 + RMWSConsts.CONTAINERS,
501 null, null);
502 }
503
504 @Override
505 public ContainerInfo getContainer(HttpServletRequest req,
506 HttpServletResponse res, String appId, String appAttemptId,
507 String containerId) {
508 return RouterWebServiceUtil.genericForward(webAppAddress, req,
509 ContainerInfo.class, HTTPMethods.GET,
510 RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.APPS + "/" + appId + "/"
511 + RMWSConsts.APPATTEMPTS + "/" + appAttemptId + "/"
512 + RMWSConsts.CONTAINERS + "/" + containerId,
513 null, null);
514 }
515
516 @Override
517 public void setNextInterceptor(RESTRequestInterceptor next) {
518 throw new YarnRuntimeException("setNextInterceptor is being called on "
519 + "DefaultRequestInterceptorREST, which should be the last one "
520 + "in the chain. Check if the interceptor pipeline configuration "
521 + "is correct");
522 }
523
524 }