001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.yarn.api.protocolrecords;
020
021import org.apache.hadoop.classification.InterfaceAudience.Private;
022import org.apache.hadoop.classification.InterfaceAudience.Public;
023import org.apache.hadoop.classification.InterfaceStability.Unstable;
024import org.apache.hadoop.yarn.api.records.ReservationAllocationState;
025import org.apache.hadoop.yarn.util.Records;
026
027import java.util.List;
028
029/**
030 * {@link ReservationListResponse} captures the list of reservations that the
031 * user has queried.
032 *
033 * The resulting list of {@link ReservationAllocationState} contains a list of
034 * {@code ResourceAllocationRequest} representing the current state of the
035 * reservation resource allocations will be returned. This is subject to change
036 * in the event of re-planning a described by {@code ReservationDefinition}
037 *
038 * @see ReservationAllocationState
039 *
040 */
041@Public
042@Unstable
043public abstract class ReservationListResponse {
044
045  @Private
046  @Unstable
047  public static ReservationListResponse newInstance(
048      List<ReservationAllocationState> reservationAllocationState) {
049    ReservationListResponse response =
050        Records.newRecord(ReservationListResponse.class);
051    response.setReservationAllocationState(reservationAllocationState);
052    return response;
053  }
054
055  /**
056   * Get the list of {@link ReservationAllocationState}, that corresponds
057   * to a reservation in the scheduler.
058   *
059   * @return the list of {@link ReservationAllocationState} which holds
060   * information of a particular reservation
061   */
062  @Public
063  @Unstable
064  public abstract List<ReservationAllocationState>
065          getReservationAllocationState();
066
067  /**
068   * Set the list of {@link ReservationAllocationState}, that correspond
069   * to a reservation in the scheduler.
070   *
071   * @param reservationAllocationState the list of
072   * {@link ReservationAllocationState} which holds information of a
073   *                                   particular reservation.
074   */
075  @Private
076  @Unstable
077  public abstract void setReservationAllocationState(
078          List<ReservationAllocationState> reservationAllocationState);
079}