YARN-8091. Revisit checkUserAccessToQueue RM REST API. (wangda)
[hadoop.git] / hadoop-yarn-project / hadoop-yarn / hadoop-yarn-server / hadoop-yarn-server-resourcemanager / src / main / java / org / apache / hadoop / yarn / server / resourcemanager / webapp / RMWebServiceProtocol.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.resourcemanager.webapp;
20
21 import java.io.IOException;
22 import java.util.Set;
23
24 import javax.servlet.http.HttpServletRequest;
25 import javax.ws.rs.core.Response;
26
27 import org.apache.hadoop.classification.InterfaceAudience.Private;
28 import org.apache.hadoop.classification.InterfaceStability.Evolving;
29 import org.apache.hadoop.security.authorize.AuthorizationException;
30 import org.apache.hadoop.yarn.api.ApplicationBaseProtocol;
31 import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
32 import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest;
33 import org.apache.hadoop.yarn.exceptions.YarnException;
34 import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol;
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
62 /**
63 * <p>
64 * The protocol between clients and the <code>ResourceManager</code> to
65 * submit/abort jobs and to get information on applications, cluster metrics,
66 * nodes, queues, ACLs and reservations via REST calls.
67 * </p>
68 *
69 * The WebService is reachable by using {@link RMWSConsts#RM_WEB_SERVICE_PATH}
70 */
71 @Private
72 @Evolving
73 public interface RMWebServiceProtocol {
74
75 /**
76 * This method retrieves the cluster information, and it is reachable by using
77 * {@link RMWSConsts#INFO}.
78 *
79 * @return the cluster information
80 */
81 ClusterInfo get();
82
83 /**
84 * This method retrieves the cluster information, and it is reachable by using
85 * {@link RMWSConsts#INFO}.
86 *
87 * @return the cluster information
88 */
89 ClusterInfo getClusterInfo();
90
91 /**
92 * This method retrieves the cluster metrics information, and it is reachable
93 * by using {@link RMWSConsts#METRICS}.
94 *
95 * @see ApplicationClientProtocol#getClusterMetrics
96 * @return the cluster metrics information
97 */
98 ClusterMetricsInfo getClusterMetricsInfo();
99
100 /**
101 * This method retrieves the current scheduler status, and it is reachable by
102 * using {@link RMWSConsts#SCHEDULER}.
103 *
104 * @return the current scheduler status
105 */
106 SchedulerTypeInfo getSchedulerInfo();
107
108 /**
109 * This method dumps the scheduler logs for the time got in input, and it is
110 * reachable by using {@link RMWSConsts#SCHEDULER_LOGS}.
111 *
112 * @param time the period of time. It is a FormParam.
113 * @param hsr the servlet request
114 * @return the result of the operation
115 * @throws IOException when it cannot create dump log file
116 */
117 String dumpSchedulerLogs(String time, HttpServletRequest hsr)
118 throws IOException;
119
120 /**
121 * This method retrieves all the nodes information in the cluster, and it is
122 * reachable by using {@link RMWSConsts#NODES}.
123 *
124 * @see ApplicationClientProtocol#getClusterNodes
125 * @param states the states we want to filter. It is a QueryParam.
126 * @return all nodes in the cluster. If the states param is given, returns all
127 * nodes that are in the comma-separated list of states
128 */
129 NodesInfo getNodes(String states);
130
131 /**
132 * This method retrieves a specific node information, and it is reachable by
133 * using {@link RMWSConsts#NODES_NODEID}.
134 *
135 * @param nodeId the node we want to retrieve the information. It is a
136 * PathParam.
137 * @return the information about the node in input
138 */
139 NodeInfo getNode(String nodeId);
140
141 /**
142 * This method retrieves all the app reports in the cluster, and it is
143 * reachable by using {@link RMWSConsts#APPS}.
144 *
145 * @see ApplicationClientProtocol#getApplications
146 * @param hsr the servlet request
147 * @param stateQuery right now the stateQuery is deprecated. It is a
148 * QueryParam.
149 * @param statesQuery filter the result by states. It is a QueryParam.
150 * @param finalStatusQuery filter the result by final states. It is a
151 * QueryParam.
152 * @param userQuery filter the result by user. It is a QueryParam.
153 * @param queueQuery filter the result by queue. It is a QueryParam.
154 * @param count set a limit of the result. It is a QueryParam.
155 * @param startedBegin filter the result by started begin time. It is a
156 * QueryParam.
157 * @param startedEnd filter the result by started end time. It is a
158 * QueryParam.
159 * @param finishBegin filter the result by finish begin time. It is a
160 * QueryParam.
161 * @param finishEnd filter the result by finish end time. It is a QueryParam.
162 * @param applicationTypes filter the result by types. It is a QueryParam.
163 * @param applicationTags filter the result by tags. It is a QueryParam.
164 * @param unselectedFields De-selected params to avoid from report. It is a
165 * QueryParam.
166 * @return all apps in the cluster
167 */
168 @SuppressWarnings("checkstyle:parameternumber")
169 AppsInfo getApps(HttpServletRequest hsr, String stateQuery,
170 Set<String> statesQuery, String finalStatusQuery, String userQuery,
171 String queueQuery, String count, String startedBegin, String startedEnd,
172 String finishBegin, String finishEnd, Set<String> applicationTypes,
173 Set<String> applicationTags, Set<String> unselectedFields);
174
175 /**
176 * This method retrieve all the activities in a specific node, and it is
177 * reachable by using {@link RMWSConsts#SCHEDULER_ACTIVITIES}.
178 *
179 * @param hsr the servlet request
180 * @param nodeId the node we want to retrieve the activities. It is a
181 * QueryParam.
182 * @return all the activities in the specific node
183 */
184 ActivitiesInfo getActivities(HttpServletRequest hsr, String nodeId);
185
186 /**
187 * This method retrieves all the activities for a specific app for a specific
188 * period of time, and it is reachable by using
189 * {@link RMWSConsts#SCHEDULER_APP_ACTIVITIES}.
190 *
191 * @param hsr the servlet request
192 * @param appId the applicationId we want to retrieve the activities. It is a
193 * QueryParam.
194 * @param time for how long we want to retrieve the activities. It is a
195 * QueryParam.
196 * @return all the activities about a specific app for a specific time
197 */
198 AppActivitiesInfo getAppActivities(HttpServletRequest hsr, String appId,
199 String time);
200
201 /**
202 * This method retrieves all the statistics for a specific app, and it is
203 * reachable by using {@link RMWSConsts#APP_STATISTICS}.
204 *
205 * @param hsr the servlet request
206 * @param stateQueries filter the result by states. It is a QueryParam.
207 * @param typeQueries filter the result by type names. It is a QueryParam.
208 * @return the application's statistics for specific states and types
209 */
210 ApplicationStatisticsInfo getAppStatistics(HttpServletRequest hsr,
211 Set<String> stateQueries, Set<String> typeQueries);
212
213 /**
214 * This method retrieves the report for a specific app, and it is reachable by
215 * using {@link RMWSConsts#APPS_APPID}.
216 *
217 * @see ApplicationClientProtocol#getApplicationReport
218 * @param hsr the servlet request
219 * @param appId the Id of the application we want the report. It is a
220 * PathParam.
221 * @param unselectedFields De-selected param list to avoid from report. It is
222 * a QueryParam.
223 * @return the app report for a specific application
224 */
225 AppInfo getApp(HttpServletRequest hsr, String appId,
226 Set<String> unselectedFields);
227
228 /**
229 * This method retrieves the state for a specific app, and it is reachable by
230 * using {@link RMWSConsts#APPS_APPID_STATE}.
231 *
232 * @param hsr the servlet request
233 * @param appId the Id of the application we want the state. It is a
234 * PathParam.
235 * @return the state for a specific application
236 * @throws AuthorizationException if the user is not authorized
237 */
238 AppState getAppState(HttpServletRequest hsr, String appId)
239 throws AuthorizationException;
240
241 /**
242 * This method updates the state of the app in input, and it is reachable by
243 * using {@link RMWSConsts#APPS_APPID_STATE}.
244 *
245 * @param targetState the target state for the app. It is a content param.
246 * @param hsr the servlet request
247 * @param appId the Id of the application we want to update the state. It is a
248 * PathParam.
249 * @return Response containing the status code
250 * @throws AuthorizationException if the user is not authorized to invoke this
251 * method
252 * @throws YarnException if app does not exist
253 * @throws InterruptedException if interrupted
254 * @throws IOException if doAs action throws an IOException
255 */
256 Response updateAppState(AppState targetState, HttpServletRequest hsr,
257 String appId) throws AuthorizationException, YarnException,
258 InterruptedException, IOException;
259
260 /**
261 * This method retrieves all the node labels with the respective nodes in the
262 * cluster, and it is reachable by using
263 * {@link RMWSConsts#GET_NODE_TO_LABELS}.
264 *
265 * @see ApplicationClientProtocol#getNodeToLabels
266 * @param hsr the servlet request
267 * @return all the nodes within a node label
268 * @throws IOException if an IOException happened
269 */
270 NodeToLabelsInfo getNodeToLabels(HttpServletRequest hsr) throws IOException;
271
272 /**
273 * This method retrieves all the node within multiple node labels in the
274 * cluster, and it is reachable by using {@link RMWSConsts#LABEL_MAPPINGS}.
275 *
276 * @see ApplicationClientProtocol#getLabelsToNodes
277 * @param labels filter the result by node labels. It is a QueryParam.
278 * @return all the nodes within multiple node labels
279 * @throws IOException if an IOException happened
280 */
281 LabelsToNodesInfo getLabelsToNodes(Set<String> labels) throws IOException;
282
283 /**
284 * This method replaces all the node labels for specific nodes, and it is
285 * reachable by using {@link RMWSConsts#REPLACE_NODE_TO_LABELS}.
286 *
287 * @see ResourceManagerAdministrationProtocol#replaceLabelsOnNode
288 * @param newNodeToLabels the list of new labels. It is a content param.
289 * @param hsr the servlet request
290 * @return Response containing the status code
291 * @throws Exception if an exception happened
292 */
293 Response replaceLabelsOnNodes(NodeToLabelsEntryList newNodeToLabels,
294 HttpServletRequest hsr) throws Exception;
295
296 /**
297 * This method replaces all the node labels for specific node, and it is
298 * reachable by using {@link RMWSConsts#NODES_NODEID_REPLACE_LABELS}.
299 *
300 * @see ResourceManagerAdministrationProtocol#replaceLabelsOnNode
301 * @param newNodeLabelsName the list of new labels. It is a QueryParam.
302 * @param hsr the servlet request
303 * @param nodeId the node we want to replace the node labels. It is a
304 * PathParam.
305 * @return Response containing the status code
306 * @throws Exception if an exception happened
307 */
308 Response replaceLabelsOnNode(Set<String> newNodeLabelsName,
309 HttpServletRequest hsr, String nodeId) throws Exception;
310
311 /**
312 * This method retrieves all the node labels in the cluster, and it is
313 * reachable by using {@link RMWSConsts#GET_NODE_LABELS}.
314 *
315 * @see ApplicationClientProtocol#getClusterNodeLabels
316 * @param hsr the servlet request
317 * @return all the node labels in the cluster
318 * @throws IOException if an IOException happened
319 */
320 NodeLabelsInfo getClusterNodeLabels(HttpServletRequest hsr)
321 throws IOException;
322
323 /**
324 * This method adds specific node labels for specific nodes, and it is
325 * reachable by using {@link RMWSConsts#ADD_NODE_LABELS}.
326 *
327 * @see ResourceManagerAdministrationProtocol#addToClusterNodeLabels
328 * @param newNodeLabels the node labels to add. It is a content param.
329 * @param hsr the servlet request
330 * @return Response containing the status code
331 * @throws Exception in case of bad request
332 */
333 Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels,
334 HttpServletRequest hsr) throws Exception;
335
336 /**
337 * This method removes all the node labels for specific nodes, and it is
338 * reachable by using {@link RMWSConsts#REMOVE_NODE_LABELS}.
339 *
340 * @see ResourceManagerAdministrationProtocol#removeFromClusterNodeLabels
341 * @param oldNodeLabels the node labels to remove. It is a QueryParam.
342 * @param hsr the servlet request
343 * @return Response containing the status code
344 * @throws Exception in case of bad request
345 */
346 Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
347 HttpServletRequest hsr) throws Exception;
348
349 /**
350 * This method retrieves all the node labels for specific node, and it is
351 * reachable by using {@link RMWSConsts#NODES_NODEID_GETLABELS}.
352 *
353 * @param hsr the servlet request
354 * @param nodeId the node we want to get all the node labels. It is a
355 * PathParam.
356 * @return all the labels for a specific node.
357 * @throws IOException if an IOException happened
358 */
359 NodeLabelsInfo getLabelsOnNode(HttpServletRequest hsr, String nodeId)
360 throws IOException;
361
362 /**
363 * This method retrieves the priority for a specific app, and it is reachable
364 * by using {@link RMWSConsts#APPS_APPID_PRIORITY}.
365 *
366 * @param hsr the servlet request
367 * @param appId the app we want to get the priority. It is a PathParam.
368 * @return the priority for a specific application
369 * @throws AuthorizationException in case of the user is not authorized
370 */
371 AppPriority getAppPriority(HttpServletRequest hsr, String appId)
372 throws AuthorizationException;
373
374 /**
375 * This method updates the priority for a specific application, and it is
376 * reachable by using {@link RMWSConsts#APPS_APPID_PRIORITY}.
377 *
378 * @param targetPriority the priority we want to set for the app. It is a
379 * content param.
380 * @param hsr the servlet request
381 * @param appId the application we want to update its priority. It is a
382 * PathParam.
383 * @return Response containing the status code
384 * @throws AuthorizationException if the user is not authenticated
385 * @throws YarnException if the target is null
386 * @throws IOException if the update fails.
387 * @throws InterruptedException if interrupted.
388 */
389 Response updateApplicationPriority(AppPriority targetPriority,
390 HttpServletRequest hsr, String appId) throws AuthorizationException,
391 YarnException, InterruptedException, IOException;
392
393 /**
394 * This method retrieves the queue for a specific app, and it is reachable by
395 * using {@link RMWSConsts#APPS_APPID_QUEUE}.
396 *
397 * @param hsr the servlet request
398 * @param appId the application we want to retrieve its queue. It is a
399 * PathParam.
400 * @return the Queue for a specific application.
401 * @throws AuthorizationException if the user is not authenticated
402 */
403 AppQueue getAppQueue(HttpServletRequest hsr, String appId)
404 throws AuthorizationException;
405
406 /**
407 * This method updates the queue for a specific application, and it is
408 * reachable by using {@link RMWSConsts#APPS_APPID_QUEUE}.
409 *
410 * @param targetQueue the queue we want to set. It is a content param.
411 * @param hsr the servlet request
412 * @param appId the application we want to change its queue. It is a
413 * PathParam.
414 * @return Response containing the status code
415 * @throws AuthorizationException if the user is not authenticated
416 * @throws YarnException if the app is not found
417 * @throws IOException if the update fails.
418 * @throws InterruptedException if interrupted.
419 */
420 Response updateAppQueue(AppQueue targetQueue, HttpServletRequest hsr,
421 String appId) throws AuthorizationException, YarnException,
422 InterruptedException, IOException;
423
424 /**
425 * Generates a new ApplicationId which is then sent to the client. This method
426 * is reachable by using {@link RMWSConsts#APPS_NEW_APPLICATION}.
427 *
428 * @see ApplicationClientProtocol#getNewApplication
429 *
430 * @param hsr the servlet request
431 * @return Response containing the app id and the maximum resource
432 * capabilities
433 * @throws AuthorizationException if the user is not authorized to invoke this
434 * method
435 * @throws IOException if the creation fails
436 * @throws InterruptedException if interrupted
437 */
438 Response createNewApplication(HttpServletRequest hsr)
439 throws AuthorizationException, IOException, InterruptedException;
440
441 /**
442 * Function to submit an app to the RM. This method is reachable by using
443 * {@link RMWSConsts#APPS}.
444 *
445 * @see ApplicationClientProtocol#submitApplication
446 *
447 * @param newApp structure containing information to construct the
448 * ApplicationSubmissionContext. It is a content param.
449 * @param hsr the servlet request
450 * @return Response containing the status code
451 * @throws AuthorizationException if the user is not authorized to invoke this
452 * method
453 * @throws IOException if the submission failed
454 * @throws InterruptedException if interrupted
455 */
456 Response submitApplication(ApplicationSubmissionContextInfo newApp,
457 HttpServletRequest hsr)
458 throws AuthorizationException, IOException, InterruptedException;
459
460 /**
461 * This method posts a delegation token from the client, and it is reachable
462 * by using {@link RMWSConsts#DELEGATION_TOKEN}.
463 *
464 * @see ApplicationBaseProtocol#getDelegationToken
465 * @param tokenData the token to delegate. It is a content param.
466 * @param hsr the servlet request
467 * @return Response containing the status code
468 * @throws AuthorizationException if Kerberos auth failed
469 * @throws IOException if the delegation failed
470 * @throws InterruptedException if interrupted
471 * @throws Exception in case of bad request
472 */
473 Response postDelegationToken(DelegationToken tokenData,
474 HttpServletRequest hsr) throws AuthorizationException, IOException,
475 InterruptedException, Exception;
476
477 /**
478 * This method updates the expiration for a delegation token from the client,
479 * and it is reachable by using
480 * {@link RMWSConsts#DELEGATION_TOKEN_EXPIRATION}.
481 *
482 * @see ApplicationBaseProtocol#renewDelegationToken
483 * @param hsr the servlet request
484 * @return Response containing the status code
485 * @throws AuthorizationException if Kerberos auth failed
486 * @throws IOException if the delegation failed
487 * @throws Exception in case of bad request
488 */
489 Response postDelegationTokenExpiration(HttpServletRequest hsr)
490 throws AuthorizationException, IOException, Exception;
491
492 /**
493 * This method cancel the delegation token from the client, and it is
494 * reachable by using {@link RMWSConsts#DELEGATION_TOKEN}.
495 *
496 * @see ApplicationBaseProtocol#cancelDelegationToken
497 * @param hsr the servlet request
498 * @return Response containing the status code
499 * @throws AuthorizationException if Kerberos auth failed
500 * @throws IOException if the delegation failed
501 * @throws InterruptedException if interrupted
502 * @throws Exception in case of bad request
503 */
504 Response cancelDelegationToken(HttpServletRequest hsr)
505 throws AuthorizationException, IOException, InterruptedException,
506 Exception;
507
508 /**
509 * Generates a new ReservationId which is then sent to the client. This method
510 * is reachable by using {@link RMWSConsts#RESERVATION_NEW}.
511 *
512 * @see ApplicationClientProtocol#getNewReservation
513 *
514 * @param hsr the servlet request
515 * @return Response containing the app id and the maximum resource
516 * capabilities
517 * @throws AuthorizationException if the user is not authorized to invoke this
518 * method.
519 * @throws IOException if creation failed
520 * @throws InterruptedException if interrupted
521 */
522 Response createNewReservation(HttpServletRequest hsr)
523 throws AuthorizationException, IOException, InterruptedException;
524
525 /**
526 * Function to submit a Reservation to the RM.This method is reachable by
527 * using {@link RMWSConsts#RESERVATION_SUBMIT}.
528 *
529 * @see ApplicationClientProtocol#submitReservation
530 *
531 * @param resContext provides information to construct the
532 * ReservationSubmissionRequest. It is a content param.
533 * @param hsr the servlet request
534 * @return Response containing the status code
535 * @throws AuthorizationException if the user is not authorized to invoke this
536 * method
537 * @throws IOException if creation failed
538 * @throws InterruptedException if interrupted
539 */
540 Response submitReservation(ReservationSubmissionRequestInfo resContext,
541 HttpServletRequest hsr)
542 throws AuthorizationException, IOException, InterruptedException;
543
544 /**
545 * Function to update a Reservation to the RM. This method is reachable by
546 * using {@link RMWSConsts#RESERVATION_UPDATE}.
547 *
548 * @see ApplicationClientProtocol#updateReservation
549 *
550 * @param resContext provides information to construct the
551 * ReservationUpdateRequest. It is a content param.
552 * @param hsr the servlet request
553 * @return Response containing the status code
554 * @throws AuthorizationException if the user is not authorized to invoke this
555 * method
556 * @throws IOException if the operation failed
557 * @throws InterruptedException if interrupted
558 */
559 Response updateReservation(ReservationUpdateRequestInfo resContext,
560 HttpServletRequest hsr)
561 throws AuthorizationException, IOException, InterruptedException;
562
563 /**
564 * Function to delete a Reservation to the RM. This method is reachable by
565 * using {@link RMWSConsts#RESERVATION_DELETE}.
566 *
567 * @see ApplicationClientProtocol#deleteReservation
568 *
569 * @param resContext provides information to construct the
570 * ReservationDeleteRequest. It is a content param.
571 * @param hsr the servlet request
572 * @return Response containing the status code
573 * @throws AuthorizationException when the user group information cannot be
574 * retrieved.
575 * @throws IOException when a {@link ReservationDeleteRequest} cannot be
576 * created from the {@link ReservationDeleteRequestInfo}. This
577 * exception is also thrown on
578 * {@code ClientRMService.deleteReservation} invokation failure.
579 * @throws InterruptedException if doAs action throws an InterruptedException.
580 */
581 Response deleteReservation(ReservationDeleteRequestInfo resContext,
582 HttpServletRequest hsr)
583 throws AuthorizationException, IOException, InterruptedException;
584
585 /**
586 * Function to retrieve a list of all the reservations. This method is
587 * reachable by using {@link RMWSConsts#RESERVATION_LIST}.
588 *
589 * @see ApplicationClientProtocol#listReservations
590 * @param queue filter the result by queue. It is a QueryParam.
591 * @param reservationId filter the result by reservationId. It is a
592 * QueryParam.
593 * @param startTime filter the result by start time. It is a QueryParam.
594 * @param endTime filter the result by end time. It is a QueryParam.
595 * @param includeResourceAllocations true if the resource allocation should be
596 * in the result, false otherwise. It is a QueryParam.
597 * @param hsr the servlet request
598 * @return Response containing the status code
599 * @throws Exception in case of bad request
600 */
601 Response listReservation(String queue, String reservationId, long startTime,
602 long endTime, boolean includeResourceAllocations, HttpServletRequest hsr)
603 throws Exception;
604
605 /**
606 * This method retrieves the timeout information for a specific app with a
607 * specific type, and it is reachable by using
608 * {@link RMWSConsts#APPS_TIMEOUTS_TYPE}.
609 *
610 * @param hsr the servlet request
611 * @param appId the application we want to get the timeout. It is a PathParam.
612 * @param type the type of the timeouts. It is a PathParam.
613 * @return the timeout for a specific application with a specific type.
614 * @throws AuthorizationException if the user is not authorized
615 */
616 AppTimeoutInfo getAppTimeout(HttpServletRequest hsr, String appId,
617 String type) throws AuthorizationException;
618
619 /**
620 * This method retrieves the timeout information for a specific app, and it is
621 * reachable by using {@link RMWSConsts#APPS_TIMEOUTS}.
622 *
623 * @param hsr the servlet request
624 * @param appId the application we want to get the timeouts. It is a
625 * PathParam.
626 * @return the timeouts for a specific application
627 * @throws AuthorizationException if the user is not authorized
628 */
629 AppTimeoutsInfo getAppTimeouts(HttpServletRequest hsr, String appId)
630 throws AuthorizationException;
631
632 /**
633 * This method updates the timeout information for a specific app, and it is
634 * reachable by using {@link RMWSConsts#APPS_TIMEOUT}.
635 *
636 * @see ApplicationClientProtocol#updateApplicationTimeouts
637 * @param appTimeout the appTimeoutInfo. It is a content param.
638 * @param hsr the servlet request
639 * @param appId the application we want to update. It is a PathParam.
640 * @return Response containing the status code
641 * @throws AuthorizationException if the user is not authorized to invoke this
642 * method
643 * @throws YarnException in case of bad request
644 * @throws IOException if the operation failed
645 * @throws InterruptedException if interrupted
646 */
647 Response updateApplicationTimeout(AppTimeoutInfo appTimeout,
648 HttpServletRequest hsr, String appId) throws AuthorizationException,
649 YarnException, InterruptedException, IOException;
650
651 /**
652 * This method retrieves all the attempts information for a specific app, and
653 * it is reachable by using {@link RMWSConsts#APPS_APPID_APPATTEMPTS}.
654 *
655 * @see ApplicationBaseProtocol#getApplicationAttempts
656 * @param hsr the servlet request
657 * @param appId the application we want to get the attempts. It is a
658 * PathParam.
659 * @return all the attempts info for a specific application
660 */
661 AppAttemptsInfo getAppAttempts(HttpServletRequest hsr, String appId);
662
663 /**
664 * This method verifies if an user has access to a specified queue.
665 *
666 * @return Response containing the status code.
667 *
668 * @param queue queue
669 * @param username user
670 * @param queueAclType acl type of queue, it could be
671 * SUBMIT_APPLICATIONS/ADMINISTER_QUEUE
672 * @param hsr request
673 *
674 * @throws AuthorizationException if the user is not authorized to invoke this
675 * method.
676 */
677 RMQueueAclInfo checkUserAccessToQueue(String queue, String username,
678 String queueAclType, HttpServletRequest hsr)
679 throws AuthorizationException;
680 }